I am trying to use python for the repetitive task of selecting only certain vertices to form a face.
Given is an mesh-object that consists of vertices only and does not have edges or faces. Now its about selecting a certain area and filling it. (Due to the structure of the points the area within each circle_select will always contain 4 values.)
Here my code:
Code: Select all
import bpy
#select object as active and change toggle to editmode
bpy.context.scene.objects.active = bpy.data.objects['mymesh']
bpy.ops.object.mode_set(mode='EDIT')
#(working)
# deselect all
bpy.ops.mesh.select_all(action='DESELECT')
#(working)
# change to top view
bpy.ops.view3d.viewnumpad(type='TOP')
#(not working. Console says poll() [..] context incorrect...)
# circle select (C) with radius 1 around coordinates(x,y) and make face
bpy.ops.mask.select_circle.func(x=1,y=1,radius=1)
bpy.ops.mask.edge_face_add()
#(not working. Console says poll() [..] wrong context...)
The documentation on the commands has a lot of details and stuff but I could not find the slightest hint on how to get the command to actually work (not meant to be ungrateful or anything). At least it doesnt add up to me why there are codes like pby[..]select_circle.func() provided, if they don't actually work when applied as stated. I didn't find the missing link in this..
Help is very much appreciated, thank you for your answers.
Have a nice day
PS. Point Cloud to Mesh plugin isnt helping in this case, not even by filling all spaces and then deleting those which are not supposed to be filled, etc etc.