Spaces:
Running
Running
Commit
·
e29302d
1
Parent(s):
91c0105
Fix extrusion: catch ImportError on triangle and fallback to earcut
Browse files
app.py
CHANGED
@@ -151,12 +151,12 @@ def create_3d_model(buildings: List[Dict]) -> trimesh.Scene:
|
|
151 |
if debug: print(f" ↳ skipping: polygon construction error: {e}")
|
152 |
continue
|
153 |
|
154 |
-
# extrude
|
155 |
-
try:
|
156 |
try:
|
157 |
extruded = trimesh.creation.extrude_polygon(polygon, height, engine="triangle")
|
158 |
-
except ValueError:
|
159 |
-
if debug:
|
|
|
160 |
extruded = trimesh.creation.extrude_polygon(polygon, height, engine="earcut")
|
161 |
|
162 |
if debug:
|
|
|
151 |
if debug: print(f" ↳ skipping: polygon construction error: {e}")
|
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:
|