AbdelChoufani commited on
Commit
f1cf635
·
1 Parent(s): e29302d

Fix extrusion: catch ImportError on triangle and fallback to earcut

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -152,15 +152,14 @@ def create_3d_model(buildings: List[Dict]) -> trimesh.Scene:
152
  continue
153
 
154
  # extrude: prefer triangle if available, otherwise earcut
155
- try:
156
- extruded = trimesh.creation.extrude_polygon(polygon, height, engine="triangle")
157
- except (ImportError, ValueError) as e:
158
- if debug:
159
- print(f" ↳ triangle engine unavailable ({e}), falling back to earcut")
160
- extruded = trimesh.creation.extrude_polygon(polygon, height, engine="earcut")
161
-
162
  if debug:
163
- print(f" ↳ extruded mesh vertices={len(extruded.vertices)}, faces={len(extruded.faces)}")
 
 
 
164
 
165
  # orientation fix
166
  transform_x = trimesh.transformations.rotation_matrix(np.pi/2, (1, 0, 0))
 
152
  continue
153
 
154
  # extrude: prefer triangle if available, otherwise earcut
155
+ try:
156
+ extruded = trimesh.creation.extrude_polygon(polygon, height, engine="triangle")
157
+ except (ImportError, ValueError) as e:
 
 
 
 
158
  if debug:
159
+ print(f" ↳ triangle engine unavailable ({e}), falling back to earcut")
160
+ extruded = trimesh.creation.extrude_polygon(polygon, height, engine="earcut")
161
+ if debug:
162
+ print(f" ↳ extruded mesh vertices={len(extruded.vertices)}, faces={len(extruded.faces)}")
163
 
164
  # orientation fix
165
  transform_x = trimesh.transformations.rotation_matrix(np.pi/2, (1, 0, 0))