简体   繁体   中英

How to visualize a 3D mesh from an STL file using e.g. Opend3D and Python?

I have a STEP file which I converted into an STL file. I need the STL format to be able to extract certain features out of the 3D mesh. Further, I want to visualize the 3D model in an interactive manner , ie the user should be able to rotate and scale the model. The code I found, which uses Open3D , doesn't work so far:

import open3d as o3d

def visualize(mesh):
    vis = o3d.visualization.Visualizer()
    vis.create_window()
    vis.add_geometry(mesh)
    vis.run()
    vis.destroy_window()

mesh = o3d.io.read_triangle_model(path_stl_file)
visualize(mesh)

Any idea how to do it the right way? Thx.

Argh, I used the wrong importer . The function to be used is:

read_triangle_mesh(path_stl_file)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM