trimesh icon indicating copy to clipboard operation
trimesh copied to clipboard

x, y coordinates mesh section

Open sarreben opened this issue 3 years ago • 2 comments

Hello,

Thank you for your wonderful and very useful library. I need to get x, y coordinates resulting from the intersection of a mesh with a plane. I use the mesh.section to get that.

mesh = trimesh.load_mesh('Test.stl') slice = mesh.section(plane_origin=[0., 15., 0.], plane_normal=[0,1,0])

If I slice.vertices I can get the x, y z coordinates. However, points are not in the right order. I have tried to sort them by entities. It does not work very well. plot

Is there a proper way to get these coordinates? Can we play on a parameter to change the number of entities?

Thank you again. Ben.

sarreben avatar May 03 '22 08:05 sarreben

Hey, path.vertices are not in a meaningful order, they are referenced by path.entities[i].points. You probably want path.discrete

mikedh avatar May 03 '22 16:05 mikedh

Thank you for your suggestion. I have tried sl_2D.discrete, but I got an empty list.

For 2D path, I have seen connected_paths function seems could solve my issue. I just do not clearly understand the argument path_id.

Thanks.

sarreben avatar May 04 '22 12:05 sarreben