Macros recipes/cs: Difference between revisions

From FreeCAD Documentation
mNo edit summary
(Updating to match new version of source page)
Line 13: Line 13:
===[[File:Part_CheckGeometry.svg]] Operace s 3D pohledy===
===[[File:Part_CheckGeometry.svg]] Operace s 3D pohledy===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
<div class="mw-translate-fuzzy">
* {{MacroLink|Text-x-python|Macro Rotate View|Macro Rotate View}}: This macro rotates the current view by 90° to the left. Only works if you are in Top view.
* {{MacroLink|Text-x-python|Macro View Rotation|Macro View Rotation}}: Provides a GUI to permit rotation of view by precise amounts in all three directions.
* {{MacroLink/cs|Text-x-python|Macro Rotate View|Macro Rotate View}} toto makro otáčí aktuální pohled o 90° doleva. Funguje pouze u pohledu shora.
* {{MacroLink|Text-x-python|Macro Texture Objects|Macro Texture Objects}}: This macro allows you to temporarily put a texture image on the selected objects.
* {{MacroLink/cs|Text-x-python|Macro View Rotation|Macro View Rotation}} poskytuje GUI pro povolení otáčení pohledu o přesnou velikost ve všech třech směrech.
* {{MacroLink|Text-x-python|Macro Mouse Cross|Macro Mouse Cross}}: This small macro turns the arrow of the mouse in a precision cross.
* {{MacroLink/cs|Text-x-python|Macro Texture Objects|Macro Texture Objects}} toto makro umožňuje vložit dočasně texturu do vybraných objektů.
* {{MacroLink|Text-x-python|Macro Align View to Face|Macro Align View to Face}}: This macro aligns the current view to a selected face.
* {{MacroLink/cs|Text-x-python|Macro Mouse Cross|Macro Mouse Cross}} toto malé makro mění šipku kurzoru myši na jemný křížek.
</div>
* {{MacroLink|Text-x-python|Macro Align Object to View|Macro Align Object to View}}: This macro align the selected object to the current View and set the coordinates Placement of the camera.
* {{MacroLink|Text-x-python|Macro Align Camera to Working Plane|Macro Align Camera to Working Plane}}: This macro aligns the camera to the current [[Draft SelectPlane|Draft Working Plane]]
* {{MacroLink|Text-x-python|Macro Align Working Plane to Camera|Macro Align Working Plane to Camera}}: This macro moves the current [[Draft SelectPlane|Draft Working Plane]] to the center of the current view
* {{MacroLink|Text-x-python|Macro Align Face Object to View|Macro Align Face Object to View}}: This macro align the face of the selected object to the current View (in case face hole the hole is placed to the view).
* {{MacroLink|Macro_Toggle_Views_Visibility|Macro Toggle Panels Visibility|Macro Toggle Panels Visibility}}: This macro toggles the visibility of various supporting panels in FreeCAD, allowing the main window to be viewed with all available screen space.
* {{MacroLink|FCCamera_00|Macro FCCamera|Macro FCCamera}}: This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen to create a form in the specified plan positions the selected face facing the screen, to detect the position of the camera ...
* {{MacroLink|Macro SelectVisible|Macro_Toggle_Visibility|Macro Toggle Visibility}}: Set of three macro, macro '''1:''' hidden the objects not selected, macro '''2:''' displayed alls objects, macro '''3:''' hidden alls objects.
* {{MacroLink|Macro SelectVisible2|Macro_Toggle_Visibility2|Macro Toggle Visibility2}}: Set of two macro, macro '''1:''' hidden the objects not selected, macro '''2:''' displayed alls objects, macro with the original visibility.
* {{MacroLink|SelectVisible|Macro SelectVisible|Macro SelectVisible}}: All visible objects in the tree will be selected.
* {{MacroLink|Text-x-python|Macro Manage Navigational Style|Macro Manage Navigational Style}}: This pair of macros allow you to alter the Navigation Style while in the Sketcher.
* {{MacroLink|Text-x-python|Macro Duplicate Selection|Macro Duplicate Selection}}: This macro testing if one selection are duplicate , select the object IN THE 3D VIEW the "ForbiddenCursor" stay if the or one selection is duplicate, the macro stay resident.
* {{MacroLink|Macro_Copy3DViewToClipboard|Macro Copy3DViewToClipboard|Macro Copy3DViewToClipboard}}: Copy contents of 3DView resized 640, 480 px to clipboard .
* {{MacroLink|Macro Perpendicular To Wire|Macro Perpendicular To Wire|Macro Perpendicular To Wire}}: This macro positioned your object perpendicularly to wire selected.
* {{MacroLink|Macro Rotate To Point|Macro Rotate To Point|Macro Rotate To Point}}: Macro for rotate on object on itself with the axis of rotation the boundbox center, center of mass or last point clicked
* {{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.
</div>
</div>
</div>
</div>
Line 47: Line 33:
* {{MacroLink|Text-x-python|Macro Assemblage Imprimante 3D|Macro Assemblage Imprimante 3D}}: Simulation of movements of a 3D printer
* {{MacroLink|Text-x-python|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|expression]] for associate many wires and simulate or verify the movement. Here the circle rotation create the movement for all objects connected
* {{MacroLink|Text-x-python|Macro Constraint Draft|Constraint Draft}}: Simple example animation Draft wires by use the [[Expressions|expression]] for associate many wires and simulate or verify the movement. Here the circle rotation create the movement for all objects connected
* {{MacroLink|Text-x-python|Macro Rubik Cube|Macro Rubik Cube}}: Display a Rubik Cube and interactively do slice rotations.
</div>
</div>
</div>
</div>
Line 68: Line 55:
===[[File:Drawing-orthoviews.svg]] Drawing Workbench===
===[[File:Drawing-orthoviews.svg]] Drawing Workbench===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
<div class="mw-translate-fuzzy">
* {{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|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/cs|Text-x-python|Macro Automatic drawing|Macro Automatic drawing}}: 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.
</div>
* {{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|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|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
</div>
</div>
</div>
</div>
Line 133: Line 118:
===[[File:Workbench_Image.svg]] Vytvoření objektu===
===[[File:Workbench_Image.svg]] Vytvoření objektu===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
<div class="mw-translate-fuzzy">
* {{MacroLink/cs|Macro_makeCube|Macro makeCube|Macro makeCube}} : vytváří kostku ze 4 bodů
* {{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áří 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.
* {{MacroLink/cs|Text-x-python|Macro Solid Sweep|Macro Solid Sweep}}: 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.
</div>
</div>
</div>
</div>
</div>


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

===[[File:Workbench_PartDesign.svg]] Transformace objektu===
===[[File:Workbench_PartDesign.svg]] Transformace objektu===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Line 168: Line 156:
<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|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|Text-x-python|Macro SpreadsheetTools|Macro Spreadsheet Tools}}: This macro helps managing cells inside FreeCAD Spreadsheet workbench.
</div>
</div>
</div>
</div>


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

===[[File:Arch_Survey.svg]] Utility===
===[[File:Arch_Survey.svg]] Utility===
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
Line 186: Line 176:
* {{MacroLink|HighlightDifference|Macro HighlightDifference|Macro HighlightDifference}}: Compute the difference between two shapes.
* {{MacroLink|HighlightDifference|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|Text-x-python|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|BoundBoxTracing|Macro BoundingBox Tracing|Macro BoundingBox Tracing}}: This macro red trace (editable) around the BoundingBox with 6 rectangles
* {{MacroLink|BoundBoxTracing|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 Perpendicular To Wire|Macro Perpendicular To Wire|Macro Perpendicular To Wire}}: This macro positioned your object perpendicularly to wire selected.
* {{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 Perpendicular To Wire|Macro Perpendicular To Wire|Macro Perpendicular To Wire}}: This macro positioned your object perpendicularly to wire selected.
Line 219: Line 210:
== Použití ==
== Použití ==
[[File:Macro Recipes MacroHowToInstall.png|200px|left|Macro how to install]]
[[File:Macro Recipes MacroHowToInstall.png|200px|left|Macro how to install]]
<div class="mw-translate-fuzzy">
'''The above macros can easily be plugged on any FreeCAD installation'''
Výše uvedená makra mohou být snadno vložena do jakékoliv instalace FreeCADu
* 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.
* Zkopírujte Python kód makra z příslušné stránky
* Copy the macro python code from the corresponding macro page
* In FreeCAD, Macro->Macros->Create new, and give it a name
* Ve FreeCADu, Makro->Makra->Nové, a dejte mu jméno
* Vložte zkopírovaný kód
* Paste the python code you copied
* Hit the Save button, and restart FreeCAD
* Stiskněte tlačítko Save (Uložit) a restartuje FreeCAD
* Open the Macro manager, select your new macro and click "execute"
* Otevřete Správce maker, vyberte nové makro a klikněte na "execute" (Spusť)
</div>
* Tutorial [[How to install macros]]


Navíc můžete nové makro přidat i na Váš uživatelský nástrojový pruh
Navíc můžete nové makro přidat i na Váš uživatelský nástrojový pruh

Revision as of 21:03, 25 January 2018

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

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.

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

  • Template:MacroLink/cs: několikrát zkopíruje objekt do mřížkového pole
  • Template:MacroLink/cs: srovná nakreslené dráty (lomené čáry), které nejsou v jedné rovině, do jejich střední souřadnice Z
  • Template:MacroLink/cs: umožňuje najít a spojit všechny nespojené hrany do uzavřeného nespojeného drátu pomocí přímek
  • Template:MacroLink/cs: odstraní z objektu všechny parametrické asociativity a ponechá objekt jako samostatný tvar
  • Template:MacroLink/cs: dodělá vytvoření drátu z přímek a oblouků, které se nemusejí vzájemně dotýkat. Použijte tehdy, pokud normální funkce selže.
  • Template:MacroLink/cs: Oblouky jsou někdy transformovány do B-křivek, například, když se změní měřítko. Toto makro z toho znovuvytvoří platný oblouk. Je to užitečné před exportem do dxf.

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 SpreadsheetTools: This macro helps managing cells inside FreeCAD Spreadsheet workbench.

Utility

Wizards

  • Template:MacroLink/cs: umonžuje rozbalit sbalené povrchy a nakreslit je na stránku.
  • Template:MacroLink/cs: umožňuje rozložit povrchy krabice jakéhokoliv tvaru a nakreslit je na stránku.
  • Template:MacroLink/cs: Imports and scales a .dat airfoil to desired chord length.
  • Template:MacroLink/cs: zobrazí vyskakovací dialogové okno pro zadání rozměrů rohového dílu a potom vytvoří v dokumentu objekt a vytvoří stránku s pohledy shora, zepředu a z boku dílu.

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)
  • 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 ...


Použití

Macro how to install
Macro how to install

Výše uvedená makra mohou být snadno vložena do jakékoliv instalace FreeCADu

  • Zkopírujte Python kód makra z příslušné stránky
  • Ve FreeCADu, Makro->Makra->Nové, a dejte mu jméno
  • Vložte zkopírovaný kód
  • Stiskněte tlačítko Save (Uložit) a restartuje FreeCAD
  • Otevřete Správce maker, vyberte nové makro a klikněte na "execute" (Spusť)

Navíc můžete nové makro přidat i na Váš uživatelský nástrojový pruh

  • Ve FreeCADu, jděte na Nástroje -> Uživatelský
  • Ve záložce Makra přidejte nové makro a pokud chcete definujte jeho ikonu a klávesovou zkratku
  • V záložce Nástrojové pruhy vytvořte nový nástrojový pruh a přidejte Vaše nové makro přetáhnutím jej z kategorie "Makra".


Přidání nového makra do tohoto repozitáře

  • Vytvořte nové makro, jehož jméno bude začínat na "Macro", například"Macro_My_Excellent_Macro" (to může být snadno provedeno úpravou této stránky a přidáním nového odkazu na makro), například takto:
* {{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:

(S defaultní ikonou)

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

(S uživatelskou ikonou)

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

(Jiný jazyk s defaultní ikonou (například "/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|Date=YYYY-MM-DD}

(Jiný jazyk s uživatelskou ikonou (například "/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|Date=YYYY-MM-DD}}
  • Můžete také Uploadovat uživatelský formát ikony .png
    Mějte na paměti, že jméno ikony musí být přesně stejné jako je jméno makra.
    • příklad : " Macro_My_Excellent_Macro " bez přípony (přípona je daná systémem), a přepište " Icon=Text-x-python " novým jménem " Icon=Macro_My_Excellent_Macro "
    • Text-x-python je defaultní ikona na stránce věnované Makru.
  • Vložte makro a použijte <syntaxhighlight> váš kód ...</syntaxhighlight> pro přeformátování textu pomocí těchto wiki značek, abyste se vyhnuli přidávání mezer do Vašeho skriptu. Tím se vaše makro zobrazí ve fontu monospace uvnitř světlešedého rámečku jak je v příkladě nahoře.
  • Chcete-li, můžete uploadovat .png ikonu se stejným jménem jako je Vaše makro (např. Macro_My_Excellent_Macro.png)
  • Volitelně můžete přidat ještě nějaké další informace jak makro používat, tipy, omezení a práce na něm.
  • Je také zajímavé začlenit do makra informace o verzi. Takové makro Vám pak umožní definovat jeho pozici v čase při porovnávání s vývojem FreeCADu, vyberte "Menu > Pomoc > O FreeCADu a klikněte na Kopie do clipboardu" a vložte to do vašeho makra

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

Tutorials