Skip to content

Commit

Permalink
updated python exporter from meshio to trimesh (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
elalish authored Sep 18, 2022
1 parent c38c2b6 commit f6839a3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/manifold.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: |
apt-get -y update
DEBIAN_FRONTEND=noninteractive apt install -y libomp-dev libassimp-dev git libtbb-dev pkg-config libpython3-dev python3 python3-distutils python3-pip lcov
pip install meshio[all]
pip install trimesh
- uses: actions/checkout@v3
with:
submodules: true
Expand Down
9 changes: 5 additions & 4 deletions bindings/python/examples/run_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import pathlib
import sys
import importlib
import meshio
import trimesh
from time import time

if __name__ == "__main__":
Expand All @@ -34,8 +34,9 @@
model = module.run()
if export_models:
mesh = model.to_mesh()
cells = [("triangle", mesh.tri_verts)]
meshio.write_points_cells(f'{f}.ply', mesh.vert_pos, cells)
print(f'Exported model to {f}.ply')
meshOut = trimesh.Trimesh(
vertices=mesh.vert_pos, faces=mesh.tri_verts)
trimesh.exchange.export.export_mesh(meshOut, f'{f}.glb', 'glb')
print(f'Exported model to {f}.glb')
t1 = time()
print(f'Took {(t1-t0)*1000:.1f}ms for {f}')
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
version = "beta";
src = self;
patches = [ ./thrust.diff ];
nativeBuildInputs = (with pkgs; [ cmake (python39.withPackages(ps: with ps; [meshio])) ]) ++ build-tools ++
nativeBuildInputs = (with pkgs; [ cmake (python39.withPackages(ps: with ps; [trimesh])) ]) ++ build-tools ++
(if cuda-support then with pkgs.cudaPackages; [ cuda_nvcc cuda_cudart cuda_cccl pkgs.addOpenGLRunpath ] else [ ]);
cmakeFlags = [
"-DMANIFOLD_PAR=${pkgs.lib.strings.toUpper parallel-backend}"
Expand Down

0 comments on commit f6839a3

Please sign in to comment.