CADintegration / cad_model_generator.py
karthikmn's picture
Update cad_model_generator.py
6475662 verified
raw
history blame contribute delete
615 Bytes
import FreeCAD
import Part
import os
def create_press_tool_model(length: float, width: float, height: float) -> str:
# Create a new FreeCAD document
doc = FreeCAD.newDocument()
# Create a 3D box (for press tool or cutter)
box = Part.makeBox(length, width, height)
# Add box to the document
part = doc.addObject("Part::Feature", "PressTool")
part.Shape = box
# Recompute the document to update the geometry
doc.recompute()
# Set the path to save the generated STL file
output_path = "/tmp/press_tool.stl"
Part.export([part], output_path)
return output_path