0

Currently I am using this

https://github.com/openai/point-e/blob/main/point_e/examples/pointcloud2mesh.ipynb

and I would like to export to STL instead of PLY

I tried asking GPT and got

import trimesh

from point_e.util.pc_to_mesh import marching_cubes_mesh

# Generate the mesh
mesh = marching_cubes_mesh(
    pc=pc,
    model=model,
    batch_size=4096,
    grid_size=32,  # increase to 128 for resolution used in evals
    progress=True,
)

# Convert the mesh to a trimesh object
trimesh_mesh = trimesh.Trimesh(vertices=mesh.vertices, faces=mesh.faces)

# Export the mesh as an STL file
trimesh_mesh.export('test.stl', file_type='stl')

And got

AttributeError                            Traceback (most recent call last)
Cell In[56], line 20
     11 mesh = marching_cubes_mesh(
     12     pc=pc,
     13     model=model,
   (...)
     16     progress=True,
     17 )
     19 # Convert the mesh to a trimesh object
---> 20 trimesh_mesh = trimesh.Trimesh(vertices=mesh.vertices, faces=mesh.faces)
     22 # Export the mesh as an STL file
     23 trimesh_mesh.export('test.stl', file_type='stl')

AttributeError: 'TriMesh' object has no attribute 'vertices'

What is the correct way to export as a stl?

Jackie
  • 21,969
  • 32
  • 147
  • 289

0 Answers0