npx skills add ...
npx skills add github/awesome-copilot --skill freecad-scripts
Expert skill for writing FreeCAD Python scripts, macros, and automation. Use when asked to create FreeCAD models, parametric objects, Part/Mesh/Sketcher scripts, workbench tools, GUI dialogs with PySide, Coin3D scenegraph manipulation, or any FreeCAD Python API task. Covers FreeCAD scripting basics, geometry creation, FeaturePython objects, interface tools, and macro development.
npx skills add github/awesome-copilot --skill freecad-scripts
Expert skill for generating production-quality Python scripts for the FreeCAD CAD application. Interprets shorthand, quasi-code, and natural language descriptions of 3D modeling tasks and translates them into correct FreeCAD Python API calls.
FreeCAD embeds a Python interpreter. Scripts run in an environment where these key modules are available:
The Part module wraps OpenCASCADE and provides BRep solid modeling:
sketch = doc.addObject("Sketcher::SketchObject", "MySketch") sketch.Placement = FreeCAD.Placement( FreeCAD.Vector(0, 0, 0), FreeCAD.Rotation(0, 0, 0, 1) )
idx_line = sketch.addGeometry(Part.LineSegment( FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(10, 0, 0))) idx_circle = sketch.addGeometry(Part.Circle( FreeCAD.Vector(5, 5, 0), FreeCAD.Vector(0, 0, 1), 3))
sketch.addConstraint(Sketcher.Constraint("Coincident", 0, 2, 1, 1)) sketch.addConstraint(Sketcher.Constraint("Horizontal", 0)) sketch.addConstraint(Sketcher.Constraint("DistanceX", 0, 1, 0, 2, 10.0)) sketch.addConstraint(Sketcher.Constraint("Radius", 1, 3.0)) sketch.addConstraint(Sketcher.Constraint("Fixed", 0, 1))
doc.recompute()
FeaturePython objects are custom parametric objects with properties that trigger recomputation:
| Property Type | Python Type | Description |
|---|---|---|
App::PropertyBool | bool | Boolean |
App::PropertyInteger | int | Integer |
App::PropertyFloat | float | Float |
App::PropertyString | str | String |
App::PropertyLength | float (units) | Length with units |
App::PropertyAngle | float (deg) | Angle in degrees |
App::PropertyVector | FreeCAD.Vector | 3D vector |
App::PropertyPlacement | FreeCAD.Placement | Position + rotation |
App::PropertyLink | object ref | Link to another object |
App::PropertyLinkList | list of refs | Links to multiple objects |
App::PropertyEnumeration | list/str | Dropdown selection |
App::PropertyFile | str | File path |
App::PropertyColor | tuple | RGB color (0.0-1.0) |
App::PropertyPythonObject | any | Serializable Python object |
When interpreting shorthand or quasi-code for FreeCAD scripts:
Part.makeBox(), "cylinder" → Part.makeCylinder(), "sphere" → Part.makeSphere(), "merge/combine/join" → .fuse(), "subtract/cut/remove" → .cut(), "intersect" → .common(), "round edges/fillet" → .makeFillet(), "bevel/chamfer" → .makeChamfer()doc = FreeCAD.ActiveDocument or FreeCAD.newDocument()doc.recompute() after modificationsif FreeCAD.GuiUp: when the script may run headlessPart.show(shape, "Name") for quick display, or doc.addObject("Part::Feature", "Name") for named persistent objectsSee the references/ directory for topic-organized guides: