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$

bumped to the homepage by Community 23 hours ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

  • $\begingroup$ some images are welcome please $\endgroup$ – yhoyo Aug 20 '18 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$ – Morten Lind Aug 20 '18 at 14:20
  • $\begingroup$ Hi, have you found a solution yet? Can I update the question with some research I have done? I'd really like to find an answer to this. $\endgroup$ – Leander Jun 3 at 8:09
  • $\begingroup$ @Leander, you are more than welcome to add to the question, or present you findings and perspectives! $\endgroup$ – Morten Lind Jun 4 at 9:11
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$
  • $\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$ – Morten Lind May 21 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.