Macros recipes/cs: Difference between revisions

From FreeCAD Documentation
(Created page with "* {{MacroLink/cs|Macro_makeCube|Macro makeCube|Macro makeCube}} : vytváří kostku ze 4 bodů * {{MacroLink/cs|Text-x-python|Macro Solid Sweep|Macro Solid Sweep}}: vytváří...")
(Created page with "===File:Workbench_PartDesign.svg Transformace objektu===")
Line 113: Line 113:


<div class="toccolours mw-collapsible mw-collapsed">
<div class="toccolours mw-collapsible mw-collapsed">
===[[File:Workbench_PartDesign.svg]] Object transformation===
===[[File:Workbench_PartDesign.svg]] Transformace objektu===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
* {{MacroLink|Text-x-python|Macro ArrayCopy|Macro ArrayCopy}}: copies the selected object several times, on an array grid
* {{MacroLink|Text-x-python|Macro ArrayCopy|Macro ArrayCopy}}: copies the selected object several times, on an array grid

Revision as of 13:43, 27 January 2017

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

Tato stránka obsahuje makra pro rozšíření funkcionality Vaší instalace FreeCADu.

Makra

Operace s 3D pohledy

Animation

Code and Scripting

Conversion

Drawing Workbench

  • Template:MacroLink/cs: umožňuje uživateli získat pohled na objekt ve výkresu ve 4 různých pozicích (zepředu, shora, iso a zprava). Aby bylo dokonale efektivní, potřebuje ještě pár úprav.

Dxf 2D Draft

  • Template:MacroLink/cs: vytváří parametrický elipsový obdélník
  • Template:MacroLink/cs: vytváří kružnici podle 3 vybraných bodů, body mohou být objekty (tento příklad spojuje dva následující příklady, všechny parametry jsou uspořádány v grafickém okně).
  • Template:MacroLink/cs: vytváří kružnici podle 3 vybraných bodů v kolmých 2D
  • Template:MacroLink/cs: vytváří kružnici podle 3 vybraných bodů ve 3D prostoru
  • Template:MacroLink/cs: Pokud je to možné, konvertuje vybrané hrany do kružnicového oblouku. Užitečné pro obnovení rozlámaného oblouku.

Fem

  • Macro GMSH: Create FEM Meshes by GMSH Mesh Generator

Info and measures

  • Template:MacroLink/cs: dodá řadu informací o vybraném tvaru a může zobrazovat konverzi délky, sklonu (stupně, radiány) tvaru, povrch, objem a váhu tvaru v mezinárodních i anglosaských jednotkách.
  • Template:MacroLink/cs: dodá hodnotu Delta (úhel) a vzdálenost mezi 2 body.

Libraries

  • Template:MacroLink/cs: toto makro vytváří šroub s nebo bez závitu podle ISO standardů.
  • Template:MacroLink/cs: cílem BOLTSu je vybudovat bezplatnou open-source knihovnu standardních dílů pro CAD aplikace.

Mathematical functions

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.

Vytvoření objektu

  • Template:MacroLink/cs : vytváří kostku ze 4 bodů
  • Template:MacroLink/cs: vytváří těleso tažením 2D profilu po trajektorii předem vybrané ve 3D pohledu. 2D prvek může být vytvořen standardními nástroji GUI FreeCADu.

Transformace objektu

  • Macro ArrayCopy: copies the selected object several times, on an array grid
  • Macro FlattenWire: flattens draft wires that are not planar to their median Z coordinate
  • Macro FlattenWire3Points: flattens draft wires that are not planar to a plane defined by 3 points
  • Macro 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 CloneConvert‎: Creates a clone of the object and the converted in the chosen position and size (inch, mm, m, µm...). The base object is recognized in mm (FreeCAd base)
  • Macro Image Scaling: Macro for easy scaling drawings, graphics, diagram, blueprint and similar 2D images in Image workbench.
  • Macro MatrixTransform: apply linear space transformations to distort shapes. E.g., non-uniform scaling, shearing, mirroring, axes swapping.
  • Macro Connect And Sweep: 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
  • Macro Section: (parametric): alternative implementation of Part Section tool, more suitable for making sweep paths.
  • Macro Overlap: (parametric): Boolean operation. Similar to Part Common, but with custom overlap count threshold.

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.

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 create by FreeCAD users and deposit in extra wiki.

  • By microelly2 : freeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, ..... other
  • By hamish2014: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, ...
  • By triplus: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, ....
  • By rockn: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, .... other
  • By oddtopus: flamingo (workbench for metal structures)

How to use?

Macro how to install
Macro how to install

The above macros can easily be plugged on any FreeCAD installation

  • 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

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:
    • example :
* {{MacroLink|Text-x-python|Macro My Excellent Macro|Macro My Excellent Macro title}} : My excellent macro description.
  • 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)

{{Macro|Icon=Text-x-python|Name=Macro_My_Excellent_Macro|Description=What my excellent macro does|Author=your username|Version=1.0}}

(With the icon custom)

{{Macro|Icon=Macro_My_Excellent_Macro|Name=Macro_My_Excellent_Macro|Description=What my excellent macro does|Author=your username|Version=1.0}}

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

{{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}}

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

{{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}}
  • You can also Upload a custom format icon.png
    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 is the default icon of the page dedicated to the Macro.
  • Paste your macro, and use the 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:

#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 Plugin Loader program to install the macro and check versions. Also available addons_installer.FCMacro

Ex:

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

__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.

Tutorials