Macros recipes/hr

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.

[[File:Part_CheckGeometry.svg]] 3D View operations

 * : This macro rotates the current view by 90° to the left. Only works if you are in Top view.
 * : Provides a GUI to permit rotation of view by precise amounts in all three directions.
 * : This macro allows you to temporarily put a texture image on the selected objects.
 * : This small macro turns the arrow of the mouse in a precision cross.
 * : This macro aligns the current view to a selected face.
 * : This macro align the selected object to the current View and set the coordinates Placement of the camera.
 * : This macro aligns the camera to the current Draft Working Plane
 * : This macro moves the current Draft Working Plane to the center of the current 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).
 * : This macro toggles the visibility of various supporting panels in FreeCAD, allowing the main window to be viewed with all available screen space.
 * : 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.
 * : Set of three macro, macro 1: hidden the objects not selected, macro 2: displayed alls objects, macro 3: hidden alls objects.
 * : Set of two macro, macro 1: hidden the objects not selected, macro 2: displayed alls objects, macro with the original visibility.
 * : All visible objects in the tree will be selected.
 * : This pair of macros allow you to alter the Navigation Style while in the Sketcher.
 * : 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.
 * : Copy contents of 3DView resized 640, 480 px to clipboard.
 * : This macro positioned your object perpendicularly to wire selected.
 * : Macro for rotate on object on itself with the axis of rotation the boundbox center, center of mass or last point clicked
 * : 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.
 * : this macro select a choice Face, Edge, Vertex hovering by the mouse.
 * : this macro expand selected items in the tree view.. If not selection all item are expand/collapse
 * : this macro display all elements below cursor (elements covered by other elements will also be displayed)
 * : this macro display all elements below cursor same "Macro Mouse over cb" with GUI (elements covered by other elements will also be displayed)

[[File:Draft_FlipDimension.svg]] Animation

 * : Rotation rod and piston
 * : Simulation of one spring
 * : Open and close hinge
 * : Assembly animate
 * : Animate angle constrain in sketcher
 * : Simulation of movements of a 3D printer
 * : 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 16)
 * : Display a Rubik Cube and interactively do slice rotations.
 * : Display a Megaminx and interactively do slice rotations.

[[File:Applications-python.svg]] Code and Scripting

 * : shows how to give information to the user through the GUI.
 * : example of using Qt commands, their connections, extraction and data assignment.
 * : 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.
 * : This macro provides a utility to assemble a project from sub-project files using the Merge Project facility.
 * : This macro facilitates the user selecting global variables and monitoring their values.
 * : 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.


 * : This macro is only used by programmers Test characters ASCII over 127.

[[File:Arch_MeshToShape.svg]] Conversion

 * : Extracts boundary wires from selected meshes
 * : converts selected meshes to parts
 * : Converts selected parts to VRML meshes for small size and faster loading (VRML models Kicad and Blender compatible)
 * : Converts the selected Face to a single Sketch without constraints.
 * : This macro create boolean operation with the objects selected just select the wires give the thickness and click "Create"
 * : Make a compound out of a part with a copy of all its shapes.

[[File:Drawing-orthoviews.svg]] Drawing Workbench
The Drawing Workbench is considered obsolete since FreeCAD 0.17. Consider using the TechDraw Workbench instead.


 * : 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
 * : 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.
 * : 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.
 * : This GUI macro to fill simply all fields of the cartridge model 2 of the plan implementation worksheet FreeCAD.
 * : Get the normal vector of a preselected face for creating a drawing view normal to that face

[[File:Draft_BSpline.svg]] Dxf 2D Draft

 * : creates a parametric rectellipse
 * : 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).
 * : creates a circle from 3 selected points 2D orthogonal
 * : creates a circle from 3 selected points in the space 3D
 * : creates a arc from 3 selected points
 * Makes an ellipse by selecting three points (in this order): centre, major radius and minor radius
 * : this macro convert the object line, wire in line Dash, DashDot, DashDotDot,ZigZag and Hand with the dimensions given.
 * : Converts the selected Edges to a circular Arc if possible. Useful for restoring discretized arcs.
 * : This macro create face from a DXF file, the "Layer" are recognized separate and trained in groups.
 * : This macro converts selected elements of imported dxf to face and sketch.
 * : Draf command set in a small macro for the 2D sketch example: work with the DXF files.
 * : Macro utility for create unique wire with many wires, the type wire created is selected to MakeWire, Bspline, BsplineCurve, BsplineCurve + Arc, Polygon, Bezier curve

