UPDATE 1: how calc the 3th vector to mathutils.geometry.normal(vectors)??
After @Chebhou answer I tried my "bisector tool" again... with mesh and bmesh.. now the problem is the 3th vector to calc the plane_normal in
I think that 3th vector should be align to view..... then I tried with camera and or cursor location with this results:
inicial state is: download .blend please
the first try with"pure" bisect tool give this data... this is correct then I need reproduce this same data with my addon:
bpy.ops.mesh.bisect(plane_co=(1.57825, 1.50332, -0.165924), plane_no=(0.695399, -0.691791, 0.194541), xstart=167, xend=628, ystart=443, yend=422)
and this result:
second try is with bpy.ops.mesh.bisect that give me this data:
in this case vectors are vertice 1 and vertice 2 selected and the camera location
as you see the cut is good but the location (I think the plane_co) is wrong!
bpy.ops.mesh.bisect(plane_co=(1.36157, 1.69042, 0.804025), plane_no=(-0.660225, 0.660225, -0.358059), use_fill=False, clear_inner=False, clear_outer=False, threshold=0.0001, xstart=404, xend=770, ystart=468, yend=450, cursor=1002)
last try give me this data:
as you see , plane_co is correct but the plane_no is incorrect!
how calc the 3th vector to mathutils.geometry.normal(vectors)??
Actually I have a problem with the bisect tool...
this is from mesh:
bpy.ops.mesh.bisect( plane_co=plane_co, plane_no=plane_no, use_fill=False, clear_inner=False, clear_outer=False, threshold=0.0001, xstart=0, xend=0, ystart=0, yend=0, cursor=1002)
and this from bmesh:
bmesh.ops.bisect_plane( bm, geom=visible_geom, dist=dist, plane_co=plane_co, plane_no=plane_no, use_snap_center=False, clear_outer=False, clear_inner=False)
after a lot of effort I thought that I found the plane_normal equation..... for example for bmesh:
v1,v2 = [v.co for v in bm.verts if (v.select == True and v.hide == False)] # plane_no math: normal = ((v1.y*v2.z)-(v1.z*v2.y)), ((v1.z*v2.x)-(v1.x*v2.z)),((v1.x*v2.y)-(v1.y*v2.x)) print("thenormal " + str(normal)) plane_no = normal plane_co = v2
Actually I know that
xstart=0, xend=0, ystart=0, yend=0, are the initial and final location of Operative System Cursor (not 3d blender cursor).. and this data help to blender in order to calc the plane_co
anyway... I can calc the plane_co because it is any point in the cut plane... but actually I don't know how to calc the plane_normal....
thanks for any help