Builtin modules

This page presents more in-depth information over the built-in FreeCAD modules, and what are the functions and properties availible to you. This page is not a complete list of all the contents of these modules, and, because of the fast evolution of FreeCAD, the information presented here might be slightly outdated, but it should give you a good overview of the possibilities. For complete list of the modules content, use the dir(module) function in the interpreter.

The FreeCAD module
This is the principal (root) module of FreeCAD. It can also be called by "App" from the FreeCAD interpreter. It contains everything that is needed to manipulate documents and their contents (objects).

Example: import FreeCAD print FreeCAD.listDocuments mydoc = FreeCAD.activeDocument

Base
The Base module is contained inside the FreeCAD module and contains constructors for different types of objects heavily used in FreeCAD.

Vectors
Vectors are used everywhere in FreeCAD.

Example: v=FreeCAD.Vector v=FreeCAD.Vector(1,0,0) v=FreeCAD.Base.Vector v2 = FreeCAD.Vector(3,2,-5) v3 = v.add(v2) print v3.Length

Matrixes
4x4 Matrixes are used everywhere throughout FreeCAD and can be created by one of the following manners:

m=FreeCAD.Matrix m=FreeCAD.Base.Matrix print m.A21

Console module
This module is contained inside the FreeCAD module and contains methods to send text to FreeCAD's output console and status bar. The messages will have different color if they are message, warning or error. Example:

import FreeCAD FreeCAD.PrintMessage("Hello World!\n")

The FreeCADGui Module
This module is the counterpart of the FreeCAD module. It contains everything related to the User interface and the 3D views. Example:

import FreeCADGui doc = FreeCADGui.activeDocument

Selection module
The selection submodule is part of the FreeCADGui module. Example:

import FreeCADGui sel = FreeCADGui.Selection.getSelection

Placement
A placement in FreeCAD is an object defining a position and a rotation. A placement can then be added to a FreeCAD Object, to orient/position it in the document. Example:

myObj = FreeCAD.ActiveDocument.ActiveObject pl = FreeCAD.Placement pl.move(FreeCAD.Vector(2,0,0)) myObj.Placement = pl

Document Objects
Being parametric, document objects in FreeCAD can have a lot of additional properties, but these are the basic ones, present in every FreeCAD Document Object. Objects can be retrieved simply by their name. Example:

myObj = FreeCAD.ActiveDocument.myObjectName print myObj.PropertiesList

View Objects
When the GUI is up, each object in the FreeCAD document has an associated ViewObject, that resides in the FreeCADGui document counterpart. A view object can be retrieved by two ways:

myViewObj = FreeCAD.ActiveDocument.myObjectName.ViewObject myViewObj = FreeCADGui.ActiveDocument.myObjectName


 * ViewObject.Annotation - the annotation node of a ViewObject
 * ViewObject.BoundingBox - the bounding box
 * ViewObject.Content - returns an XML representation of a ViewObject's properties
 * ViewObject.DisplayMode - returns the current display mode
 * ViewObject.IV - returns an Inventor representation of the ViewObject
 * ViewObject.Object - returns the associated FreeCAD Document Object of this ViewObject
 * ViewObject.PropertiesList - returns a list of properties of this ViewObject
 * ViewObject.RootNode - returns the Inventor node of this ViewObject
 * ViewObject.Selectable - returns True if the object is selectable
 * ViewObject.Type - returns the type of this ViewObject
 * ViewObject.Visibility - returns True if the viewObject is visible
 * ViewObject.getAllDerivedFrom - Returns all descentences
 * ViewObject.getDocumentationOfProperty - Return the documentation string of the property of this class.
 * ViewObject.getGroupOfProperty - Return the name of the group which the property belongs to in this class. The properties sorted in differnt named groups for convenience.
 * ViewObject.getPropertyByName - Return the value of a named property.
 * ViewObject.getTypeOfProperty - Return the type of a named property. This can be (Hidden,ReadOnly,Output) or any combination.
 * ViewObject.hide - Hides the object
 * ViewObject.isDerivedFrom - Returns true if given type is a father
 * ViewObject.isVisible - Check if the object is visible
 * ViewObject.listDisplayModes - Show a list of all display modes
 * ViewObject.setTransformation - Set a transformation on the Inventor node
 * ViewObject.show - Show the object
 * ViewObject.toString - Return a string representation of the Inventor node
 * ViewObject.update - Update the view representation of the object