1
$\begingroup$

I need to find the intersection curve between two (open) meshes, and I can do that interactively with the knife tool. In search for a way to do it from a script, I came across the following highly relevant question: Using knife_tool from python api

There is one answer, which simply refers to the BMesh API. However, I find no immediate candidate for the knife_tool from bpy.ops.mesh in bmesh.ops.mesh. Is there a way to script mesh intersection cutting from bmesh, or at all?

The attached screendump illustrates a cut in the cylinder mesh from the intersecting sphere mesh. I obtain it interactively with the cylinder mesh edges selected, then by Ctrl+F and choosing "Intersect (Knife)".

enter image description here

$\endgroup$
3
  • $\begingroup$ some images are welcome please $\endgroup$
    – yhoyo
    Aug 20, 2018 at 13:00
  • $\begingroup$ I can probably get by with bpy.ops.mesh.intersect. But if BMesh is the future, I would like to know how to do it with bmesh.ops.mesh. $\endgroup$ Aug 20, 2018 at 14:20
  • $\begingroup$ @Leander, you are more than welcome to add to the question, or present you findings and perspectives! $\endgroup$ Jun 4, 2019 at 9:11

1 Answer 1

0
$\begingroup$

Could be this?

# Select all vertices in Edit Mode
bpy.ops.mesh.select_all(action='SELECT')

# Do intersect
bpy.ops.mesh.intersect()
bpy.ops.mesh.intersect(mode='SELECT')
$\endgroup$
1
  • $\begingroup$ Thanks, @cogitas3d. I eventually ended up doing just that. However, that is not a BMesh operation, and it does not end up producing a BMesh. I have to convert the result to a BMesh afterwards. $\endgroup$ May 21, 2019 at 5:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .