uhlik/bpy

Example scripts for load PLY file and converting to mesh

andrew-plowright opened this issue · 2 comments

Hello,

I have a series of several PLY files I'd like to load into Blender using the Point Cloud Viewer and then convert to meshes. Would it be possible to get some hints on how to script this? I saw the example you wrote using PCVOverseer but I wasn't able to get that to read a PLY file.

Thanks!

uhlik commented

PCVOverseer is for when you already have data to display. for loading ply, you can just replicate with python what you do in buttons. something like (and if you have seen PCVOverseer example, then you are using version 1.+, with 0.9.x from this repo, it would be different)

import bpy
c = bpy.context
o = c.active_object
pcv = o.point_cloud_visualizer
pcv.load.filepath = '/absolute/path/to/points.ply'
bpy.ops.point_cloud_visualizer.mechanist_draw()
pcv.convert.type = 'CUBE'
pcv.convert.use_all = False
pcv.convert.percentage = 10
bpy.ops.point_cloud_visualizer.convert()

That worked perfectly. Thank you very much!