marcomusy / vedo

A python module for scientific analysis of 3D data based on VTK and Numpy
https://vedo.embl.es
MIT License
1.98k stars 257 forks source link

slice method returns None for mesh from stl model #1051

Closed dan-david closed 2 weeks ago

dan-david commented 4 months ago

vedo: v2014.5.1 python: v3.9.18

Why the slice method returns a None object for the .stl model?

from vedo import *
msh = Mesh("sample.stl").alpha(0.1).wireframe()
mslice = msh.slice(normal=[0,1,0], origin=[0,0,0])
mslice.c('purple5')
show(msh, mslice, axes=1)

I am using the following file:

sample.stl.zip

Thanks!

marcomusy commented 4 months ago

It returns None because the plane is not hitting the mesh, this works:

from vedo import *
msh = Mesh("sample.stl").alpha(0.1).wireframe()
mslice = msh.slice(normal=[0,1,0], origin=[0,2,0])
mslice.c('purple5')
show(msh, mslice, axes=1)

Screenshot from 2024-02-15 21-50-45