Macros recipes/sv: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 8: Line 8:
|Files=
|Files=
}}
}}
This page contains macros to add functionality to your freecad installation


This page contains [[macros|macros]] that add functionality to a FreeCAD installation.
== Macros ==

If you wrote a macro, and want to include it in the categories in this page, see '''[[macro documentation|macro documentation]]''' to learn about properly documenting the macro.

== Categories ==
<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">
===[[File:Part_CheckGeometry.svg]] 3D View operations===
===[[File:Part_CheckGeometry.svg]] 3D View operations===
Line 19: Line 22:
</div>
</div>
</div>
</div>

<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">


===[[File:Draft_FlipDimension.svg]] Animation===
===[[File:Draft_FlipDimension.svg]] Animation===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Text-x-python|Macro crank simul|Macro crank simul}}: Rotation rod and piston
* {{MacroLink|Macro crank simul|Macro crank simul}}: Rotation rod and piston
* {{MacroLink|Text-x-python|Macro Spring|Macro Spring}}: Simulation of one spring
* {{MacroLink|Macro Spring|Macro Spring}}: Simulation of one spring
* {{MacroLink|Text-x-python|Macro hinge|Macro hinge}}: Open and close hinge
* {{MacroLink|Macro hinge|Macro hinge}}: Open and close hinge
* {{MacroLink|Text-x-python|Macro Assembly|Macro Assembly}}: Assembly animate
* {{MacroLink|Macro Assembly|Macro Assembly}}: Assembly animate
* {{MacroLink|Text-x-python|Macro Animated Constrain|Macro Animated Constrain}}: Animate angle constrain in sketcher
* {{MacroLink|Macro Animated Constrain|Macro Animated Constrain}}: Animate angle constrain in sketcher
* {{MacroLink|Text-x-python|Macro Assemblage Imprimante 3D|Macro Assemblage Imprimante 3D}}: Simulation of movements of a 3D printer
* {{MacroLink|Macro Assemblage Imprimante 3D|Macro Assemblage Imprimante 3D}}: Simulation of movements of a 3D printer
* {{MacroLink|Text-x-python|Macro Constraint Draft|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 16)
* {{MacroLink|Macro Constraint Draft|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 16)
* {{MacroLink|Text-x-python|Macro Rubik Cube|Macro Rubik Cube}}: Display a Rubik Cube and interactively do slice rotations.
* {{MacroLink|Macro Rubik Cube|Macro Rubik Cube}}: Display a Rubik Cube and interactively do slice rotations.
* {{MacroLink|Macro Megaminx|Macro Megaminx}}: Display a Megaminx and interactively do slice rotations.
</div>
</div>
</div>
</div>
Line 39: Line 42:
===[[File:Applications-python.svg]] Code and Scripting===
===[[File:Applications-python.svg]] Code and Scripting===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Text-x-python|Macro MessageBox|Macro MessageBox}}: shows how to give information to the user through the GUI.
* {{MacroLink|Macro MessageBox|Macro MessageBox}}: shows how to give information to the user through the GUI.
* {{MacroLink|Icon=MEPlan.png|Qt Example|Qt Example}}: example of using Qt commands, their connections, extraction and data assignment.
* {{MacroLink|Macro_Python_Assistant_Window|Macro Python Assistant Window|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.
* {{MacroLink|Macro_Build_Utility|Macro Build Utility|Macro Build Utility}}: This macro provides a utility to assemble a project from sub-project files using the Merge Project facility.
* {{MacroLink|Icon=Macro_Python_Assistant_Window.png|Macro Python Assistant Window|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.
* {{MacroLink|Macro_Global_Variable_Watcher|Macro Global Variable Watcher|Macro Global Variable Watcher}}: This macro facilitates the user selecting global variables and monitoring their values.
* {{MacroLink|Icon=Macro_Build_Utility.png|Macro Build Utility|Macro Build Utility}}: This macro provides a utility to assemble a project from sub-project files using the Merge Project facility.
* {{MacroLink|Icon=Macro_Global_Variable_Watcher.png|Macro Global Variable Watcher|Macro Global Variable Watcher}}: This macro facilitates the user selecting global variables and monitoring their values.
* {{MacroLink|Macro clone explicit|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.
</div>
</div>
</div>
</div>


<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">

===[[File:Arch_MeshToShape.svg]] Conversion===
===[[File:Arch_MeshToShape.svg]] Conversion===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Line 58: Line 64:


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

<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Text-x-python|Macro Automatic drawing|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
* {{MacroLink|Macro Automatic drawing|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
* {{MacroLink|Text-x-python|Macro CartoucheFC|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.
* {{MacroLink|Macro CartoucheFC|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.
* {{MacroLink|Macro_CartoucheFC_Full|Macro CartoucheFC Full|Macro CartoucheFC Full}}: This GUI macro to fill simply all fields of the cartridge [[Misc_templates_Full|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.
* {{MacroLink|Icon=Macro_CartoucheFC_Full.png|Macro CartoucheFC Full|Macro CartoucheFC Full}}: This GUI macro to fill simply all fields of the cartridge [[Misc_templates_Full|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.
* {{MacroLink|Text-x-python|Macro CartoucheFC 2|Macro CartoucheFC 2}}: This GUI macro to fill simply all fields of the cartridge '''model 2''' of the plan implementation worksheet FreeCAD.
* {{MacroLink|Macro CartoucheFC 2|Macro CartoucheFC 2}}: This GUI macro to fill simply all fields of the cartridge '''model 2''' of the plan implementation worksheet FreeCAD.
* {{MacroLink|Text-x-python|Macro Normal Vector|Macro Normal Vector}}: Get the normal vector of a preselected face for creating a drawing view normal to that face
* {{MacroLink|Macro Normal Vector|Macro Normal Vector}}: Get the normal vector of a preselected face for creating a drawing view normal to that face
</div>
</div>
</div>
</div>
Line 71: Line 79:
===[[File:Draft_BSpline.svg]] Dxf 2D Draft===
===[[File:Draft_BSpline.svg]] Dxf 2D Draft===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Text-x-python|Macro Rectellipse|Macro Rectellipse}}: creates a parametric rectellipse
* {{MacroLink|Macro Rectellipse|Macro Rectellipse}}: creates a parametric rectellipse
* {{MacroLink|Macro_Draft_Circle_3_Points|Macro Make Circle 3 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).
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro Make Circle 3 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).
* {{MacroLink|Macro_Draft_Circle_3_Points|Macro Draft Circle 3 Points|Macro Draft Circle 3 Points}}: creates a circle from 3 selected points 2D orthogonal
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro Draft Circle 3 Points|Macro Draft Circle 3 Points}}: creates a circle from 3 selected points 2D orthogonal
* {{MacroLink|Macro_Draft_Circle_3_Points|Macro Draft Circle 3 Points 3D|Macro Draft Circle 3 Points 3D}}: creates a circle from 3 selected points in the space 3D
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro Draft Circle 3 Points 3D|Macro Draft Circle 3 Points 3D}}: creates a circle from 3 selected points in the space 3D
* {{MacroLink|Macro Make Arc 3 Points|Macro Make Arc 3 Points|Macro Make Arc 3 Points}}: creates a arc from 3 selected points
* {{MacroLink|Icon=Macro Make Arc 3 Points.png|Macro Make Arc 3 Points|Macro Make Arc 3 Points}}: creates a arc from 3 selected points
* {{MacroLink|Text-x-python|Macro Ellipse-Center+2Points|Macro Ellipse-Center+2Points}} Makes an ellipse by selecting three points (in this order): centre, major radius and minor radius
* {{MacroLink|Macro Ellipse-Center+2Points|Macro Ellipse-Center+2Points}} Makes an ellipse by selecting three points (in this order): centre, major radius and minor radius
* {{MacroLink|Macro_FCConvertLines|Macro FCConvertLines|Macro FC Convert Lines}}: this macro convert the object line, wire in line Dash, DashDot, DashDotDot,ZigZag and Hand with the dimensions given.
* {{MacroLink|Icon=Macro_FCConvertLines.png|Macro FCConvertLines|Macro FC Convert Lines}}: this macro convert the object line, wire in line Dash, DashDot, DashDotDot,ZigZag and Hand with the dimensions given.
* {{MacroLink|Text-x-python|Macro EdgesToArc|Macro EdgesToArc}}: Converts the selected Edges to a circular Arc if possible. Useful for restoring discretized arcs.
* {{MacroLink|Macro EdgesToArc|Macro EdgesToArc}}: Converts the selected Edges to a circular Arc if possible. Useful for restoring discretized arcs.
* {{MacroLink|Text-x-python|Macro Creating faces from a DXF file|Macro Creating faces from a DXF file}}: This macro create face from a DXF file, the "Layer" are recognized separate and trained in groups.
* {{MacroLink|Macro Creating faces from a DXF file|Macro Creating faces from a DXF file}}: This macro create face from a DXF file, the "Layer" are recognized separate and trained in groups.
* {{MacroLink|Macro_DXF_to_Face_and_Sketch|Macro DXF to Face and Sketch|Macro DXF to Face and Sketch}}: This macro converts selected elements of imported dxf to face and sketch.
* {{MacroLink|Icon=Macro_DXF_to_Face_and_Sketch.png|Macro DXF to Face and Sketch|Macro DXF to Face and Sketch}}: This macro converts selected elements of imported dxf to face and sketch.
* {{MacroLink|Macro_Compound_Plus|Macro_Compound_Plus|Macro Compound Plus}}: Draf command set in a small macro for the 2D sketch example: work with the DXF files.
* {{MacroLink|Icon=Macro_Compound_Plus.png|Macro_Compound_Plus|Macro Compound Plus}}: Draf command set in a small macro for the 2D sketch example: work with the DXF files.
* {{MacroLink|Macro Dxf To Shape|Macro Dxf To Shape|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
* {{MacroLink|Icon=Macro Dxf To Shape.png|Macro Dxf To Shape|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
</div>
</div>
</div>
</div>


<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">

===[[File:Fem_ResultDisplacement.svg]] Fem===
===[[File:Fem_ResultDisplacement.svg]] Fem===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Text-x-python|Macro GMSH|Macro GMSH}}: Create FEM Meshes by GMSH Mesh Generator
* {{MacroLink|Macro GMSH|Macro GMSH}}: Create FEM Meshes by GMSH Mesh Generator
</div>
</div>
</div>
</div>


<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">

===[[File:Part_Measure_Clear_All.svg]] Info and measures===
===[[File:Part_Measure_Clear_All.svg]] Info and measures===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|FCInfo|Macro FCInfo|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
* {{MacroLink|Icon=FCInfo.png|Macro FCInfo|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
* {{MacroLink|FCInfo|Macro FCInfo Alternate Linux|Macro FCInfo Alternate Linux}}: same as above, but for Linux
* {{MacroLink|Icon=FCInfo.png|Macro FCInfo Alternate Linux|Macro FCInfo Alternate Linux}}: same as above, but for Linux
* {{MacroLink|Macro_FCInfoGlass|Macro FCInfoGlass|Macro FCInfoGlass}}: Gives a series of information about the selected shape and displayed in screen 3D
* {{MacroLink|Icon=Macro_FCInfoGlass.png|Macro FCInfoGlass|Macro FCInfoGlass}}: Gives a series of information about the selected shape and displayed in screen 3D
* {{MacroLink|FCInfoToMouse|Macro FCInfoToMouse|Macro FCInfoToMouse}}: Provide informations coordinates, length and angles in real time on the mouse in a bubble annotation displayed in the 3D screen
* {{MacroLink|Icon=FCInfoToMouse.png|Macro FCInfoToMouse|Macro FCInfoToMouse}}: Provide informations coordinates, length and angles in real time on the mouse in a bubble annotation displayed in the 3D screen
* {{MacroLink|Text-x-python|Macro Delta xyz|Macro Delta xyz}}: Gives the Delta values and the distance between 2 points
* {{MacroLink|Macro Delta xyz|Macro Delta xyz}}: Gives the Delta values and the distance between 2 points
* {{MacroLink|Text-x-python|Macro ObjectInfo|Macro ObjectInfo}}: User-friendly "Info" module created by a FreeCAD user
* {{MacroLink|Macro ObjectInfo|Macro ObjectInfo}}: User-friendly "Info" module created by a FreeCAD user
* {{MacroLink|Macro_Dump_Objects|Macro Dump Objects|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.
* {{MacroLink|Icon=Macro_Dump_Objects.png|Macro Dump Objects|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.
* {{MacroLink|Macro_MeasureCircle|Macro MeasureCircle|Macro MeasureCircle}}: Compute the radius of a circle by 3 points or a circular edge.
* {{MacroLink|Icon=Macro_MeasureCircle.png|Macro MeasureCircle|Macro MeasureCircle}}: Compute the radius of a circle by 3 points or a circular edge.
* {{MacroLink|Centomass|Macro CenterOfMass|Macro CenterOfMass}}: Gives the total mass and the center of mass of multiple objects selected with the density chosen.
* {{MacroLink|Icon=Macro CenterOfMass.png|Macro CenterOfMass|Macro CenterOfMass}}: Gives the total mass and the center of mass of multiple objects selected with the density chosen.
</div>
</div>
</div>
</div>
Line 112: Line 122:
===[[File:Draft_VisGroup.svg]] Libraries===
===[[File:Draft_VisGroup.svg]] Libraries===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Text-x-python|Macro screw maker1_2|Macro screw maker1_2}}: This macro creates a screw with or without thread, according to ISO standards ([http://forum.freecadweb.org/viewtopic.php?f=22&t=6088#p48519 screw_maker1_6.py.zip with Pyside support]). [http://forum.freecadweb.org/viewtopic.php?f=22&t=6558&start=30#p95929 (Screw Maker 2.0 - new version!)]
* {{MacroLink|Macro screw maker1_2|Macro screw maker1_2}}: This macro creates a screw with or without thread, according to ISO standards ([http://forum.freecadweb.org/viewtopic.php?f=22&t=6088#p48519 screw_maker1_6.py.zip with Pyside support]). [http://forum.freecadweb.org/viewtopic.php?f=22&t=6558&start=30#p95929 (Screw Maker 2.0 - new version!)]
* {{MacroLink|Macro_BOLTS|Macro BOLTS|Macro BOLTS}}: The aim of BOLTS is to build a free and open-source standard parts library for CAD applications.
* {{MacroLink|Icon=Macro_BOLTS.png|Macro BOLTS|Macro BOLTS}}: The aim of BOLTS is to build a free and open-source standard parts library for CAD applications.
* {{MacroLink|FreeCAD Doc|Macro PartsLibrary|Macro PartsLibrary}}: Starts the Parts library browser
* {{MacroLink|Icon=FreeCAD Doc.png|Macro PartsLibrary|Macro PartsLibrary}}: Starts the Parts library browser
</div>
</div>
</div>
</div>


<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">

===[[File:Bound-expression.svg]] Mathematical functions===
===[[File:Bound-expression.svg]] Mathematical functions===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Text-x-python|Macro 3D Parametric Curve|Macro 3D Parametric Curve}}: Draw a function described by parametric equations x(t), y(t) and z(t).
* {{MacroLink|Macro 3D Parametric Curve|Macro 3D Parametric Curve}}: Draw a function described by parametric equations x(t), y(t) and z(t).
* {{MacroLink|Text-x-python|Macro Draw 2D Function|Macro Draw 2D Function}}: draws a function described by an equation z=F(x)
* {{MacroLink|Macro Draw 2D Function|Macro Draw 2D Function}}: draws a function described by an equation z=F(x)
* {{MacroLink|Text-x-python|Macro Draw Parametric 2D Function|Macro Draw Parametric 2D Function}}: Based on the above macro, but for parametric and optionally polar
* {{MacroLink|Macro Draw Parametric 2D Function|Macro Draw Parametric 2D Function}}: Based on the above macro, but for parametric and optionally polar
* {{MacroLink|WF_wf|Macro WorkFeatures|Macro WorkFeatures}}: Tool utility : Tab > Wire > Curves And Surfaces {{KEY|Launch Curves and Surfaces Menu ...}}
* {{MacroLink|Icon=WF_wf.png|Macro WorkFeatures|Macro WorkFeatures}}: Tool utility : Tab > Wire > Curves And Surfaces {{KEY|Launch Curves and Surfaces Menu ...}}
equations.
equations.
</div>
</div>
Line 133: Line 144:
===[[File:IFC.svg]] Multifunctional===
===[[File:IFC.svg]] Multifunctional===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|WF_wf|Macro WorkFeatures|Macro WorkFeatures}}: 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.
* {{MacroLink|Icon=WF_wf.png|Macro WorkFeatures|Macro WorkFeatures}}: 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.
</div>
</div>
</div>
</div>


<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">

===[[File:Workbench_Image.svg]] Object creation===
===[[File:Workbench_Image.svg]] Object creation===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Macro_makeCube|Macro Make Cube|Macro Make Cube}}: creates a [http://en.wikipedia.org/wiki/Cuboid rectangular cuboid] from 4 points
* {{MacroLink|Icon=Macro_makeCube.png|Macro Make Cube|Macro Make Cube}}: creates a [http://en.wikipedia.org/wiki/Cuboid rectangular cuboid] from 4 points
* {{MacroLink|Text-x-python|Macro Solid Sweep|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.
* {{MacroLink|Macro Solid Sweep|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.
* {{MacroLink|Text-x-python|Macro Geodesic Dome|Macro Geodesic Dome}}: This macro creates a geodesic dome shell
* {{MacroLink|Macro Geodesic Dome|Macro Geodesic Dome}}: This macro creates a geodesic dome shell
* {{MacroLink|Text-x-python|Macro Line Length|Macro Line Length}}: Create a line giving coordinate XYZ length and angle to plane X Y
* {{MacroLink|Macro Line Length|Macro Line Length}}: Create a line giving coordinate XYZ length and angle to plane X Y
* {{MacroLink|Text-x-python|Macro cutLine|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.
* {{MacroLink|Macro cutLine|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.
* {{MacroLink|Macro CirclePlus|Macro CirclePlus|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.
* {{MacroLink|Icon=Macro CirclePlus.png|Macro CirclePlus|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.
* {{MacroLink|Text-x-python|Macro circle|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).
* {{MacroLink|Macro circle|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).
* {{MacroLink|Text-x-python|Macro cutCircle|Macro Cut Circle}}: Cut a circle or arc and create x arcs, giving the number of cut.
* {{MacroLink|Macro cutCircle|Macro Cut Circle}}: Cut a circle or arc and create x arcs, giving the number of cut.
* {{MacroLink|Text-x-python|Macro triangleAH|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)
* {{MacroLink|Macro triangleAH|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)
* {{MacroLink|FCTexture|Macro FCTexture|Macro Texture}}: Create a project from a bmp image to create a texture easily
* {{MacroLink|Icon=FCTexture.png|Macro FCTexture|Macro Texture}}: Create a project from a bmp image to create a texture easily
* {{MacroLink|FCCreaLoft|Macro FCCreaLoft|Macro Loft}}: Create a loft with a list of wire (specially created for Macro Texture see above)
* {{MacroLink|Icon=FCCreaLoft.png|Macro FCCreaLoft|Macro Loft}}: Create a loft with a list of wire (specially created for Macro Texture see above)
* {{MacroLink|FCCircularTextButtom|Macro FCCircularText|Macro Circular Text}}: This macro create a text around a cylinder
* {{MacroLink|Icon=FCCircularTextButtom.png|Macro FCCircularText|Macro Circular Text}}: This macro create a text around a cylinder
* {{MacroLink|Text-x-python|Macro WireXYZ|Macro WireXYZ}}: This macro creates a Wire with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.
* {{MacroLink|Macro WireXYZ|Macro WireXYZ}}: This macro creates a Wire with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.
* {{MacroLink|Macro_ReproWire|Macro ReproWire|Macro Repro Wire}}: This macro reproduce all element selected subobject wire or face.
* {{MacroLink|Icon=Macro_ReproWire.png|Macro ReproWire|Macro Repro Wire}}: This macro reproduce all element selected subobject wire or face.
* {{MacroLink|Part_Prism_Apothem|Macro Apothem Based Prism GUI|Macro Apothem Based Prism GUI}}: A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.
* {{MacroLink|Icon=Part_Prism_Apothem.svg|Macro Apothem Based Prism GUI|Macro Apothem Based Prism GUI}}: A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.
* {{MacroLink|FCSpring_Helix_Variable|Macro FCSpring Helix Variable|Macro FCSpring Helix Variable}}: This macro create one spring truncate, the troncature is adjustable on the all coil to choice.
* {{MacroLink|Icon=FCSpring_Helix_Variable.png|Macro FCSpring Helix Variable|Macro FCSpring Helix Variable}}: This macro create one spring truncate, the troncature is adjustable on the all coil to choice.
* {{MacroLink|Text-x-python|Macro Guitar fretboard|Macro Guitar fretboard}}: Guitar Fretboard Maker
* {{MacroLink|Macro Guitar fretboard|Macro Guitar fretboard}}: Guitar Fretboard Maker
* {{MacroLink|Cam-groover-icon-32x32|Macro FCCamGroover|Macro FCCamGroover}}: Creates grooved cylinder for cam.
* {{MacroLink|Icon=Cam-groover-icon-32x32.png|Macro FCCamGroover|Macro FCCamGroover}}: Creates grooved cylinder for cam.
* {{MacroLink|Text-x-python|Macro Site From Contours|Macro Site From Contours}}: creates an Arch Site from a series of contour lines
* {{MacroLink|Macro Site From Contours|Macro Site From Contours}}: creates an Arch Site from a series of contour lines
</div>
</div>
</div>
</div>
Line 174: Line 186:


<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">

===[[File:View.svg]] Printer 3D===
===[[File:View.svg]] Printer 3D===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Text-x-python|Macro 3d Printer Slicer|Macro 3d Printer Slicer}}: Exports current design to slicer software or CAM software.
* {{MacroLink|Macro 3d Printer Slicer|Macro 3d Printer Slicer}}: Exports current design to slicer software or CAM software.
</div>
</div>
</div>
</div>


<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">

===[[File:Preferences-raytracing.svg]] Raytracing===
===[[File:Preferences-raytracing.svg]] Raytracing===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Text-x-python|Macro FreeCAD to Kerkythea|Macro FreeCAD to Kerkythea}}: Export from FreeCAD to Kerkythea
* {{MacroLink|Macro FreeCAD to Kerkythea|Macro FreeCAD to Kerkythea}}: Export from FreeCAD to Kerkythea
</div>
</div>
</div>
</div>


<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">

===[[File:Spreadsheet.svg]] Spreadsheet Workbench===
===[[File:Spreadsheet.svg]] Spreadsheet Workbench===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|aliasmanager_icon|Macro Alias Manager|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.
* {{MacroLink|Icon=aliasmanager_icon.png|Macro Alias Manager|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.
* {{MacroLink|Text-x-python|Macro SpreadsheetTools|Macro Spreadsheet Tools}}: This macro helps managing cells inside FreeCAD Spreadsheet workbench.
* {{MacroLink|Macro SpreadsheetTools|Macro Spreadsheet Tools}}: This macro helps managing cells inside FreeCAD Spreadsheet workbench.
* {{MacroLink|Macro FCTreeView|Macro FCTreeView|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.
* {{MacroLink|Icon=Macro FCTreeView.png|Macro FCTreeView|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.
* {{MacroLink|Macro_FCSpreadsheet_Extract|Macro FCSpreadSheet Extract|Macro FCSpreadSheet Extract}}: This macro save the data in a csv file with the formula or in a xml file.
* {{MacroLink|Icon=Macro_FCSpreadsheet_Extract.png|Macro FCSpreadSheet Extract|Macro FCSpreadSheet Extract}}: This macro save the data in a csv file with the formula or in a xml file.
</div>
</div>
</div>
</div>
Line 201: Line 216:
===[[File:Arch_Survey.svg]] Utility===
===[[File:Arch_Survey.svg]] Utility===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|CenterFace|Macro CenterFace|Macro CenterFace}}: This macro red trace (editable) the center face (mass) with 1 point and print the coordinates
* {{MacroLink|Icon=CenterFace.png|Macro CenterFace|Macro CenterFace}}: This macro red trace (editable) the center face (mass) with 1 point and print the coordinates
* {{MacroLink|Macro_Center_Align_Objects_with_Faces_or_Edges|Macro Center Align Objects with Faces or Edges|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.
* {{MacroLink|Icon=Macro_Center_Align_Objects_with_Faces_or_Edges.png|Macro Center Align Objects with Faces or Edges|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.
* {{MacroLink|Macro_Easy_Cutouts_for_Enclosures|Macro Easy cutouts for Enclosure Design|Macro Easy cutouts for Enclosure Design}}: This macro makes Cutouts for Enclosures in a very handy way
* {{MacroLink|Icon=Macro_Easy_Cutouts_for_Enclosures.png|Macro Easy cutouts for Enclosure Design|Macro Easy cutouts for Enclosure Design}}: This macro makes Cutouts for Enclosures in a very handy way
* {{MacroLink|Text-x-python|Macro MacroMenu|Macro MacroMenu}}: Add the macros found in the macros folder to the Macros menu of FreeCAD
* {{MacroLink|Macro MacroMenu|Macro MacroMenu}}: Add the macros found in the macros folder to the Macros menu of FreeCAD
* {{MacroLink|Force_Recompute|Macro ForceRecompute|Macro ForceRecompute}}: Forces manual recompute of model
* {{MacroLink|Icon=Force_Recompute.png|Macro ForceRecompute|Macro ForceRecompute}}: Forces manual recompute of model
* {{MacroLink|Text-x-python|Macro Recompute Profiler|Macro Recompute Profiler}}: measures time it takes to recompute each object in a project
* {{MacroLink|Macro Recompute Profiler|Macro Recompute Profiler}}: measures time it takes to recompute each object in a project
* {{MacroLink|Text-x-python|Macro Shake Sketch|Macro Shake Sketch}}: Shake a sketch in order to discover its unconstrained parts.
* {{MacroLink|Macro Shake Sketch|Macro Shake Sketch}}: Shake a sketch in order to discover its unconstrained parts.
* {{MacroLink|Replace_Part|Macro Replace Part in Assembly|Macro Replace Part in Assembly}}: Replaces a part (simple copy) in an "Assembly" with another Part (simple copy).
* {{MacroLink|Icon=Replace_Part.png|Macro Replace Part in Assembly|Macro Replace Part in Assembly}}: Replaces a part (simple copy) in an "Assembly" with another Part (simple copy).
* {{MacroLink|Macro_Toggle_Drawstyle|Macro Toggle Drawstyle|Macro Toggle Drawstyle}}: This macro toggles the Drawstyle of the selected object
* {{MacroLink|Icon=Macro_Toggle_Drawstyle.png|Macro Toggle Drawstyle|Macro Toggle Drawstyle}}: This macro toggles the Drawstyle of the selected object
* {{MacroLink|Text-x-python|Macro HighlightCommon|Macro HighlightCommon}}: Highlight common parts.
* {{MacroLink|Macro HighlightCommon|Macro HighlightCommon}}: Highlight common parts.
* {{MacroLink|HighlightDifference|Macro HighlightDifference|Macro HighlightDifference}}: Compute the difference between two shapes.
* {{MacroLink|Icon=HighlightDifference.png|Macro HighlightDifference|Macro HighlightDifference}}: Compute the difference between two shapes.
* {{MacroLink|Text-x-python|Macro cross section|Macro cross section}}: displays an interactively slidable cross-section.
* {{MacroLink|Macro cross section|Macro cross section}}: displays an interactively slidable cross-section.
* {{MacroLink|Text-x-python|Macro Print_SceneGraph|Macro Print_SceneGraph}}: prints the SceneGraph.
* {{MacroLink|Macro Print_SceneGraph|Macro Print_SceneGraph}}: prints the SceneGraph.
* {{MacroLink|BoundBoxTracing|Macro BoundingBox Tracing|Macro BoundingBox Tracing}}: This macro red trace (editable) around the BoundingBox with 6 rectangles
* {{MacroLink|Icon=BoundBoxTracing.png|Macro BoundingBox Tracing|Macro BoundingBox Tracing}}: This macro red trace (editable) around the BoundingBox with 6 rectangles
* {{MacroLink|Text-x-python|Macro Arch Axis System Repartition|Macro Arch Axis System Repartition}}: This macro help you to create an Arch Axis System along a line with a
* {{MacroLink|Macro Arch Axis System Repartition|Macro Arch Axis System Repartition}}: This macro help you to create an Arch Axis System along a line with a
* {{MacroLink|Macro Perpendicular To Wire|Macro Perpendicular To Wire|Macro Perpendicular To Wire}}: This macro positioned your object perpendicularly to wire selected.
* {{MacroLink|Icon=Macro Perpendicular To Wire.png|Macro Perpendicular To Wire|Macro Perpendicular To Wire}}: This macro positioned your object perpendicularly to wire selected.
* {{MacroLink|Text-x-python|Macro merge duplicate materials|Macro merge duplicate materials}}: Merges materials that have the same base name (with different numeral endings like 001, 002,...) into one.
* {{MacroLink|Macro merge duplicate materials|Macro merge duplicate materials}}: Merges materials that have the same base name (with different numeral endings like 001, 002,...) into one.
* {{MacroLink|Text-x-python|Macro Unbind Numpad Shortcuts|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.
* {{MacroLink|Macro Unbind Numpad Shortcuts|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.
* {{MacroLink|Text-x-python|Macro findConfigFiles|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.
* {{MacroLink|Macro findConfigFiles|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.
</div>
</div>
</div>
</div>
Line 227: Line 242:
===[[File:Bulb.svg]] Wizards===
===[[File:Bulb.svg]] Wizards===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Text-x-python|Macro Sheet Metal Unfolder|Macro Sheet Metal Unfolder}}: Creates an unfolded part from a sheet-metal-part.
* {{MacroLink|Macro Sheet Metal Unfolder|Macro Sheet Metal Unfolder}}: Creates an unfolded part from a sheet-metal-part.
* {{MacroLink|Text-x-python|Macro Unroll Ruled Surface|Macro Unroll Ruled Surface}}: allows to unroll ruled surfaces and to draw them on a page.
* {{MacroLink|Macro Unroll Ruled Surface|Macro Unroll Ruled Surface}}: allows to unroll ruled surfaces and to draw them on a page.
* {{MacroLink|Text-x-python|Macro Unfold Box|Macro Unfold Box}}: allows to unfold the surfaces of a box of any shape and to draw them on a page.
* {{MacroLink|Macro Unfold Box|Macro Unfold Box}}: allows to unfold the surfaces of a box of any shape and to draw them on a page.
* {{MacroLink|Text-x-python|Macro Airfoil Import & Scale|Macro Airfoil Import & Scale}}: Imports and scales a .dat airfoil to desired chord length.
* {{MacroLink|Macro Airfoil Import & Scale|Macro Airfoil Import & Scale}}: Imports and scales a .dat airfoil to desired chord length.
* {{MacroLink|GW_Dim|Macro Geneva Wheel|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.
* {{MacroLink|Icon=GW_Dim.png|Macro Geneva Wheel|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.
* {{MacroLink|GW_Dim|Macro Geneva Wheel GUI|Macro Geneva Wheel GUI}}: A GUI front end that allows the user to create a Geneva wheel mechanism from scratch.
* {{MacroLink|Icon=GW_Dim.png|Macro Geneva Wheel GUI|Macro Geneva Wheel GUI}}: A GUI front end that allows the user to create a Geneva wheel mechanism from scratch.
* {{MacroLink|Cabinets32|Macro Cabinets32|Macro Cabinets32}}: creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.
* {{MacroLink|Icon=Cabinets32.png|Macro Cabinets32|Macro Cabinets32}}: creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.
* {{MacroLink|Text-x-python|Macro Half_turn_stairs|Macro Half_turn_stairs}}: Creates a half turn (left/right) stair from a Data-file.
* {{MacroLink|Macro Half_turn_stairs|Macro Half_turn_stairs}}: Creates a half turn (left/right) stair from a Data-file.
* {{MacroLink|Macro_Half_Hull_Model|Macro Half-Hull Model|Macro Half-Hull Model}}: This macro generates both three dimensional [http://en.wikipedia.org/wiki/Half_hull_model_ship half-hull] and full-hull models from a series of 2D line drawings.
* {{MacroLink|Icon=Macro_Half_Hull_Model.png|Macro Half-Hull Model|Macro Half-Hull Model}}: This macro generates both three dimensional [http://en.wikipedia.org/wiki/Half_hull_model_ship half-hull] and full-hull models from a series of 2D line drawings.
* {{MacroLink|Text-x-python|Macro Stairs|Macro Stairs}}: Create stair helix, create your stair nosing select and run the macro.
* {{MacroLink|Macro Stairs|Macro Stairs}}: Create stair helix, create your stair nosing select and run the macro.
* {{MacroLink|Gearworkbech|Macro FCGear|Macro FCGear}}: Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.
* {{MacroLink|Icon=Gearworkbech.png|Macro FCGear|Macro FCGear}}: Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.
* {{MacroLink|Text-x-python|Macro Corner shapes wizard|Macro Corner shapes wizard}}: 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
* {{MacroLink|Macro Corner shapes wizard|Macro Corner shapes wizard}}: 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
* {{MacroLink|PropertyMemo|Macro PropertyMemo|Macro PropertyMemo}}: This little macro create one Property additional (memo or other text) for you object (only Draft)
* {{MacroLink|Icon=PropertyMemo.png|Macro PropertyMemo|Macro PropertyMemo}}: This little macro create one Property additional (memo or other text) for you object (only Draft)
</div>
</div>
</div>
</div>


<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">

===[[File:Std_FreeCADWebsite.png|32px]] Other interesting macros created by FreeCAD users===
===[[File:Std_FreeCADWebsite.png|32px]] Other interesting macros created by FreeCAD users===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* [[Image:2364.png|24px]] [https://github.com/microelly2?tab=repositories By microelly2] : freeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, ..... other
* [[Image:2364.png|24px]] [https://github.com/microelly2?tab=repositories By microelly2] : freeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, and more.
* [[Image:Text-x-python.png|24px]] [https://github.com/hamish2014?tab=repositories By hamish2014]: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, ...
* [[Image:Text-x-python.png|24px]] [https://github.com/hamish2014?tab=repositories By hamish2014]: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, and more.
* [[Image:Text-x-python.png|24px]] [https://github.com/triplus?tab=repositories By triplus]: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, ....
* [[Image:Text-x-python.png|24px]] [https://github.com/triplus?tab=repositories By triplus]: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, and more.
* [[File:681.jpg |24px]] [https://github.com/wood-galaxy By rockn]: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, .... other
* [[Image:681.jpg|24px]] [https://github.com/wood-galaxy By rockn]: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, and more.
* [[Image:Text-x-python.png|24px]] [https://github.com/oddtopus?tab=repositories By oddtopus]: flamingo (workbench for metal structures)
* [[Image:Text-x-python.png|24px]] [https://github.com/oddtopus?tab=repositories By oddtopus]: flamingo (workbench for metal structures).
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/getDimensions By dprojects]: getDimensions FreeCAD macro to get chipboards dimensions to cut (woodworking)
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/getDimensions By dprojects]: getDimensions FreeCAD macro to get chipboards dimensions to cut (woodworking).
* [[Image:Text-x-python.png|24px]] [https://github.com/Siardeni/FreeCADTools By Siardeni]: workbench for create metal profiles, square tubing, z profile, palette, rotation, drawing ...
* [[Image:Text-x-python.png|24px]] [https://github.com/Siardeni/FreeCADTools By Siardeni]: workbench for create metal profiles, square tubing, z profile, palette, rotation, drawing, and more.
* [[Image:Text-x-python.png|24px]] [https://github.com/realthunder/FreeCAD_assembly3#installation By realthunder]: workbench FreeCAD_assembly3 ... other
* [[Image:Text-x-python.png|24px]] [https://github.com/realthunder/FreeCAD_assembly3#installation By realthunder]: Assembly3 workbench, and more.
</div>
</div>
</div>
</div>




== How to use? ==
== How to use ==
[[File:Macro Recipes MacroHowToInstall.png|200px|left|Macro how to install]]
'''The above macros can easily be plugged on any FreeCAD installation'''
* Starting from '''FreeCAD v 0.17''', a new Tools → Addons Manager allows you to easily install any macro from this page. The instructions below must still be followed if your version of FreeCAD doesn't have the Addons Manager yet.
* Copy the macro python code from the corresponding macro page
* In FreeCAD, Macro → Macros → Create new, and give it a name
* Paste the python code you copied
* Hit the Save button, and restart FreeCAD
* Open the Macro manager, select your new macro and click "execute"
* Tutorial [[How to install macros]]

'''Additionally, you can also add your new macro to a custom toolbar'''
* In FreeCAD, go to Tools → Customize
* In the Macros tab, add a new macro, and, if you like, 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.
* Tutorial [[Customize_Toolbars|Customize Toolbars]]
{{clear}}


== Adding new macros to this repository ==
* Create a new page, beginning its name with "Macro", for example "Macro_My_Excellent_Macro", this can be done simply by editing this page, and adding a new link to your macro, like this:<br />
** example :

{{Code|code=
<nowiki>* {{MacroLink|Text-x-python|Macro My Excellent Macro|Macro My Excellent Macro title}} : My excellent macro description</nowiki>.}}

* '''Text-x-python''' : icon by default (replace with your name icon with the exact same name as your macro page if there is. The format always '''.png''' only)
* '''Macro My Excellent Macro''' : macro name
* '''Macro My Excellent Macro title''' : macro name or title

A new page (red link) will be created.
* In that page, paste the following text:

(With the default icon)

<nowiki>{{Macro|Icon=Text-x-python|Name=Macro_My_Excellent_Macro|Description=What my excellent macro does|Author=your username|Version=1.0|Date=YYYY-MM-DD}</nowiki>

(With the icon custom)
<nowiki>{{Macro|Icon=Macro_My_Excellent_Macro|Name=Macro_My_Excellent_Macro|Description=What my excellent macro does|Author=your username|Version=1.0|Date=YYYY-MM-DD}}</nowiki>

(Another language with the default icon (example "/fr" "/de" "/it"....))

<nowiki>{{Macro/fr|Icon=Text-x-python|Name=Macro_My_Excellent_Macro|Name/fr=Macro_My_Excellent_Macro|Description=
What my excellent macro does|Author=your username|Version=1.0|Date=YYYY-MM-DD}</nowiki>

(Another language with the icon custom (example "/fr" "/de" "/it"....))

<nowiki>{{Macro/fr|Icon=Macro_My_Excellent_Macro|Name=Macro_My_Excellent_Macro|Name/fr=Macro_My_Excellent_Macro|Description=
What my excellent macro does|Author=your username|Version=1.0|Date=YYYY-MM-DD}}</nowiki>

*You can also [http://www.freecadweb.org/wiki/index.php?title=Special:Upload Upload ] a custom format icon'''.png'''<br />'''Note that the name of the icon must have the same name as the name of the macro'''.
**example: " Macro_My_Excellent_Macro " '''without extension''' (the extension is given by the system), and, replace " Icon='''Text-x-python''' " by " Icon='''Macro_My_Excellent_Macro''' "
**'''Text-x-python''' [[Image:Text-x-python.png|32px]] is the default icon of the page dedicated to the Macro.

* Paste your macro, and use the [[Template:Code|Code template]] to avoid adding spaces into your script. This will display the macro in a monospace font inside a light grey box like the example above.
* If you like, upload a .png icon with the exact same name as your macro page (ex. Macro_My_Excellent_Macro.png)
* Add an image: an image is useful to show what the macro does. Optionally you can create an animated gif that represents the object in context. The gif image should have a maximum size of 500x500px as the wiki does not resize animated gifs; if the gif is any bigger the animation won't work.
* Optionally you can add some more info on how to use your macro, tips, limitations and workaround.
* It is also interesting to include version information in your macro. This macro allows you to locate in time compared to the evolution of FreeCAD, do "Menu → Help → About FreeCAD and click to Copy to clipboard" and paste it your macro

Ex:

{{Code|code=
#OS: Windows Vista
#Platform: 32-bit
#Version: 0.14.3389
#Python version: 2.6.2
#Qt version: 4.5.2
#Coin version: 3.1.0
#SoQt version: 1.4.1
#OCC version: 6.5.1
}}

It is also advisable to create a macro in your header, this header can be used by the [http://forum.freecadweb.org/viewtopic.php?t=10556 Plugin Loader] program to install the macro and check versions. Also available [https://github.com/FreeCAD/FreeCAD-addons addons_installer.FCMacro]

Ex:
{{Code|code=

__Title__="Title_Of_macro"
__Author__ = "User_Name"
__Version__ = "00.11"
__Date__ = "2015-07-25"

__Comment__ = "This is the comment of the macro"
__Web__ = "http://forum.freecadweb.org/viewtopic.php?f=3&t=7384"
__Wiki__ = "http://www.freecadweb.org/wiki/index.php?title=Macro_Title_Of_macro"
__Icon__ = "/usr/lib/freecad/Mod/plugins/icons/Title_Of_macro"
__IconW__ = "C:/Documents and Settings/YourUserName/Application Data/FreeCAD"
__Help__ = "start the macro and follow the instructions"
__Status__ = "stable"
__Requires__ = "freecad 0.14.3706"
__Communication__ = "http://www.freecadweb.org/wiki/index.php?title=User:User_Name"
}}

* Add it to the above categories, create a new category if needed.
==Adding new macro page with macro code extra wiki==


See [[how to install macros|[how to install macros]] for a full description, and [[Customize Toolbars|customize toolbars]] to add the macros to a toolbar for easy access.
If your macro is too big (+64Ko) and does not fit in the wiki page, use the '''<nowiki>{{Codeextralink| xxx}}</nowiki>''' template by giving the address of the '''RAW''' page of the macro


Installing many macros is equivalent to installing a new workbench; see [[How to install additional workbenches|how to install additional workbenches]] for this information.
The template must always be placed at the beginning of the page below the Description (must be the first code detected by the addonManager macro, in case there are code examples in the page, if a sample code is detected is this code that will be installed and not the code of the macro)


=== Automatic installation ===
Example given:
Starting with FreeCAD 0.17, use the [[Addon Manager|Addon Manager]] in {{MenuCommand|Tools → Addon manager}} to install a macro that has been included in the [https://github.com/FreeCAD/FreeCAD-macros FreeCAD-macros] repository.


=== Manual installation ===
'''<nowiki>{{Codeextralink|https://gist.githubusercontent.com/mario52a/8d40ab6c018c2bde678f/raw/e16ad9ea7b38c0c47e42aa3019be01dd1267a620/FCInfo_en_Ver_1-20_Docked.FCMacro}}</nowiki>'''
If the [[Addon Manager|Addon Manager]] is not used, the macro can be installed manually.
* Copy the [[Python|Python]] code from the corresponding macro page.
* Open the macros menu {{MenuCommand|Macro → Macros}}, press {{Button|Create}}, and give it a name.
* Paste the Python code that you copied.
* Press the {{Button|Save}} button, and restart FreeCAD.
* To use it, open again the macros menu, select your new macro, and press {{Button|Execute}}.


=== Add a macro to a custom toolbar ===
Example displayed in the macro page:
* Go to {{MenuCommand|Tools → Customize}}.
* In the {{MenuCommand|Macros}} tab, add a new macro name, and optionally define an icon and a keyboard shortcut.
* In the {{MenuCommand|Toolbars}} tab, create a new toolbar, and add your macro, taking it from the {{MenuCommand|Macros}} category.


{{Codeextralink|https://gist.githubusercontent.com/mario52a/8d40ab6c018c2bde678f/raw/e16ad9ea7b38c0c47e42aa3019be01dd1267a620/FCInfo_en_Ver_1-20_Docked.FCMacro}}
==Tutorials==
* [[How to install macros|How to install macros]]
* [[Customize_Toolbars|Customize Toolbars]]
* [[How_to_install_additional_workbenches|How to install additional workbenches]]
[[Category:Repository/sv]]
[[Category:Repository/sv]]
[[Category:Macros/sv]]
[[Category:Macros/sv]]

Revision as of 12:22, 3 March 2019

Tutorial
Topic
Macros
Level
Beginner
Time to complete
Authors
FreeCAD version
Example files
See also
None

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

  • Template:MacroLink/sv Detta makro roterar den nuvarande vyn med 90° åt vänster. Fungerar endast om du är i toppvyn.

Animation

Code and Scripting

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

Conversion

  • Konvertera Nät till Delar: Detta makro konverterar valda nät till delar. Det har en bred tolerans, så använd det bara med objekt som inte har några kurvor, annars kommer du att få konstiga resultat.

Drawing Workbench

The Drawing Workbench is considered 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 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 CartoucheFC 2: This GUI macro to fill simply all fields of the cartridge model 2 of the plan implementation worksheet FreeCAD.
  • Macro Normal Vector: Get the normal vector of a preselected face for creating a drawing view normal to that face

Dxf 2D Draft

Fem

  • Macro GMSH: Create FEM Meshes by GMSH Mesh Generator

Info and measures

  • 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
  • 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 Delta xyz: Gives the Delta values and the distance between 2 points
  • Macro ObjectInfo: User-friendly "Info" module created by a FreeCAD user
  • 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 MeasureCircle: Compute the radius of a circle by 3 points or a circular edge.
  • Macro CenterOfMass: Gives the total mass and the center of mass of multiple objects selected with the density chosen.

Libraries

Mathematical functions

equations.

Multifunctional

  • Macro WorkFeatures: 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.

Object creation

  • Macro Make Cube: creates a rectangular cuboid from 4 points
  • 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 Geodesic Dome: This macro creates a geodesic dome shell
  • Macro Line Length: Create a line giving coordinate XYZ length and angle to plane X Y
  • 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 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 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 Cut Circle: Cut a circle or arc and create x arcs, giving the number of cut.
  • 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 Texture: Create a project from a bmp image to create a texture easily
  • Macro Loft: Create a loft with a list of wire (specially created for Macro Texture see above)
  • Macro Circular Text: This macro create a text around a cylinder
  • Macro WireXYZ: This macro creates a Wire with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.
  • Macro Repro Wire: This macro reproduce all element selected subobject wire or face.
  • Macro Apothem Based Prism GUI: A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.
  • Macro FCSpring Helix Variable: This macro create one spring truncate, the troncature is adjustable on the all coil to choice.
  • Macro Guitar fretboard: Guitar Fretboard Maker
  • Macro FCCamGroover: Creates grooved cylinder for cam.
  • Macro Site From Contours: creates an Arch Site from a series of contour lines

Object transformation

  • Template:MacroLink/sv: Detta makro kopierar det valda objektet flera gånger på ett rutnät. Du kan definiera antalet rader, kolumner och avståndet mellan dem. Du behöver ha pyqt installerat.
  • Template:MacroLink/sv: Detta makro plattar ut ritlinjer som inte är parallella (i Z-axeln) till deras median Z koordinat.
  • Template:MacroLink/sv: Detta makro hittar alla oanslutna kanter och kopplar ihop dem med den närmaste oanslutna genom att använda en linje.

Det har en matrisform i inmatningen ( [shape1,shape2,...]).

Printer 3D

Raytracing

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 Spreadsheet Tools: This macro helps managing cells inside FreeCAD Spreadsheet workbench.
  • 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 FCSpreadSheet Extract: This macro save the data in a csv file with the formula or in a xml file.

Utility

Wizards

  • Macro Sheet Metal Unfolder: Creates an unfolded part from a sheet-metal-part.
  • Macro Unroll Ruled Surface: allows to unroll ruled surfaces and to draw them on a page.
  • Macro Unfold Box: allows to unfold the surfaces of a box of any shape and to draw them on a page.
  • Macro Airfoil Import & Scale: Imports and scales a .dat airfoil to desired chord length.
  • 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 Cabinets32: creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.
  • 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 Stairs: Create stair helix, create your stair nosing select and run the macro.
  • Macro FCGear: Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.
  • Macro Corner shapes wizard: 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 PropertyMemo: This little macro create one Property additional (memo or other text) for you object (only Draft)

Other interesting macros created by FreeCAD users

  • By microelly2 : freeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, and more.
  • By hamish2014: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, and more.
  • By triplus: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, and more.
  • By rockn: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, and more.
  • By oddtopus: flamingo (workbench for metal structures).
  • By dprojects: getDimensions FreeCAD macro to get chipboards dimensions to cut (woodworking).
  • By Siardeni: workbench for create metal profiles, square tubing, z profile, palette, rotation, drawing, and more.
  • 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 Tools → Addon manager 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 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.