[[File:Fem_ResultDisplacement.svg]] Fem

 * : Create FEM Meshes by GMSH Mesh Generator

[[File:Part_Measure_Clear_All.svg]] Info and measures

 * : 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
 * : same as above, but for Linux
 * : Gives a series of information about the selected shape and displayed in screen 3D
 * : Provide informations coordinates, length and angles in real time on the mouse in a bubble annotation displayed in the 3D screen
 * : Gives the Delta values and the distance between 2 points
 * : User-friendly "Info" module created by a FreeCAD user
 * : This macro generates a listing of all objects in the current document - the list can be in a window or on the Report view.
 * : Compute the radius of a circle by 3 points or a circular edge.
 * : Gives the total mass and the center of mass of multiple objects selected with the density chosen.

[[File:Draft_VisGroup.svg]] Libraries

 * : 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!)
 * : The aim of BOLTS is to build a free and open-source standard parts library for CAD applications.
 * : Starts the Parts library browser

[[File:Bound-expression.svg]] Mathematical functions
equations.
 * : Draw a function described by parametric equations x(t), y(t) and z(t).
 * : draws a function described by an equation z=F(x)
 * : Based on the above macro, but for parametric and optionally polar
 * : Tool utility : Tab > Wire > Curves And Surfaces

[[File:IFC.svg]] Multifunctional

 * : Tool utility to create plans of the axes, planes from 3 points, axes on a form, information on the coordinates of the shape and many other useful features to facilitate the creation of your project. This utility is up next in the combo view.

[[File:Workbench_Image.svg]] Object creation

 * : creates a rectangular cuboid from 4 points
 * : 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.
 * : This macro creates a geodesic dome shell
 * : Create a line giving coordinate XYZ length and angle to plane X Y
 * : 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.
 * : 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.
 * : Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same above without GUI).
 * : Cut a circle or arc and create x arcs, giving the number of cut.
 * : 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)
 * : Create a project from a bmp image to create a texture easily
 * : Create a loft with a list of wire (specially created for Macro Texture see above)
 * : This macro create a text around a cylinder
 * : This macro creates a Wire with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.
 * : This macro reproduce all element selected subobject wire or face.
 * : A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.
 * : This macro create one spring truncate, the troncature is adjustable on the all coil to choice.
 * : Guitar Fretboard Maker
 * : Creates grooved cylinder for cam.
 * : creates an Arch Site from a series of contour lines

[[File:Workbench_PartDesign.svg]] Object transformation

 * : copies the selected object several times, on an array grid
 * : flattens draft wires that are not planar to their median Z coordinate
 * : flattens draft wires that are not planar to a plane defined by 3 points
 * : allows to find and joint all non connected edge to the closest non connected one using a line
 * : removes all parametric associativity from an object, leaving it as a "dumb" shape
 * : Forces the creation of a Wire from lines and arcs that don't necessarily touch each other. Use this if normal wire operation fails
 * : 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
 * : 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 for easy scaling drawings, graphics, diagram, blueprint and similar 2D images in Image workbench.
 * : apply linear space transformations to distort shapes. E.g., non-uniform scaling, shearing, mirroring, axes swapping.
 * : This macro easily creates a connection between two objects, an object and a point or between two points (the center of the objects are the starting and ending points of the sweep) can be selected form a configurable ellipse polygon circle
 * : (parametric): alternative implementation of Part Section tool, more suitable for making sweep paths.
 * : (parametric): Boolean operation. Similar to Part Common, but with custom overlap count threshold.

