New to Claude Skills? Learn how to install them →

hkuds on GitHub

CLI for FreeCAD

Free

Harness FreeCAD's capabilities through a comprehensive CLI.

by hkuds46.9k stars on hkuds/cli-anything
5 views
Updated Aug 3, 2026
Get this skill

Free · Opens the source repo

What CLI for FreeCAD does

The CLI for FreeCAD provides a complete command-line interface for the FreeCAD parametric 3D CAD modeler, encompassing a total of 258 commands across 17 distinct command groups. This skill allows users to interact with all workbenches in FreeCAD, including Part, Sketcher, PartDesign, Assembly, Mesh, TechDraw, Draft, FEM, CAM/CNC, Surface, Spreadsheet, and more. Each command is designed to facilitate a wide range of operations, from creating basic 3D primitives to complex assembly tasks, making it a versatile tool for both developers and designers.

With the CLI, users can execute commands for document management, part creation, sketching, and body design directly from the terminal. For instance, creating a new part or sketching a 2D shape can be done quickly with straightforward command syntax. The CLI also supports advanced operations such as boolean operations, transformations, and constraints, enabling users to build intricate models efficiently. Additionally, the skill includes functionality for exporting models in various formats, such as STEP, IGES, STL, and PDF, which is essential for sharing designs or preparing them for manufacturing.

One of the standout features of this CLI is its preview capabilities. Users can generate live previews of their designs, capturing multiple views and maintaining session states for iterative design processes. This is particularly useful for visualizing changes in real-time and ensuring design accuracy before final rendering. The integration with FreeCAD's headless mode allows for automation and scripting, making it suitable for batch processing or integration into larger workflows.

Overall, the CLI for FreeCAD is an essential tool for anyone looking to leverage the full power of FreeCAD through a command-line interface, whether for rapid prototyping, automation, or detailed design work. It is particularly beneficial for developers and designers who prefer scripting and command-line interactions over traditional GUI-based workflows.

When to use it

Use this skill when you need to automate FreeCAD tasks or prefer working in a command-line environment for efficiency.

When not to use it

This skill may not be suitable for users who prefer graphical interfaces or are unfamiliar with command-line operations.

What you can build with it

Automating Design Processes

Use the CLI to automate repetitive design tasks in FreeCAD, improving workflow efficiency.

Batch Exporting Models

Quickly export multiple models in different formats using command-line commands for streamlined production.

Real-time Design Visualization

Leverage live preview commands to visualize design changes instantly, ensuring accuracy before final rendering.

How to install CLI for FreeCAD

View source

1. Install with the skills CLI

npx skills add hkuds/cli-anything/skills --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by hkuds

cli-anything-freecad

Complete CLI harness for FreeCAD — 258 commands across 17 groups covering ALL workbenches.

Prerequisites

FreeCAD must be installed: freecadcmd must be in PATH.

Installation

pip install -e freecad/agent-harness

Basic Usage

cli-anything-freecad --json <command>           # JSON output for agents
cli-anything-freecad --json -p proj.json <cmd>  # With project file
cli-anything-freecad                            # Interactive REPL

Preview, Live Preview, and Motion

FreeCAD is currently the deepest preview integration in this branch.

Preview commands:

# List preview recipes
cli-anything-freecad --json -p proj.json preview recipes

# Capture a real 4-view bundle
cli-anything-freecad --json -p proj.json preview capture --recipe quick

# Start poll-mode live preview
cli-anything-freecad --json -p proj.json preview live start --recipe quick --mode poll --source-poll-ms 500

# Query current live state without rendering
cli-anything-freecad --json -p proj.json preview live status --recipe quick

# Stop live preview publication
cli-anything-freecad --json -p proj.json preview live stop --recipe quick

Typical quick bundle artifacts:

  • hero.png
  • front.png
  • top.png
  • right.png

Live preview persists:

  • session.json
  • immutable bundle directories
  • trajectory.json

preview live status --json is intended for agents and includes a compact trajectory_summary in addition to _session_dir, current bundle refs, and _trajectory_path.

Viewer commands:

cli-hub previews inspect /path/to/bundle-or-session
cli-hub previews html /path/to/bundle-or-session -o page.html
cli-hub previews watch /path/to/session --open
cli-hub previews open /path/to/bundle-or-session

Motion commands remain separate from preview and are used for final truthful frame rendering and showcase videos:

