Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ def generate_apdl_script(file, press_force, material_json):
|
|
| 19 |
model = cq.importers.importStep(step_file_path)
|
| 20 |
|
| 21 |
# Export as STL for meshing
|
| 22 |
-
stl_file = step_file_path.replace(".
|
| 23 |
exporters.export(model, stl_file)
|
| 24 |
|
| 25 |
# Generate APDL script
|
|
@@ -40,7 +40,7 @@ SOLVE
|
|
| 40 |
/EXIT, SAVE
|
| 41 |
"""
|
| 42 |
# Save APDL script to file
|
| 43 |
-
apdl_file_path = step_file_path.replace(".
|
| 44 |
with open(apdl_file_path, "w") as apdl_file:
|
| 45 |
apdl_file.write(apdl_script)
|
| 46 |
|
|
@@ -74,6 +74,11 @@ def main():
|
|
| 74 |
submit_button = gr.Button("Submit")
|
| 75 |
|
| 76 |
# Events
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
generate_button.click(
|
| 78 |
fn=generate_apdl_script,
|
| 79 |
inputs=[step_input, force_input, material_input],
|
|
|
|
| 19 |
model = cq.importers.importStep(step_file_path)
|
| 20 |
|
| 21 |
# Export as STL for meshing
|
| 22 |
+
stl_file = step_file_path.replace(".stp", ".stl")
|
| 23 |
exporters.export(model, stl_file)
|
| 24 |
|
| 25 |
# Generate APDL script
|
|
|
|
| 40 |
/EXIT, SAVE
|
| 41 |
"""
|
| 42 |
# Save APDL script to file
|
| 43 |
+
apdl_file_path = step_file_path.replace(".stp", ".inp")
|
| 44 |
with open(apdl_file_path, "w") as apdl_file:
|
| 45 |
apdl_file.write(apdl_script)
|
| 46 |
|
|
|
|
| 74 |
submit_button = gr.Button("Submit")
|
| 75 |
|
| 76 |
# Events
|
| 77 |
+
def handle_download(apdl_script, apdl_file_path):
|
| 78 |
+
if apdl_file_path and os.path.exists(apdl_file_path):
|
| 79 |
+
return apdl_file_path
|
| 80 |
+
return None
|
| 81 |
+
|
| 82 |
generate_button.click(
|
| 83 |
fn=generate_apdl_script,
|
| 84 |
inputs=[step_input, force_input, material_input],
|