
Freecad Scripts
Generate FreeCAD Python macros and parametric scripts so hardware-minded solo builders automate 3D parts without clicking through every sketch.
Overview
freecad-scripts is an agent skill for the Build phase that writes FreeCAD Python scripts, macros, and parametric CAD automation.
Install
npx skills add https://github.com/github/awesome-copilot --skill freecad-scriptsWhat is this skill?
- FreeCAD Python API coverage for Part, Mesh, Sketcher, Path, and FEM scripting
- Parametric FeaturePython objects with custom document properties
- PySide/Qt GUI dialogs and Coin3D scenegraph tweaks via Pivy
- Macro development for repetitive solid and mesh conversions
- Natural-language and quasi-code translation into correct API calls
- Targets FreeCAD 0.19+ with 0.21+/1.0+ recommended for latest API
Adoption & trust: 678 installs on skills.sh; 34.6k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need repeatable 3D models in FreeCAD but manual GUI work and naive macros break whenever dimensions or workbenches change.
Who is it for?
Solo builders and makers already using FreeCAD who want agent-generated macros, FeaturePython objects, or PySide tools.
Skip if: Pure software SaaS projects with no CAD pipeline or teams standardized on Fusion/SolidWorks without FreeCAD.
When should I use this skill?
Create FreeCAD models, macros, FeaturePython objects, PySide GUIs, Coin3D scenegraph work, or any FreeCAD Python API task.
What do I get? / Deliverables
You get runnable FreeCAD Python that creates or updates geometry, parametric objects, or GUI tools aligned to your stated modeling task.
- FreeCAD Python script or macro file
- Optional parametric object or GUI command implementation
Recommended Skills
Journey fit
CAD automation scripts are written while building physical or hybrid products that need reproducible geometry. Integrations subphase covers tooling that embeds Python against FreeCAD’s Part, Sketcher, Mesh, and GUI APIs.
How it compares
Use for embedded FreeCAD Python automation, not for generic OpenSCAD or Blender mesh art pipelines.
Common Questions / FAQ
Who is freecad-scripts for?
Indie hardware hackers and developers who run FreeCAD locally and want Codex or Claude to draft correct Part/Sketcher/Python API code.
When should I use freecad-scripts?
During Build when scripting new parts, parametric enclosures, mesh-to-solid conversions, or custom workbench commands inside FreeCAD.
Is freecad-scripts safe to install?
Scripts execute inside your FreeCAD environment; review generated Python before running and check the Security Audits panel on this page.
SKILL.md
READMESKILL.md - Freecad Scripts
# 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. ## When to Use This Skill - Writing Python scripts for FreeCAD's built-in console or macro system - Creating or manipulating 3D geometry (Part, Mesh, Sketcher, Path, FEM) - Building parametric FeaturePython objects with custom properties - Developing GUI tools using PySide/Qt within FreeCAD - Manipulating the Coin3D scenegraph via Pivy - Creating custom workbenches or Gui Commands - Automating repetitive CAD operations with macros - Converting between mesh and solid representations - Scripting FEM analyses, raytracing, or drawing exports ## Prerequisites - FreeCAD installed (0.19+ recommended; 0.21+/1.0+ for latest API) - Python 3.x (bundled with FreeCAD) - For GUI work: PySide2 (bundled with FreeCAD) - For scenegraph: Pivy (bundled with FreeCAD) ## FreeCAD Python Environment FreeCAD embeds a Python interpreter. Scripts run in an environment where these key modules are available: ```python import FreeCAD # Core module (also aliased as 'App') import FreeCADGui # GUI module (also aliased as 'Gui') — only in GUI mode import Part # Part workbench — BRep/OpenCASCADE shapes import Mesh # Mesh workbench — triangulated meshes import Sketcher # Sketcher workbench — 2D constrained sketches import Draft # Draft workbench — 2D drawing tools import Arch # Arch/BIM workbench import Path # Path/CAM workbench import FEM # FEM workbench import TechDraw # TechDraw workbench (replaces Drawing) import BOPTools # Boolean operations import CompoundTools # Compound shape utilities ``` ### The FreeCAD Document Model ```python # Create or access a document doc = FreeCAD.newDocument("MyDoc") doc = FreeCAD.ActiveDocument # Add objects box = doc.addObject("Part::Box", "MyBox") box.Length = 10.0 box.Width = 10.0 box.Height = 10.0 # Recompute doc.recompute() # Access objects obj = doc.getObject("MyBox") obj = doc.MyBox # Attribute access also works # Remove objects doc.removeObject("MyBox") ``` ## Core Concepts ### Vectors and Placements ```python import FreeCAD # Vectors v1 = FreeCAD.Vector(1, 0, 0) v2 = FreeCAD.Vector(0, 1, 0) v3 = v1.cross(v2) # Cross product d = v1.dot(v2) # Dot product v4 = v1 + v2 # Addition length = v1.Length # Magnitude v_norm = FreeCAD.Vector(v1) v_norm.normalize() # In-place normalize # Rotations rot = FreeCAD.Rotation(FreeCAD.Vector(0, 0, 1), 45) # axis, angle(deg) rot = FreeCAD.Rotation(0, 0, 45) # Euler angles (yaw, pitch, roll) # Placements (position + orientation) placement = FreeCAD.Placement( FreeCAD.Vector(10, 20, 0), # translation FreeCAD.Rotation(0, 0, 45), # rotation FreeCAD.Vector(0, 0, 0) # center of rotation ) obj.Placement = placement # Matrix (4x4 transformation) import math mat = FreeCAD.Matrix() mat.move(FreeCAD.Vector(10, 0, 0)) mat.rotateZ(math.radians(45)) ``` ### Creating and Manipulating Geometry (Part Module) The Part module wraps OpenCASCADE and provides BRep solid modeling: ```python import FreeCAD import Part # --- Primitive Shapes --- box = Part.makeBox(10, 10, 10) # length, width, height cyl = Part.makeCylinder(5, 20) # radius, height sphere = Part.makeSphere