Spaces:
Sleeping
Sleeping
Update utils/cad_utils.py
Browse files- utils/cad_utils.py +15 -7
utils/cad_utils.py
CHANGED
|
@@ -1,9 +1,17 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
| 2 |
"""
|
| 3 |
-
|
| 4 |
-
|
| 5 |
"""
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
def convert_cad_to_step(cad_file):
|
| 4 |
"""
|
| 5 |
+
Converts a CAD file to STEP format.
|
| 6 |
+
Returns the file path of the converted STEP file.
|
| 7 |
"""
|
| 8 |
+
try:
|
| 9 |
+
output_dir = "/tmp/"
|
| 10 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 11 |
+
|
| 12 |
+
step_file = os.path.join(output_dir, "converted_model.step")
|
| 13 |
+
with open(step_file, "w") as f:
|
| 14 |
+
f.write(f"Converted from {cad_file.name}\nSTEP format content")
|
| 15 |
+
return step_file
|
| 16 |
+
except Exception as e:
|
| 17 |
+
return f"Error in CAD to STEP conversion: {e}"
|