julienr / meshcut

Python 3D mesh planar cross-section
MIT License
103 stars 27 forks source link

cutting orthogonal to tubes ends up with two non connected polygons #17

Closed TecDroiD closed 2 years ago

TecDroiD commented 4 years ago

Hi there, I try to slice a vertical tube along the xy plane. the result is two circular polygones which are not connected. the outer one is considered as complete object and covers the inner one.

I tried to visualize my results with matplotlib: tube

this is the test object I created using openSCAD.

testtube.stl.txt

If polygones had normals, I could look them up to see what's inside and outside.. To my understanding, if a triangle is connected to the plane, it's normal must be projected onto the plane and should be normalized after..

I currently play around with your code to set the loaded stl.mesh's normals into your mesh object but since I'm completely new to numpy I have hard times recalculating the normals. I currently just ignore z because that's the normal to my plane

Here's the code I used to create that image..

buildspace.py.txt

julienr commented 4 years ago

Hi, thank you for the report !

I am not sure I 100% understand what you are trying to achieve, but I tried to slice your provided stl with a plane on the xy axis and this seems to work (this is using a modified examples/1_stl_sphere_cut.py:

Note though that meshcut is just returning a list of polylines. It's not actually computing two new meshes (see #11 for some discussion on this). What output are you expecting ?

As a side not, I don't think the normals of the faces matter when cutting the mesh.

julienr commented 2 years ago

Closing this as a duplicate of #11