cli-anything-freecad --json -p proj.json motion new --name spin --duration 6 --fps 24
cli-anything-freecad --json -p proj.json motion keyframe spin --time 0.0 --part 0 --position 0,0,0
cli-anything-freecad --json -p proj.json motion render-video spin output.mp4

Command Groups (258 commands)

document (5) — Document management

cli-anything-freecad --json document new --name "Part" -o proj.json
cli-anything-freecad --json document new --profile print3d -o proj.json
cli-anything-freecad --json -p proj.json document info
cli-anything-freecad --json -p proj.json document save -o copy.json
cli-anything-freecad --json document profiles

part (29) — 3D primitives, boolean, transforms, operations

# Primitives: box, cylinder, sphere, cone, torus, wedge, helix, spiral, thread, plane, polygon_3d
cli-anything-freecad --json -p p.json part add box -P length=20 -P width=15 -P height=5
cli-anything-freecad --json -p p.json part add cylinder -P radius=3 -P height=10 --position 10,7.5,0

# Operations
cli-anything-freecad --json -p p.json part boolean cut 0 1
cli-anything-freecad --json -p p.json part copy 0
cli-anything-freecad --json -p p.json part mirror 0 --plane XY
cli-anything-freecad --json -p p.json part scale 0 --factor 2.0
cli-anything-freecad --json -p p.json part loft --indices 0,1,2
cli-anything-freecad --json -p p.json part sweep 0 1
cli-anything-freecad --json -p p.json part revolve 0 --axis Z --angle 360
cli-anything-freecad --json -p p.json part extrude 0 --direction 0,0,1 --length 10
cli-anything-freecad --json -p p.json part fillet-3d 0 --radius 2
cli-anything-freecad --json -p p.json part thickness 0 --thickness 1
cli-anything-freecad --json -p p.json part compound --indices 0,1,2
cli-anything-freecad --json -p p.json part section 0 --plane XY
cli-anything-freecad --json -p p.json part info 0
cli-anything-freecad --json -p p.json part line-3d --start 0,0,0 --end 10,5,0
cli-anything-freecad --json -p p.json part wire --points "0,0,0;10,0,0;10,10,0"

sketch (26) — 2D constrained sketching

cli-anything-freecad --json -p p.json sketch new --plane XY
cli-anything-freecad --json -p p.json sketch add-line 0 --start 0,0 --end 20,0
cli-anything-freecad --json -p p.json sketch add-circle 0 --center 10,10 --radius 5
cli-anything-freecad --json -p p.json sketch add-rect 0 --corner 0,0 --width 20 --height 15
cli-anything-freecad --json -p p.json sketch add-arc 0 --center 0,0 --radius 5
cli-anything-freecad --json -p p.json sketch add-ellipse 0 --center 0,0 --major-radius 10 --minor-radius 5
cli-anything-freecad --json -p p.json sketch add-polygon 0 --center 0,0 --sides 6 --radius 10
cli-anything-freecad --json -p p.json sketch add-bspline 0 --points "0,0;5,10;10,0;15,10"
cli-anything-freecad --json -p p.json sketch add-slot 0 --center1 0,0 --center2 10,0 --radius 2
cli-anything-freecad --json -p p.json sketch constrain 0 distance --elements 0,1 --value 10
cli-anything-freecad --json -p p.json sketch edit-element 0 0 --radius 8
cli-anything-freecad --json -p p.json sketch remove-element 0 2
cli-anything-freecad --json -p p.json sketch validate 0
cli-anything-freecad --json -p p.json sketch solve-status 0
# Constraints: coincident, horizontal, vertical, parallel, perpendicular, equal,
#   fixed, distance, angle, radius, tangent, symmetric, block, diameter,
#   point_on_object, distance_x, distance_y

body (38) — PartDesign features

