freecad-scripts

Generates FreeCAD Python scripts for parametric 3D modeling, GUI tools, and CAD automation.

38.5k|4.9k|Updated Jun 11, 2025
One-click install
npx skills add https://github.com/github/awesome-copilot --skill freecad-scripts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: freecad-scripts
Source: https://github.com/github/awesome-copilot/tree/main/skills/freecad-scripts
Command: npx skills add https://github.com/github/awesome-copilot --skill freecad-scripts

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Writing correct FreeCAD Python API code requires deep knowledge of the Part, Mesh, Sketcher, and GUI modules, and translating natural-language modeling ideas into working scripts is slow and error-prone. This Skill converts shorthand, quasi-code, and plain descriptions of 3D modeling tasks into production-quality FreeCAD Python scripts and macros.

Core Features & Use Cases

  • Geometry and Solid Modeling: Creates primitives, wires, faces, extrusions, lofts, sweeps, booleans, fillets, and chamfers using the Part and OpenCASCADE-based API.
  • Parametric FeaturePython Objects: Builds custom parametric objects with typed properties, view providers, serialization, and version migration support.
  • GUI and Workbench Development: Generates PySide dialogs, task panels, Gui Commands, Coin3D/Pivy scenegraph code, and complete custom workbench templates.
  • Use Case: Ask for a parametric enclosure with mounting holes and a filleted lid, and receive a complete script with a FeaturePython object, constraints, recompute calls, and STEP export.

Quick Start

Ask the assistant to write a FreeCAD Python script that creates a parametric box with configurable length, width, height, and chamfered edges.

Frequently Asked Questions about freecad-scripts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a Python script for FreeCAD?

Import the FreeCAD and Part modules, create or access a document with FreeCAD.newDocument(), add objects via doc.addObject(), build shapes with functions like Part.makeBox(), and call doc.recompute(). Scripts run in FreeCAD's embedded Python console or as macros.

How to create parametric objects in FreeCAD with Python?

Create a FeaturePython object by defining a proxy class with __init__, execute, and onChanged methods, then attach it via obj.Proxy. Add typed properties like App::PropertyLength with obj.addProperty() so the object rebuilds its shape on every document recompute.

Does FreeCAD scripting work without the GUI?

Yes, core modules like FreeCAD, Part, and Mesh work headless, but FreeCADGui, PySide dialogs, and Pivy scenegraph code require GUI mode. Wrap GUI-dependent code in an if FreeCAD.GuiUp guard so scripts run in both environments.

How do I convert between mesh and solid in FreeCAD?

Use MeshPart.meshFromShape() with LinearDeflection and AngularDeflection parameters to tessellate a Part shape into a mesh. For the reverse, call shape.makeShapeFromMesh() with a tolerance, then Part.makeSolid() to build a solid.

Why does my FreeCAD script not update the 3D view?

Shape changes do not appear until you call doc.recompute() after modifying objects or properties. Also verify the object was added to the active document with doc.addObject() or Part.show() rather than only existing as an in-memory shape.

What are the limitations of FreeCAD boolean operations in scripts?

Boolean fuse, cut, and common operations can leave seam edges or fail on coincident faces and invalid shapes. Call removeSplitter() after fusing to clean seams, and check shape.isValid() before chaining further operations.