File size: 1,000 Bytes
9025444
542982b
9025444
542982b
9025444
02526f8
73c5836
 
542982b
 
 
73c5836
542982b
 
 
 
 
9025444
542982b
 
9025444
02526f8
9025444
 
 
 
 
542982b
9025444
 
 
 
 
542982b
9025444
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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()