cli-anything-freecad --json -p p.json body new
cli-anything-freecad --json -p p.json body pad 0 0 --length 10
cli-anything-freecad --json -p p.json body pocket 0 1 --length 5
cli-anything-freecad --json -p p.json body groove 0 0 --angle 360
cli-anything-freecad --json -p p.json body fillet 0 --radius 2
cli-anything-freecad --json -p p.json body chamfer 0 --size 1.5
cli-anything-freecad --json -p p.json body revolution 0 0 --angle 360
cli-anything-freecad --json -p p.json body additive-loft 0 --sketch-indices 0,1
cli-anything-freecad --json -p p.json body additive-pipe 0 0 1
cli-anything-freecad --json -p p.json body additive-helix 0 0 --pitch 5 --height 20
cli-anything-freecad --json -p p.json body additive-box 0 -P length=10 -P width=10 -P height=10
cli-anything-freecad --json -p p.json body hole 0 0 --diameter 5 --depth 10 --threaded
cli-anything-freecad --json -p p.json body draft-feature 0 --angle 5
cli-anything-freecad --json -p p.json body thickness-feature 0 --thickness 1
cli-anything-freecad --json -p p.json body linear-pattern 0 --occurrences 5 --length 50
cli-anything-freecad --json -p p.json body polar-pattern 0 --occurrences 6 --angle 360
cli-anything-freecad --json -p p.json body mirrored 0 --plane XY
cli-anything-freecad --json -p p.json body datum-plane 0 --reference XY --offset 10

material (8) — PBR materials with engineering properties

# 21 presets: steel, aluminum, copper, brass, titanium, stainless_steel, cast_iron,
#   carbon_fiber, nylon, abs, pla, petg, plastic_white, plastic_black, wood, glass,
#   rubber, gold, concrete, granite, marble
cli-anything-freecad --json -p p.json material create --preset steel
cli-anything-freecad --json -p p.json material create --preset titanium
cli-anything-freecad --json -p p.json material assign 0 0
cli-anything-freecad --json -p p.json material set 0 density 7800
cli-anything-freecad --json -p p.json material import-material mat.json
cli-anything-freecad --json -p p.json material export-material 0 --output mat.json

assembly (11) — Assembly management

cli-anything-freecad --json -p p.json assembly new --name "MyAssembly"
cli-anything-freecad --json -p p.json assembly add-part 0 0
cli-anything-freecad --json -p p.json assembly constrain 0 coincident --components 0,1
cli-anything-freecad --json -p p.json assembly constrain 0 distance --components 0,1 --distance 10
cli-anything-freecad --json -p p.json assembly solve 0
cli-anything-freecad --json -p p.json assembly dof 0
cli-anything-freecad --json -p p.json assembly bom 0
cli-anything-freecad --json -p p.json assembly explode 0 --factor 2.0
# Constraints: fixed, coincident, distance, angle, parallel, perpendicular,
#   tangent, revolute, prismatic, cylindrical, ball, planar, gear, belt

mesh (16) — Mesh operations

cli-anything-freecad --json -p p.json mesh from-shape 0 --deviation 0.1
cli-anything-freecad --json -p p.json mesh import path/to/model.stl
cli-anything-freecad --json -p p.json mesh export 0 output.stl --format stl
cli-anything-freecad --json -p p.json mesh boolean union 0 1
cli-anything-freecad --json -p p.json mesh decimate 0 --target-faces 1000
cli-anything-freecad --json -p p.json mesh smooth 0 --iterations 5
cli-anything-freecad --json -p p.json mesh repair 0
cli-anything-freecad --json -p p.json mesh to-shape 0

techdraw (15) — Technical drawings

cli-anything-freecad --json -p p.json techdraw new-page
cli-anything-freecad --json -p p.json techdraw add-view 0 0 --direction 0,0,1 --scale 1.0
cli-anything-freecad --json -p p.json techdraw add-projection-group 0 0
cli-anything-freecad --json -p p.json techdraw add-section-view 0 0
cli-anything-freecad --json -p p.json techdraw add-dimension 0 0 length --references 0,1
cli-anything-freecad --json -p p.json techdraw add-annotation 0 "Note text"
cli-anything-freecad --json -p p.json techdraw export-pdf 0 drawing.pdf
cli-anything-freecad --json -p p.json techdraw export-svg 0 drawing.svg

draft (33) — 2D drafting

cli-anything-freecad --json -p p.json draft wire --points "0,0,0;10,0,0;10,10,0"
cli-anything-freecad --json -p p.json draft rectangle --width 20 --height 15
cli-anything-freecad --json -p p.json draft circle --radius 10
cli-anything-freecad --json -p p.json draft polygon --sides 6 --radius 10
cli-anything-freecad --json -p p.json draft text --content "Hello" --position 0,0,0
cli-anything-freecad --json -p p.json draft move 0 --vector 10,5,0
cli-anything-freecad --json -p p.json draft array-linear 0 --direction 1,0,0 --count 5 --spacing 10
cli-anything-freecad --json -p p.json draft array-polar 0 --center 0,0,0 --count 6
cli-anything-freecad --json -p p.json draft extrude 0 --direction 0,0,1 --length 10
cli-anything-freecad --json -p p.json draft to-sketch 0

