Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -171,11 +171,14 @@ def save_dxf_spline(inflated_contours, scaling_factor, height):
|
|
171 |
msp = doc.modelspace()
|
172 |
|
173 |
for contour in inflated_contours:
|
|
|
|
|
|
|
174 |
try:
|
175 |
-
resampled_contour = resample_contour(contour)
|
176 |
points = [
|
177 |
(x * scaling_factor, (height - y) * scaling_factor)
|
178 |
-
for x, y in
|
179 |
]
|
180 |
if len(points) >= 3:
|
181 |
if np.linalg.norm(np.array(points[0]) - np.array(points[-1])) > 1e-2:
|
|
|
171 |
msp = doc.modelspace()
|
172 |
|
173 |
for contour in inflated_contours:
|
174 |
+
# Ensure contour has enough points
|
175 |
+
if len(contour) < spline_degree + 1:
|
176 |
+
raise gr.Error(f"Contour must have at least {spline_degree + 1} points, but has {len(contour)} points.")
|
177 |
try:
|
178 |
+
# resampled_contour = resample_contour(contour)
|
179 |
points = [
|
180 |
(x * scaling_factor, (height - y) * scaling_factor)
|
181 |
+
for x, y in contour
|
182 |
]
|
183 |
if len(points) >= 3:
|
184 |
if np.linalg.norm(np.array(points[0]) - np.array(points[-1])) > 1e-2:
|