simulationapps / utils /cad_utils.py
karthikmn's picture
Update utils/cad_utils.py
37e6167 verified
raw
history blame contribute delete
534 Bytes
import os
def convert_cad_to_step(cad_file):
"""
Converts a CAD file to STEP format.
Returns the file path of the converted STEP file.
"""
try:
output_dir = "/tmp/"
os.makedirs(output_dir, exist_ok=True)
step_file = os.path.join(output_dir, "converted_model.step")
with open(step_file, "w") as f:
f.write(f"Converted from {cad_file.name}\nSTEP format content")
return step_file
except Exception as e:
return f"Error in CAD to STEP conversion: {e}"