Macros recipes/it

Questa pagina contiene un elenco di macro con cui aggiungere delle funzionalità alla propria installazione di FreeCAD.

Object creation

 * [[Image:Macro_makeCube.png|16px]] Macro MakeCube : creates a cube from 4 points
 * Macro Draw2DFunction: draws a function described by an equation z=F(x)
 * Macro DrawParametric2Dfunction: Based on the above macro, but for parametric and optionally polar equations.
 * 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 Rectellipse: creates a parametric rectellipse
 * [[Image:Macro_Draft_Circle_3_Points.png|16px]] 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).
 * [[Image:Macro_Draft_Circle_3_Points.png|16px]] Macro Draft Circle 3 Points: creates a circle from 3 selected points 2D orthogonal
 * [[Image:Macro_Draft_Circle_3_Points.png|16px]] Macro Draft Circle 3 Points 3D: creates a circle from 3 selected points in the space 3D
 * Macro Screw Maker1_2: This macro creates a screw with or without thread, according to ISO standards (screw_maker1_6.py.zip with Pyside support). (Screw Maker 1.7 - the best so far!)
 * [[Image:Macro_BOLTS.png|16px]] Macro BOLTS: The aim of BOLTS is to build a free and open-source standard parts library for CAD applications.
 * Macro Ellipse Center+2Points Makes an ellipse by selecting three points (in this order): centre, major radius and minor radius
 * Macro Airfoil Import & Scale : Imports and scales a .dat airfoil to desired chord length.
 * Macro 3D Parametric Curve: Draw a function described by parametric equations x(t), y(t) and z(t).
 * Macro Line Length: Create a line giving coordinate XYZ length and angle to plane X Y
 * Macro FCTexture: Create a project from a bmp image to create a texture easily
 * [[Image:FreeCAD Doc.png|16px]] Macro PartsLibrary: Starts the Parts library browser
 * Macro BoundingBox Tracing : This macro red trace (editable) around the BoundingBox with 6 rectangles
 * Involute Gear: allows you to create gear. See InvoluteGearFeature.py in FreeCAD_sf_master.

Object transformation

 * Macro ArrayCopy: copies the selected object several times, on an array grid
 * Macro FlattenWire: flattens draft wires that are not plane to their median Z coordinate
 * Macro MeshToPart: converts selected meshes to parts
 * Macro JointWire: allows to find and joint all non connected edge to the closest non connected one using a line
 * Macro Remove parametric history: removes all parametric associativity from an object, leaving it as a "dumb" shape
 * Macro SuperWire: Forces the creation of a Wire from lines and arcs that don't necessarily touch each other. Use this if normal wire operation fails
 * Macro HealArcs: Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf
 * Macro FaceToSketch: Converts the selected Face to a single Sketch without constraints.
 * Macro EdgesToArc: Converts the selected Edges to a circular Arc if possible. Useful for restoring discretized arcs.
 * Macro CloneConvert: Creates a clone of the object and the converted in the chosen position and size (inch, mm, m, µm...). The base object is recognized in mm (FreeCAd base)

3D View operations

 * Macro Rotate View This macro rotates the current view by 90° to the left. Only works if you are in Top view.
 * Macro View Rotation Provides a GUI to permit rotation of view by precise amounts in all three directions.
 * Macro Texture Objects This macro allows you to temporarily put a texture image on the selected objects.
 * Macro Mouse Cross This small macro turns the arrow of the mouse in a precision cross
 * Macro Align ViewToFace This macro aligns the current view to a selected face

Wizards

 * Macro Automatic Drawing: allows the user to get the view of his object in a drawing with 4 different position(front,top,iso,right). Need some modification to be perfecly effective
 * 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 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: (Full field edition for this Templates) This GUI macro to fill simply all fields of the cartridge model 1 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: (Full field edition for this Templates) This GUI macro to fill simply all fields of the cartridge model 2 of the plan implementation worksheet FreeCAD.
 * Macro UnrollRuledSurface: allows to unroll ruled surfaces and to draw them on a page.
 * Macro UnfoldBox: allows to unfold the surfaces of a box of any shape and to draw them on a page.

Utility

 * Macro MessageBox: shows how to give information to the user through the GUI.
 * [[Image:FCInfo.png|16px]] 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
 * [[Image:FCInfo.png|16px]] Macro FCInfo Alternate Linux : same as above, but for Linux
 * Macro 3D Printer Slicer: Exports current design to slicer software or CAM software.
 * Macro Delta xyz : Gives the Delta values and the distance between 2 points
 * Macro CenterFace : This macro red trace (editable) the center face (mass) with 1 point and print the coordinates
 * ObjectInfo: User-friendly "Info" module created by a FreeCAD user
 * MacroMenu: Add the macros found in the macros folder to the Macros menu of FreeCAD

Come utilizzare le macro
Le macro di cui sopra possono essere facilmente inserite in qualsiasi installazione di FreeCAD:
 * Copiare il codice python della macro dalla pagina della macro corrispondente
 * In FreeCAD selezionare Macro-> Macro-> Crea nuova e assegnare un nome
 * Incollare il codice python copiato
 * Premere il pulsante Salva e riavviare FreeCAD
 * Aprire il gestore delle Macro, selezionare la nuova macro e fare clic su "Esegui"

Inoltre, è anche possibile aggiungere la nuova macro a una barra degli strumenti personalizzata
 * In FreeCAD, andare in Strumenti -> Personalizza
 * Nella scheda Macro, aggiungere una nuova macro, e, volendo, definire un'icona e una scorciatoia da tastiera
 * Nella scheda Barre degli strumenti, creare una nuova barra degli strumenti, e aggiungere le macro selezionandole nella categoria "Macro".

Aggiungere nuove macro a questo repository

 * Creare una nuova pagina il cui nome inizi con "Macro", per esempio "Macro_My_Excellent_Macro". Questo si può fare modificando semplicemente la presente pagina, e aggiungendo un nuovo collegamento alla macro, ad esempio: "Macro My Excellent Macro: My excellent macro" . L'operazione crea una nuova pagina (link rosso).
 * Nella pagina appena creata, incollare il seguente testo:

Esempio con icona di default: Esempio con icona personalizzata: In altra lingua, con icona di default, ad esempio "/fr" "/de" "/it": In altra lingua, con icona personalizzata, ad esempio "/fr" "/de" "/it": Ricordare che l'icona deve avere lo stesso nome della macro.
 * Si può anche caricare una icona personalizzata in formato .png
 * esempio : " Macro_My_Excellent_Macro " senza estensione (l'estensione viene fornita dal sistema), e, sostituire " Icon=Text-x-python " con " Icon=Macro_My_Excellent_Macro "
 * Text-x-python [[Image:Text-x-python.png|32px]] è l'icona di default della pagina dedicata alle Macro.


 * Incollare la macro, e utilizzare le etichette per il testo preformattato del wiki   per evitare di aggiungere spazi nello script. La macro viene visualizzata  in un font a spaziatura fissa all'interno di un riquadro di colore grigio chiaro come nell'esempio precedente.
 * Opzionalmente è possibile aggiungere ancora delle informazioni su come utilizzare la macro, consigli, limitazioni e trucchi.
 * Aggiungerla a una delle categorie di cui sopra, oppure creare una nuova categoria, se è necessario.
 * 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:

Aggiungerla alle categorie di cui sopra, o creare una nuova categoria, se è necessario.