marcomusy / vedo

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

Cut a circle hole interactively #984

Closed Thanatossan closed 8 months ago

Thanatossan commented 10 months ago

I try interactive cut a circle hole in the mesh that depends on camera angle like this example https://github.com/marcomusy/vedo/blob/master/examples/basic/cut_freehand.py

except, I want to only click once (not draw a spline) and create a circle around the cursor to cut the mesh.

I tried to create a cylinder and had a problem with the axis of the cylinder doesn't align well with the camera angle.

Would you please give me an idea, of how to achieve this in Vedo?

marcomusy commented 10 months ago

Hi you can get the camera angle and create a cylinder from

        poc = np.array(plt.camera.GetPosition())
        foc = np.array(plt.camera.GetFocalPoint())
        cyl = Tube([poc, foc])