Macros recipes

From FreeCAD Documentation
Jump to navigation Jump to search
This page is a translated version of the page Macros recipes and the translation is 4% complete.
Outdated translations are marked like this.
Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎hrvatski • ‎italiano • ‎română • ‎svenska • ‎čeština • ‎русский
Text-x-python.png Macros

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

Part CheckGeometry.svg 3D View operations

  • Text-x-python.png Macro Rotate View Detta makro roterar den nuvarande vyn med 90° åt vänster. Fungerar endast om du är i toppvyn.

Draft FlipDimension.svg Animation

Applications-python.svg Code and Scripting

  • Macro MessageBox.png Macro MessageBox: shows how to give information to the user through the GUI.
  • MEPlan.png Qt Example: example of using Qt commands, their connections, extraction and data assignment.
  • Macro Python Assistant Window.png 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.png 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.png Macro Global Variable Watcher: This macro facilitates the user selecting global variables and monitoring their values.
  • Macro clone explicit.png 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.

Arch MeshToShape.svg 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-orthoviews.svg Drawing Workbench

The Drawing Workbench is considered obsolete since FreeCAD 0.17. Consider using the TechDraw Workbench instead.

  • Macro Automatic drawing.png 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.png 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.png 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.png 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.png Macro Normal Vector: Get the normal vector of a preselected face for creating a drawing view normal to that face

Draft BSpline.svg Dxf 2D Draft

Fem ResultDisplacement.svg Fem

  • Macro GMSH.png Macro GMSH: Create FEM Meshes by GMSH Mesh Generator
  • Text-x-python.png 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.

Part Measure Clear All.svg Info and measures

  • FCInfo.png 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
  • FCInfo.png Macro FCInfo Alternate Linux: same as above, but for Linux
  • Macro FCInfoGlass.png Macro FCInfoGlass: Gives a series of information about the selected shape and displayed in screen 3D
  • FCInfoToMouse.png 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.png Macro Delta xyz: Gives the Delta values and the distance between 2 points
  • Macro ObjectInfo.png Macro ObjectInfo: User-friendly "Info" module created by a FreeCAD user
  • Macro Dump Objects.png 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.png Macro MeasureCircle: Compute the radius of a circle by 3 points or a circular edge.
  • Macro CenterOfMass.png Macro CenterOfMass: Gives the total mass and the center of mass of multiple objects selected with the density chosen.
  • Macro SimpleProperties.png Macro SimpleProperties: Display in a concise way basic physical properties of an object (volume, bound box dimensions, ...)

Draft VisGroup.svg Libraries

Bound-expression.svg Mathematical functions

equations.

IFC.svg Multifunctional

  • WF wf.png 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.

Workbench Image.svg Object creation

  • Macro makeCube.png Macro Make Cube: creates a rectangular cuboid from 4 points
  • Macro Solid Sweep.png 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.svg Macro Geodesic Dome: This macro creates a geodesic dome shell
  • Pyramidicon.svg Macro Pyramid: This macro creates a parametric pyramid. All parameters are customizable just like with Part Cone.
  • Dodecahedron.svg Macro Polyhedrons: This macro creates parametric polyhedrons (dodecahedron, icosahedron, tetrahedron, ...). Customizable via radius or side.
  • Macro Line Length.png Macro Line Length: Create a line giving coordinate XYZ length and angle to plane X Y
  • Macro Cut Line.png 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.png 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.png 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.png Macro Cut Circle: Cut a circle or arc and create x arcs, giving the number of cut.
  • Macro Triangle AH.png 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)
  • FCTexture.png Macro Texture: Create a project from a bmp image to create a texture easily
  • FCCreaLoft.png Macro Loft: Create a loft with a list of wire (specially created for Macro Texture see above)
  • FCCircularTextButtom.png Macro Circular Text: This macro create a text around a cylinder
  • Macro WireXYZ.png 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 ReproWire.png Macro Repro Wire: This macro reproduce all element selected subobject wire or face.
  • Part Prism Apothem.svg Macro Apothem Based Prism GUI: A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.
  • FCSpring Helix Variable.png Macro FCSpring Helix Variable: This macro create one spring truncate, the troncature is adjustable on the all coil to choice.
  • FCSpring On Surface.png Macro FCSpring On Surface: This macro create one spring (helix) on the surface of the object (solide).
  • Macro Guitar fretboard.png Macro Guitar fretboard: Guitar Fretboard Maker
  • Macro Guitar Nut.png Macro Guitar Nut: Guitar Nut Maker
  • Cam-groover-icon-32x32.png Macro FCCamGroover: Creates grooved cylinder for cam.
  • Macro Site From Contours.png Macro Site From Contours: creates an Arch Site from a series of contour lines
  • FCHoneycombMakerIcon.png Macro FCHoneycombMaker: Creates parametric honeycomb grid.

Workbench PartDesign.svg Object transformation

  • Text-x-python.png Rutnätskopiering: 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.
  • Text-x-python.png Platta ut tråd: Detta makro plattar ut ritlinjer som inte är parallella (i Z-axeln) till deras median Z koordinat.
  • Text-x-python.png Förena tråd: 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,...]).

View.svg Printer 3D

Preferences-raytracing.svg Raytracing

Spreadsheet.svg Spreadsheet Workbench

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

Arch Survey.svg Utility

Bulb.svg Wizards

  • Macro Sheet Metal Unfolder.png Macro Sheet Metal Unfolder: Creates an unfolded part from a sheet-metal-part.
  • Macro Unroll Ruled Surface.png Macro Unroll Ruled Surface: allows to unroll ruled surfaces and to draw them on a page.
  • Macro Unfold Box.png 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.png Macro Airfoil Import & Scale: Imports and scales a .dat airfoil to desired chord length.
  • GW Dim.png 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.
  • GW Dim.png Macro Geneva Wheel GUI: A GUI front end that allows the user to create a Geneva wheel mechanism from scratch.
  • Macro Cabinets32.png Macro Cabinets32: creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.
  • Macro Half turn stairs.png Macro Half turn stairs: Creates a half turn (left/right) stair from a Data-file.
  • Macro Half Hull Model.png 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.png Macro Stairs: Create stair helix, create your stair nosing select and run the macro.
  • Gearworkbech.png Macro FCGear: Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.
  • Macro Corner shapes wizard.png 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 Corner shapes wizard.png 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
  • PropertyMemo.png Macro PropertyMemo: This little macro create one Property additional (memo or other text) for you object (only Draft)
  • Macro Fonts Win10 PYMP.png 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 Rubik Cube.png Macro Rubik Cube: Display a Rubik Cube and interactively do slice rotations.
  • Macro Megaminx.png Macro Megaminx: Display a Megaminx and interactively do slice rotations.

Std FreeCADWebsite.svg Other interesting macros created by FreeCAD users

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

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.