dymokomi/luced-3d
Source of release 0.11.4
0.11.4 / tools / corpus_probe.luc
## Exercise the production importers without UI or reference substitutions.
import time
from luce_obj.obj import Obj
from luce_step.step import Step
pub func main(arguments: list[str]) -> int!:
for path in arguments:
let start = time.now()
if path.lower().ends_with(".obj"):
let mesh = Obj.load(path) catch failure:
print(f"FAIL {path}: {failure.message}")
continue
print(f"OBJ {path}: points={mesh.point_count()} faces={mesh.face_count()} corners={mesh.vertex_count()} ms={float(time.now() - start) / 1000000.0}")
else:
let model = Step.load_model(path) catch failure:
print(f"FAIL {path}: {failure.message}")
continue
print(f"STEP {path}: faces={model.face_count()} edges={model.edge_count()} import_ms={float(time.now() - start) / 1000000.0}")
let begin = time.now()
let mesh = model.tessellate(16) catch failure:
print(f"FAIL TESSELLATE {path}: {failure.message}")
continue
print(f"MESH {path}: points={mesh.point_count()} faces={mesh.face_count()} mesh_ms={float(time.now() - begin) / 1000000.0}")
return 0