Macros recipes
![]() |
This page contains macros that add functionality to a FreeCAD installation.
If you wrote a macro, and want to include it in the categories in this page, see macro documentation to learn about properly documenting the macro.
Categories
3D View operations
Macro Align Face Object to View: This macro align the face of the selected object to the current View (in case face hole the hole is placed to the view).
Macro Align View to Face: This macro aligns the current view to a selected face.
Macro Copy3DViewToClipboard: Copy contents of 3DView resized 640, 480 px to clipboard.
Macro FCCamera: This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen to create a form in the specified plan positions the selected face facing the screen, to detect the position of the camera.
Macro Mouse Cross: This small macro turns the arrow of the mouse in a precision cross.
Macro Rotate View: This macro rotates the current view by 90° to the left. Only works if you are in
XY (top) view.
Macro Rotate View Free: This macro is used in the Python console and rotates the current view in the angle and plane given.
Macro Rotate ViewAxonometric: This macro rotates the current view in ViewAxonometric.
Macro Screen Wiki: Special macro for the Wiki Worker. This macro allows to save the 3D view in the desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions.
Macro Snip: Easily post screenshots to the FreeCAD forum.
Macro View Rotation: Provides a GUI to permit rotation of view by precise amounts in all three directions.
Macro Zoom 1:1: 1:1 Zoom so objects appear their actual size on the screen.
Animation
Macro Animated Constrain: Animate angle constrain in sketcher.
Macro Animator: Animate your model by animating its properties with this feature python object.
Macro Assemblage Imprimante 3D: Simulation of movements of a 3D printer.
Macro Assembly: Assembly animate.
Macro Constraint Draft: Simple example animation Draft wires by use the Expressions for associate many wires and simulate or verify the movement. Here the circle rotation create the movement for all objects connected (This macro run with FreeCAD version 0.16).
Macro crank simul: Rotation rod and piston.
Macro hinge: Open and close hinge.
Macro Spring: Simulation of one spring.
Code and scripting
Macro Build Utility: This macro provides a utility to assemble a project from sub-project files using the Merge Project facility.
Macro clone explicit: creates a copy of each selected object and sets its properties to an expression linking to the original object, making it an explicit and editable clone.
Macro Editor Assistant: extends the capabilities of FreeCAD's integrated Python editor.
Macro Global Variable Watcher: This macro facilitates the user selecting global variables and monitoring their values.
Macro MessageBox: shows how to give information to the user through the GUI.
Macro Print SceneGraph: prints the SceneGraph.
Macro Python Assistant Window: This macro provides a cut/copy/paste workspace for Python code, it is segmented so different sections can be selected and it is persistent between FreeCAD sessions.
Macro ZTest Over 128: This macro is only used by programmers Test characters ASCII over 127.
Qt Example: example of using Qt commands, their connections, extraction and data assignment.
scanObjects: inspection tool for FreeCAD macro development and project debug.
Conversion
Macro 3DXML import: Imports a 3DXML-ascii file into FreeCAD, limited functionality.
Macro Compound Plus: Draft command set in a small macro for the 2D sketch example: work with the DXF files.
Macro Creating faces from a DXF file: This macro create face from a DXF file, the "Layer" are recognized separate and trained in groups.
Macro DeepCopy: Make a compound out of a part with a copy of all its shapes.
Macro DXF to Face and Sketch: This macro converts selected elements of imported dxf to face and sketch.
Macro Dxf To Shape: Macro utility for create unique wire with many wires, the type wire created is selected to MakeWire, Bspline, BsplineCurve, BsplineCurve + Arc, Polygon, Bezier curve
Macro Extract Wires from Mesh: Extracts boundary wires from selected meshes
Macro FaceToSketch: Converts the selected Face to a single Sketch without constraints.
Macro FCBmpImport: Import Black and White BMP images into FreeCAD as sketch, wire, or solid or Grayscale BMP for lithophanes.
Macro FCWire To Volume: This macro create boolean operation with the objects selected just select the wires give the thickness and click "Create"
Macro Iges PyImporter: Imports an iges file with entity 128, for example an iges-file from FreeShip, into FreeCAD.
Macro MeshToPart: converts selected meshes to parts
Macro MultiCopy: MultiCopy allows the duplication (copy and paste) of multiple FreeCAD objects that can be labelled sequentially and in a custom manner.
Macro PartToVRML: Converts selected parts to VRML meshes for small size and faster loading (VRML models Kicad and Blender compatible)
Draft Workbench and 2D
Macro Align Camera to Working Plane: This macro aligns the camera to the current Draft Working Plane.
Macro Align Working Plane to Camera: This macro moves the current Draft Working Plane to the center of the current view.
Macro Draft Circle 3 Points: creates a circle from 3 selected points 2D orthogonal
Macro Draft Circle 3 Points 3D: creates a circle from 3 selected points in the space 3D
Macro EdgesToArc: Converts the selected Edges to a circular Arc if possible. Useful for restoring discretized arcs.
Macro Ellipse-Center+2Points Makes an ellipse by selecting three points (in this order): centre, major radius and minor radius
Macro FC Convert Lines: this macro convert the object line, wire in line Dash, DashDot, DashDotDot,ZigZag and Hand with the dimensions given.
Macro Make Arc 3 Points: creates a arc from 3 selected points
Macro Make Circle 3 Points: creates a circle on 3 selected points, the points can be objects (this example brings together the two examples below, all parameters simply settle on a graphic window).
Macro Rectellipse: creates a parametric rectellipse
Drawing Workbench
The Drawing Workbench is obsolete since FreeCAD 0.17. Consider using the TechDraw Workbench instead.
Macro Automatic drawing: allows the user to get the view of his object in a drawing with 4 different position (front,top,iso,right). Needs some modification to be perfectly effective
Macro CartoucheFC: This GUI macro to fill simply all fields of the cartridge of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.
Macro CartoucheFC 2: This GUI macro to fill simply all fields of the cartridge model 2 of the plan implementation worksheet FreeCAD.
Macro CartoucheFC Full: This GUI macro to fill simply all fields of the cartridge templates_Full of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.
Macro Normal Vector: Get the normal vector of a preselected face for creating a drawing view normal to that face
Fem Workbench
Macro export transient FEM results: This macro exports multiple FEM result objects from a transient analysis to the VTK format and generates a PVU file which can be used to load the results directly into ParaView for post-processing.
Macro GMSH: Create FEM Meshes by GMSH Mesh Generator
Gui
Macro GuiResetToolbars: This macro resets the position of the toolbars.
Macro MacroMenu: Add the macros found in the macros folder to the Macros menu of FreeCAD.
Macro SplitPropEditor: temporarily split the property editor from the combo view to a separated dock widget.
Macro Toggle Panels Visibility: This macro toggles the visibility of various supporting panels in FreeCAD, allowing the main window to be viewed with all available screen space.
Info and measurements
Macro BoundingBox Tracing: This macro red trace (editable) around the BoundingBox with 6 rectangles.
Macro CenterFace: This macro red trace (editable) the center face (mass) with 1 point and print the coordinates.
Macro CenterOfMass: Gives the total mass and the center of mass of multiple objects selected with the density chosen.
Macro cross section: displays an interactively slidable cross-section.
Macro Delta xyz: Gives the Delta values and the distance between 2 points
Macro Dump Objects: This macro generates a listing of all objects in the current document - the list can be in a window or on the Report view.
Macro FC element selector: this macro display all elements below cursor same "Macro Mouse over cb" with GUI (elements covered by other elements will also be displayed).
Macro FCInfo: Gives a series of information about the selected shape and can display a conversion of length, inclination (degrees, radian, grade) shape, surface, volume and the weight of the form in the density selected in various international and Anglo-Saxon units
Macro FCInfo Alternate Linux: same as above, but for Linux (obsolete)
Macro FCInfo ToolBar: Gives a series of information about the selected shape as FCInfo in a mini ToolBar
Macro FCInfoGlass: Gives a series of information about the selected shape and displayed in screen 3D
Macro FCInfoToMouse: Provide informations coordinates, length and angles in real time on the mouse in a bubble annotation displayed in the 3D screen
Macro FCTreeView: Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label .... without case sensitive or with case sensitive and select all objects displayed in the macro window.
Macro HighlightCommon: Highlight common parts.
Macro HighlightDifference: Compute the difference between two shapes.
Macro MeasureCircle: Compute the radius of a circle by 3 points or a circular edge.
Macro Mouse over cb: this macro display all elements below cursor (elements covered by other elements will also be displayed).
Macro ObjectInfo: User-friendly "Info" module created by a FreeCAD user
Macro SimpleProperties: Display in a concise way basic physical properties of an object (volume, bound box dimensions, ...).
Libraries
Macro BOLTS: The aim of BOLTS is to build a free and open-source standard parts library for CAD applications.
Macro PartsLibrary: Starts the Parts library browser
Macro screw maker1_2: This macro creates a screw with or without thread, according to ISO standards (screw_maker1_6.py.zip with Pyside support). (Screw Maker 2.0 - new version!)
Mathematical functions
Macro 3D Parametric Curve: Draw a function described by parametric equations x(t), y(t) and z(t).
Macro Draw 2D Function: draws a function described by an equation z=F(x)
Macro Draw Parametric 2D Function: Based on the above macro, but for parametric and optionally polar
Macro Parametric Curve FP: Feature python update of Macro 3D Parametric Curve.
Object creation
Macro AeroFoil: AeroFoil creates airfoil curves and faces using pre-defined models, algebraic functions, and DAT or CSV Files.
Macro Airfoil Import & Scale: Imports and scales a .dat airfoil to desired chord length.
Macro Apothem Based Prism GUI: A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.
Macro Circle: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same above without GUI).
Macro CirclePlus: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same below but with GUI) plus create sector and face.
Macro Cut Circle: Cut a circle or arc and create x arcs, giving the number of cut.
Macro Cut Line: Cut a line and create x points, giving the number of points, create line or not, create points or not, create bicolor or not on choice.
Macro FCCamGroover: Creates grooved cylinder for cam.
Macro FCCircularText: This macro create a text around a cylinder
Macro FCHoneycombMaker: Creates parametric honeycomb grid.
Macro FCSpring Helix Variable: This macro create one spring truncate, the troncature is adjustable on the all coil to choice.
Macro FCSpring On Surface: This macro create one spring (helix) on the surface of the object (solide).
Macro Loft: Create a loft with a list of wire (specially created for Macro Texture).
Macro Geodesic Dome: This macro creates a geodesic dome shell
Macro Guitar fretboard: Guitar Fretboard Maker
Macro Guitar Nut: Guitar Nut Maker
Macro HilbertCurve: Creates an Hilbert curve wire in 2 or 3 dimensions with many iterations.
Macro Honeycomb: Creates a feature python Honeycomb object compatible in and out of PartDesign.
Macro ImportAirfoil: Airfoil coordinates import, then scale the airfoil, rotate, translate in the plane, translate along the span, select the plane and the main axis, and turn the geometry into a sketch.
Macro Intersection: Finds the intersection between 2 or 3 selected edges/faces, works with Datum Planes and Datum Lines also. Creates a parametric feature python object containing the shape of the intersection.
Macro Line Length: Create a line giving coordinate XYZ length and angle to plane X Y
Macro Make Cube: creates a rectangular cuboid from 4 points
Macro Polyhedrons: This macro creates parametric polyhedrons (dodecahedron, icosahedron, tetrahedron, ...). Customizable via radius or side.
Macro Pyramid: This macro creates a parametric pyramid. All parameters are customizable just like with Part Cone.
Macro Repro Wire: This macro reproduce all element selected subobject wire or face.
Macro Site From Contours: creates an Arch Site from a series of contour lines
Macro Solid Sweep: creates a solid by sweeping a 2D profile along a trajectory previously selected in the 3D view. The 2D elements can be created through the regular tools in FreeCAD's GUI.
Macro Triangle AH: This macro create one triangle creates a triangle by giving the head angle and the height of the triangle (the triangle of the head is positioned to the xyz coordinates 0.0).
Macro WireXYZ: This macro creates a Wire with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.
Object transformation
Macro Align Object to View: This macro align the selected object to the current View and set the coordinates Placement of the camera.
Macro ArrayCopy: copies the selected object several times, on an array grid.
Macro Bevel: bevels selected vertices, creates parametric feature python object, compatible with all solids (except with round edges) including features in Part Design bodies.
Macro Center Align Objects with Faces or Edges: This macro covers the following constraints: - Concentric constraint among non cylindrical parts; - Constraint on center Faces and/or Edges. It works also with the new Body and App::Part containers, as well as with STEP hierarchy.
Macro CloneConvert: Creates a clone of the object and the converted in the chosen position and size (inch, mm, m, µm...). The base object is recognized in mm (FreeCAd base).
Macro Connect And Sweep: This macro easily creates a connection between two objects, an object and a point or between two points or the selected line, wire, edge (the center of the objects are the starting and ending points of the sweep) can be selected form a configurable ellipse polygon circle.
Macro FlattenWire: flattens draft wires that are not planar to their median Z coordinate.
Macro FlattenWire3Points: flattens draft wires that are not planar to a plane defined by 3 points.
Macro HealArcs: Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf.
Macro Image Scaling: Macro for easy scaling drawings, graphics, diagram, blueprint and similar 2D images in Image workbench.
Macro JointWire: allows to find and joint all non connected edge to the closest non connected one using a line.
Macro MatrixTransform: apply linear space transformations to distort shapes. E.g., non-uniform scaling, shearing, mirroring, axes swapping.
Macro Move to Origin: This macro translates the Placement of an object so that a selected location becomes its new origin.
Macro Overlap: (parametric): Boolean operation. Similar to Part Common, but with custom overlap count threshold.
Macro Parametric Defeaturing: Macro that provides parametric defeaturing inside and outside the PartDesign Workbench.
Macro Perpendicular To Wire: This macro positions an object perpendicularl to a selected wire.
Macro PlacementAbsolufy: reset Part containers to global origin while maintaining objects absolute position.
Macro Remove parametric history: removes all parametric associativity from an object, leaving it as a "dumb" shape.
Macro Rotate To Point: Macro to rotate an object around the center of its boundbox, its center of mass, or the last clicked point.
Macro Section: (parametric): alternative implementation of Part Section tool, more suitable for making sweep paths.
Macro StraightenObject: re-align object(s) with FreeCAD coordinate system according reference face/edge.
Macro SuperWire: Forces the creation of a Wire from lines and arcs that don't necessarily touch each other. Use this if normal wire operation fails.
Macro WireFilter: Filter wires from a sketch to only use certain ones, also 2D offsets, scales, rearranges wire order.
Object visibility, view properties and textures
colorManager: Allows to set face colors for all objects from a spreadsheet. Also you can browse colors for a manually selected face or object and see the effect in the 3D model in real-time.
Macro Colorize: Easily set colors of faces, edges, and vertices, including individual transparency levels.
Macro Hidden Alls objects: This macro check hidden all object in the document (Visibility=False).
Macro Texture: Create a project from a bmp image to create a texture easily.
Macro Texture Objects: This macro allows you to temporarily put a texture image on the selected objects.
Macro Toggle Drawstyle: This macro toggles the Drawstyle of the selected object.
Macro Toggle Drawstyle Optimized: This macro toggles the Drawstyle of the selected object (same as Macro Toggle Drawstyle above but optimized for all languages).
Macro Toggle Visibility: Set of three macro, macro 1: hidden the objects not selected, macro 2: displayed alls objects, macro 3: hidden alls objects.
Macro Toggle Visibility2 1-2: Set of two macro, macro 1:Macro_Toggle_Visibility2_1-2 hidden the objects not selected, macro 2:Macro_Toggle_Visibility2_2-2 displayed alls objects, macro with the original visibility.
Macro Toggle Visibility2 2-2: Set of two macro, macro 1:Macro_Toggle_Visibility2_1-2 hidden the objects not selected, macro 2:Macro_Toggle_Visibility2_2-2 displayed alls objects, macro with the original visibility.
Macro Visible Alls objects: This macro check visible all object in the document (Visibility=True).
Macro Visibility Manager: manage visibility of document objects by type or individually.
setTextures: Allows to permanently store the URL of textures in a FreeCAD project and load stored textures.
PartDesign Workbench
Macro PDWrapper: Encapsulates non-PartDesign solids for use in PartDesign Bodies, and more.
Printer 3D
Macro 3d Printer Slicer: Exports current design to slicer software or CAM software.
Macro 3d Printer Slicer Individual Parts: This code, when run, will export the visible bodies at the top level (bodies deeper in the tree will be ignored) of the currently open design to individual STL files, and open them it in the slicing software that you use. This macro will look for Cura as the default but you can change it to any other slider by changing the SLICERAPP variable in the source code.
Raytracing
Macro FreeCAD to Kerkythea: Export from FreeCAD to Kerkythea
Spreadsheet Workbench
Macro Alias Manager: helps managing aliases inside FreeCAD Spreadsheet workbench. It is able to create, delete, move aliases and create a 'part family' group of files.
Macro EasyAlias: Quickly create aliases in FreeCAD Spreadsheet workbench. It uses the labels from one column to create aliases for adjacent cells in the next column to the right, e.g. labels from Column A become aliases for the cells in Column B.
Macro FCSpreadSheet Extract: This macro save the data in a csv file with the formula or in a xml file.
Macro Spreadsheet Tools: This macro helps managing cells inside FreeCAD Spreadsheet workbench.
Macro Spreadsheet2html: Exports a spreadsheet as styled html. Intended as support in transfering data to office suits.
sheet2export: allows to export FreeCAD spreadsheet to file formats (.md, .html, .csv, .json).
Utility
Macro Arch Axis System Repartition: This macro help you to create an Arch Axis System along a line with a
Macro Duplicate Selection: This macro testing if one selection are duplicate, select the object IN THE 3D VIEW the "ForbiddenCursor" stay if the or one selection is duplicate, the macro stay resident.
Macro Easy cutouts for Enclosure Design: This macro makes Cutouts for Enclosures in a very handy way
Macro ExpandTreeItem: this macro expand selected items in the tree view. If not selection all item are expand/collapse.
Macro findConfigFiles: finds user config files system.cfg and user.cfg, copies folder location to system clipboard, instructs user on renaming these files in order to reset FreeCAD settings, and opens folder with default file browser.
Macro ForceRecompute: Forces manual recompute of model
Macro If Selected Stay If Not Then Delete: All object not selected are deleted!
Macro ImperialScales: Shows a list of US Imperial Arch scales list with the corresponding factor to apply to TechDraw pages or views.
Macro merge duplicate materials: Merges materials that have the same base name (with different numeral endings like 001, 002,...) into one.
Macro Pinger: Ping users on the forum with ease.
Macro Recompute Profiler: measures time it takes to recompute each object in a project
Macro Replace Part in Assembly: Replaces a part (simple copy) in an "Assembly" with another Part (simple copy).
Macro Select Hovering: this macro select a choice Face, Edge, Vertex hovering by the mouse.
Macro SelectVisible: All visible objects in the tree will be selected.
Macro Shake Sketch: Shake a sketch in order to discover its unconstrained parts.
Macro SketchUnmap: unmap a sketch from its current support and makes its placement absolute, eventually creating a locating datum plane.
Macro TreeToAscii: Prints model tree as "ASCII art" with custom pattern & style, and export to clipboard, file or embedded document.
Macro Unbind Numpad Shortcuts: rebinds standard view commands from digit keys to Ctrl+digit, so that they don't spin the view by accident when entering numbers.
Macro WorkFeatures: Tool utility to create points, axes, planes and many other useful features to facilitate the creation of your project.
Wizards
Macro Corner shapes wizard/update: pops up a dialog asking for the dimensions of your corner piece, then creates the object in the document and creates a page view with top, front and lateral views of the piece
Macro FCGear: Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.
Macro Fonts Win10 PYMP: This little macro is dedicate to users of Windows 10. The explorer fonts for use the ShapeString is empty and this little macro can help you see aesily the font to use.
Macro GenerateDrawing: Macro for automatic drawing generation with 3 normal projections and one isometric.
Macro GenerateViews: Macro for automatic 2D views generation with 6 normal projections and one isometric.
Macro Geneva Wheel: Allows the user to create a Geneva wheel mechanism from scratch. Must edit values within the Macro to alter the size of the object.
Macro Geneva Wheel GUI: A GUI front end that allows the user to create a Geneva wheel mechanism from scratch.
Macro Half turn stairs: Creates a half turn (left/right) stair from a Data-file.
Macro Half-Hull Model: This macro generates both three dimensional half-hull and full-hull models from a series of 2D line drawings.
Macro Megaminx: Display a Megaminx and interactively do slice rotations.
Macro PropertyMemo: This little macro create one Property additional (memo or other text) for you object (only Draft)
Macro Rubik Cube: Display a Rubik Cube and interactively do slice rotations.
Macro Sheet Metal Unfolder: Creates an unfolded part from a sheet-metal-part.
Macro Stairs: Create stair helix, create your stair nosing select and run the macro.
Macro Unfold Box: allows to unfold the surfaces of a box of any shape and to draw them on a page.
Macro Unroll Ruled Surface: allows to unroll ruled surfaces and to draw them on a page.
Woodworking
getDimensions: FreeCAD macro to get chipboards dimensions to cut (BOM, cutlist).
Macro Cabinets32: Creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.
Macro Joint: Creates a variety of joints, such as mortise/tenon, box joints, dovetail joints, and snap joints.
makeTransparent: Switches all parts from non-transparent to transparent, and back, allowing you to preview pilot holes, countersinks and other joints.
Other interesting macros created by FreeCAD users
By hamish2014: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, and more.
By microelly2 : freeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, and more.
By oddtopus: flamingo (workbench for metal structures).
By realthunder: Assembly3 workbench, and more.
By rockn: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, and more.
By Siardeni: workbench for create metal profiles, square tubing, z profile, palette, rotation, drawing, and more.
By triplus: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, and more.
Usage
See how to install macros for a full description, and customize toolbars to add the macros to a toolbar for easy access.
Installing many macros is equivalent to installing a new workbench; see how to install additional workbenches for this information.
Automatic installation
Use the Addon Manager in Tools → Addon manager to install a macro that has been included in the FreeCAD-macros repository. introduced in version 0.17
Manual installation
If the Addon Manager is not used, the macro can be installed manually.
- Copy the Python code from the corresponding macro page.
- Open the macros menu Macro → Macros, press Create, and give it a name.
- Paste the Python code that you copied.
- Press the Save button, and restart FreeCAD.
- To use it, open again the macros menu, select your new macro, and press Execute.
Add a macro to a custom toolbar
- Go to Tools → Customize.
- In the Macros tab, add a new macro name, and optionally define an icon and a keyboard shortcut.
- In the Toolbars tab, create a new toolbar, and add your macro, taking it from the Macros category.