measure (12) — Measurement and analysis

cli-anything-freecad --json -p p.json measure volume 0
cli-anything-freecad --json -p p.json measure area 0
cli-anything-freecad --json -p p.json measure distance 0 1
cli-anything-freecad --json -p p.json measure bounding-box 0
cli-anything-freecad --json -p p.json measure center-of-mass 0
cli-anything-freecad --json -p p.json measure check-geometry 0

surface (6) — Surface operations

cli-anything-freecad --json -p p.json surface filling --edges 0,1,2
cli-anything-freecad --json -p p.json surface sections --sections 0,1,2
cli-anything-freecad --json -p p.json surface extend 0 --length 10
cli-anything-freecad --json -p p.json surface sew --indices 0,1

fem (12) — Finite Element Analysis

cli-anything-freecad --json -p p.json fem new-analysis
cli-anything-freecad --json -p p.json fem add-fixed 0 --references face1,face2
cli-anything-freecad --json -p p.json fem add-force 0 --references face3 --magnitude 1000
cli-anything-freecad --json -p p.json fem set-material 0 0
cli-anything-freecad --json -p p.json fem mesh-generate 0 --max-size 5
cli-anything-freecad --json -p p.json fem solve 0
cli-anything-freecad --json -p p.json fem results 0

cam (10) — CNC machining

cli-anything-freecad --json -p p.json cam new-job 0
cli-anything-freecad --json -p p.json cam set-stock 0 --stock-type box
cli-anything-freecad --json -p p.json cam set-tool 0 --diameter 6 --type endmill
cli-anything-freecad --json -p p.json cam add-profile 0
cli-anything-freecad --json -p p.json cam add-pocket 0 --depth 5
cli-anything-freecad --json -p p.json cam generate-gcode 0
cli-anything-freecad --json -p p.json cam export-gcode 0 output.nc

spreadsheet (7) — Parametric data tables

cli-anything-freecad --json -p p.json spreadsheet new
cli-anything-freecad --json -p p.json spreadsheet set-cell 0 A1 "50"
cli-anything-freecad --json -p p.json spreadsheet set-cell 0 B1 "=A1*2"
cli-anything-freecad --json -p p.json spreadsheet set-alias 0 A1 plate_width
cli-anything-freecad --json -p p.json spreadsheet export-csv 0 data.csv

import (13) — Import CAD/mesh files

cli-anything-freecad --json -p p.json import auto model.step
cli-anything-freecad --json -p p.json import step model.step
cli-anything-freecad --json -p p.json import stl model.stl
cli-anything-freecad --json -p p.json import dxf drawing.dxf
cli-anything-freecad --json -p p.json import info model.step
# Formats: step, iges, stl, obj, dxf, svg, brep, 3mf, ply, off, gltf

export (3) — Export to 17 formats

# Presets: step, iges, stl, stl_fine, obj, brep, fcstd, dxf, svg, gltf, 3mf, ply, off, amf, pdf, png, jpg
cli-anything-freecad --json -p p.json export render output.step --preset step
cli-anything-freecad --json -p p.json export render model.stl --preset stl --overwrite
cli-anything-freecad --json -p p.json export presets

session (4) — Undo/redo

cli-anything-freecad --json -p p.json session undo
cli-anything-freecad --json -p p.json session redo
cli-anything-freecad --json -p p.json session status
cli-anything-freecad --json -p p.json session history

JSON Output

All commands support --json. Responses include structured data. Errors: {"error": "message"}.

Error Handling

  • Missing FreeCAD: Clear install instructions
  • Invalid types: Lists valid options
  • Index out of range: Reports valid range
  • File exists: Use --overwrite

Agent Preview Notes

  • Use preview capture --json whenever geometric changes need visual verification.
  • Use preview live start for iterative build loops; prefer poll mode when the project file is being saved repeatedly.
  • Use preview live status --json as the cheap status probe before reading the full trajectory.json.
  • Treat _bundle_dir as a single snapshot only; the stable live identity is _session_dir plus _trajectory_path.
  • Use cli-hub previews ... only to inspect/open already-published previews.

Frequently asked questions about CLI for FreeCAD

Similar skills