1

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

Leander
  • 26,725
  • 2
  • 44
  • 105

1 Answers1

0

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')
cogitas3d
  • 45
  • 5
  • 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. – Morten Lind May 21 '19 at 05:46