Scripting

This page is the starting point for scripting in FreeCAD. As FreeCAD use Python as its scripting language we encourage you to first learn the basics of Python programming before continuing with this documentation.

In the FreeCAD Help Menu, you will also find a "Python help" entry, which will open a complete description of the python modules, classes and functions available to you in FreeCAD.

Basics

 * Official python tutorial
 * Non-programmer tutorial for python - an excellent wikibook
 * Python for newbies - one big tutorial covering all the basics
 * FreeCAD Scripting Basics

Modules
As the functionality of FreeCAD is separated in Module which deal with special data types and applications, here is the starting points for the special scripting:

Meshes
The Mesh Module handles all kind of meshes. Scripting is described in the Mesh Scripting Article.

Part
The Part Module deals with the CAD data structures. The Topological data scripting page shows how to script it.

Drawing/Reporting
The Drawing Module is in place for bringing the 3D world onto paper or drawings.

Cam
The Cam Module is dedicated to mechanical machining like milling.

Raytracing
The Raytracing Module brings all kind of shapes to renderers (like PovRay).

Draft
The Draft Module adds basic 2d drawing functions to freecad. This module is not scriptable, but is written entirely in python, so it can be a good example if you want to write your own modules.

Misc
code snippets : A collection of pieces of FreeCAD python code, to serve as ingredients in your scripts...

Extra python modules : Extend the FreeCAD python interpreter with these powerful modules!

FreeCAD vector math library : A couple of handy functions to manipulate FreeCAD vectors.

Examples & Exercises
line drawing function : An example showing how to construct a simple line drawing function