Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from utils.cad_utils import convert_cad_to_step | |
| from utils.ansys_utils import run_simulation | |
| from utils.gcode_utils import generate_gcode | |
| def automate_workflow(cad_file): | |
| """ | |
| Automates the workflow: | |
| 1. Convert CAD file to STEP format. | |
| 2. Run simulation in ANSYS. | |
| 3. Generate G-Code for CNC. | |
| """ | |
| # Step 1: Convert CAD to STEP format | |
| step_file = convert_cad_to_step(cad_file) | |
| # Step 2: Run simulation in ANSYS | |
| simulation_results = run_simulation(step_file) | |
| # Step 3: Generate G-Code | |
| gcode_file = generate_gcode(step_file) | |
| return simulation_results, gcode_file | |
| # Gradio Interface | |
| interface = gr.Interface( | |
| fn=automate_workflow, | |
| inputs=[ | |
| gr.File(label="Upload CAD File (SolidWorks/SolidEdge)"), | |
| ], | |
| outputs=[ | |
| gr.Text(label="Simulation Results"), | |
| gr.File(label="Generated G-Code File") | |
| ], | |
| title="CAD to CNC Automation Workflow" | |
| ) | |
| if __name__ == "__main__": | |
| interface.launch() | |