[[File:View.svg]] Printer 3D

 * : Exports current design to slicer software or CAM software.

[[File:Preferences-raytracing.svg]] Raytracing

 * : Export from FreeCAD to Kerkythea

[[File:Spreadsheet.svg]] Spreadsheet Workbench

 * : helps managing aliases inside FreeCAD Spreadsheet workbench. It is able to create, delete, move aliases and create a 'part family' group of files.
 * : This macro helps managing cells inside FreeCAD Spreadsheet workbench.
 * : 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.
 * : This macro save the data in a csv file with the formula or in a xml file.

[[File:Arch_Survey.svg]] Utility

 * : This macro red trace (editable) the center face (mass) with 1 point and print the coordinates
 * : 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.
 * : This macro makes Cutouts for Enclosures in a very handy way
 * : Add the macros found in the macros folder to the Macros menu of FreeCAD
 * : Forces manual recompute of model
 * : measures time it takes to recompute each object in a project
 * : Shake a sketch in order to discover its unconstrained parts.
 * : Replaces a part (simple copy) in an "Assembly" with another Part (simple copy).
 * : This macro toggles the Drawstyle of the selected object
 * : Highlight common parts.
 * : Compute the difference between two shapes.
 * : displays an interactively slidable cross-section.
 * : prints the SceneGraph.
 * : This macro red trace (editable) around the BoundingBox with 6 rectangles
 * : This macro help you to create an Arch Axis System along a line with a
 * : This macro positioned your object perpendicularly to wire selected.
 * : Merges materials that have the same base name (with different numeral endings like 001, 002,...) into one.
 * : rebinds standard view commands from digit keys to Ctrl+digit, so that they don't spin the view by accident when entering numbers.
 * : 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.

[[File:Bulb.svg]] Wizards

 * : Creates an unfolded part from a sheet-metal-part.
 * : allows to unroll ruled surfaces and to draw them on a page.
 * : allows to unfold the surfaces of a box of any shape and to draw them on a page.
 * : Imports and scales a .dat airfoil to desired chord length.
 * : Allows the user to create a Geneva wheel mechanism from scratch. Must edit values within the Macro to alter the size of the object.
 * : A GUI front end that allows the user to create a Geneva wheel mechanism from scratch.
 * : creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.
 * : Creates a half turn (left/right) stair from a Data-file.
 * : This macro generates both three dimensional half-hull and full-hull models from a series of 2D line drawings.
 * : Create stair helix, create your stair nosing select and run the macro.
 * : Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.
 * : 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
 * : This little macro create one Property additional (memo or other text) for you object (only Draft)
 * : 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.

Std_FreeCADWebsite.png Other interesting macros created by FreeCAD users

 * [[Image:2364.png|24px]] By microelly2 : freeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, and more.
 * [[Image:Text-x-python.png|24px]] By hamish2014: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, and more.
 * [[Image:Text-x-python.png|24px]] By triplus: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, and more.
 * [[Image:681.jpg|24px]] By rockn: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, and more.
 * [[Image:Text-x-python.png|24px]] By oddtopus: flamingo (workbench for metal structures).
 * [[Image:Text-x-python.png|24px]] By dprojects: getDimensions FreeCAD macro to get chipboards dimensions to cut (woodworking).
 * [[Image:Text-x-python.png|24px]] By Siardeni: workbench for create metal profiles, square tubing, z profile, palette, rotation, drawing, and more.
 * [[Image:Text-x-python.png|24px]] By realthunder: Assembly3 workbench, and more.

How to use
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
Starting with FreeCAD 0.17, use the Addon Manager in to install a macro that has been included in the FreeCAD-macros repository.

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, press , and give it a name.
 * Paste the Python code that you copied.
 * Press the button, and restart FreeCAD.
 * To use it, open again the macros menu, select your new macro, and press.

Add a macro to a custom toolbar

 * Go to.
 * In the tab, add a new macro name, and optionally define an icon and a keyboard shortcut.
 * In the tab, create a new toolbar, and add your macro, taking it from the  category.