Macros/de: Difference between revisions

From FreeCAD Documentation
m (ad all languages flags)
(Updating to match new version of source page)
Line 1: Line 1:
Macros are a convenient way to create complex actions in FreeCAD. You simply record actions as you do them, then save that under a name, and replay them whenever you want. Since macros are in reality a list of python commands, you can also edit them, and create very complex scripts.
Makros sind eine bequeme Möglichkeit, komplexe Aktionen in FreeCAD zu bewältigen. Sie können einfach Aktionen nach Belieben aufzeichnen, unter einem Namen speichern und diese jederzeit wieder abspielen. Da ein Makro in Wirklichkeit eine Liste aus Python-Befehlen ist, können Sie sie auch bearbeiten und sehr komplexe Skripte erstellen.


===Wie es funktioniert===
===How it works===
If you enable console output (Menu Edit -> Preferences -> General -> Macros -> Show scripts commands in python console), you will see that in FreeCAD, every action you do, such as pressing a button, outputs a python command. Thos commands are what can be recorded in a macro. The main tool for making macros is the macros toolbar: [[Image:Macros_toolbar.jpg]]. On it you have 4 buttons: Record, stop recording, edit and play the current macro.


It is very simple to use: Press the record button, you will be asked to give a name to your macro, then perform some actions. When you are done, click the stop recording button, and your actions will be saved. You can now access the macro dialog with the edit button:
Wenn Sie die Ausgabe in der Konsole aktivieren (Menü Bearbeiten -> Einstellungen -> Allgemein -> Makros -> Script Befehle in Python-Konsole anzeigen), werden Sie sehen, dass jede Aktion die Sie in FreeCAD vornehmen, wie z.B. das Drücken einer Taste, den entsprechenden Python-Befehl ausgibt. Genau diese Befehle sind es, die auch in einem Makro aufgezeichnet werden. Das wichtigste Werkzeug zur Erstellung von Makros ist die Makro-Symbolleiste: [[Image:Macros_toolbar.jpg]].<br>
Darauf haben Sie 4 Knöpfe: '''Aufnahme''', '''Beenden der Aufnahme''', '''Bearbeitung''' und '''Wiedergabe des aktuellen Makros'''.


[[Image:Macros.jpg]]
Sie ist sehr einfach zu bedienen: Drücken Sie die '''Aufnahme'''taste. Nun werden Sie aufgefordert einen Namen für Ihr Makro zu vergeben, dann führen Sie einige Aktionen aus. Wenn Sie fertig sind, klicken Sie auf die Schaltfläche '''Aufzeichnung beenden''', und Ihre Aktionen werden gespeichert. Zum Bearbeiten klicken Sie nun auf den Makro-Dialog mit der Schaltfläche '''Bearbeiten''':


There you can manage your macros, delete, edit or create new ones from scratch. If you edit a macro, it will be opened in an editor window where you can make changes to its code.
[[Image:Macros-DE.png]]


===Example===
Dort können Sie Ihre Makros verwalten, löschen, bearbeiten oder von Grund auf neue erstellen. Wenn Sie ein Makro bearbeiten, wird es in einem Editor-Fenster geöffnet, wo Sie Änderungen an seinem Code vornehmen können.
Press the record button, give a name, let's say "cylinder 10x10", then, in the [[Part Workbench]], create a cylinder with radius = 10 and height = 10. Then, press the "stop recording" button. In the edit macros dialog, you can see the python code that has been recorded, and, if you want, make alterations to it. To execute your macro, simply press the execute button on the toolbar while your macro is in the editor. You macro is always saved to disk, so any change you make, or any new macro you create, will always be available next time you start FreeCAD.


===Beispiel===
===Customizing===
Of course it is not practical to load a macro in the editor in order to use it. FreeCAD provides much better ways to use your macro, such as assigning a keyboard shortcut to it or putting an entry in the menu. Once your macro is created, all this can be done via the Tools -> Customize menu:


[[Image:Macros config.jpg]]
Drücken Sie die Aufnahmetaste, geben Sie einen Namen ein, z. B. "Zylinder 10x10", anschließend erstellen Sie in der [[Part Workbench]] einen Zylinder mit Radius = 10 und Höhe = 10. Dann drücken Sie den "Aufnahme beenden"-Knopf. Im Bearbeiten-Dialog von Makros können Sie den Python-Code sehen der aufgezeichnet wurde, und wenn Sie wollen, können Sie daran Änderungen vornehmen. Um ein Makro auszuführen, drücken Sie einfach auf die Schaltfläche Ausführen in der Symbolleiste, während Ihr Makro im Editor angezeigt wird. Ihre Makros werden immer auf der Festplatte gespeichert, so dass jede Änderung die Sie machen, oder ein Makro das Sie neu erstellen, immer beim nächsten Start von FreeCAD verfügbar sein wird.


This way you can make your macro become a real tool, just like any standard FreeCAD tool. This, added to the power of python scripting within FreeCAD, makes it possible to easily add your own tools to the interface. Read on to the [[Scripting]] page if you want to know more about python scripting...
===Anpassen===


===Creating macros without recording===
Natürlich ist es nicht praktisch vor dem Benutzen immer erst ein Makro in den Editor zu laden. FreeCAD bietet deutlich bessere Möglichkeiten um Ihr Makro zu verwenden, wie das Zuweisen einer Tastenkombination oder einen Eintrag im Menü erstellen. Sobald Ihr Makro erstellt wurde, können Sie dies erledigen im Menü: Tools -> Benutzerdefiniert:
You can also directly copy/paste python code into a macro, without recording GUI action. Simply create a new macro, edit it, and paste your code. You can then save your macro the same way as you save a FreeCAD document. Next time you start FreeCAD, the macro will appear under the "Installed Macros" item of the Macro menu.


===Macros repository===
[[Image:Macros-config-DE.png]]
Visit the [[Macros recipes]] page to pick some useful macros to add to your FreeCAD installation.


{{docnav|Image Module|Introduction to python}}
Auf diesem Weg können Sie Ihr Makro zu einem echten Werkzeug machen, wie jedes Standard-FreeCAD-Werkzeug. Dies, kombiniert mit der Macht von Python-Scripting innerhalb von FreeCAD, macht es leicht möglich, Ihre eigenen Werkzeuge in die Oberfläche einzubinden. Lesen Sie auf der [[Scripting]]-Seite, wenn Sie mehr über Python-Scripting wissen wollen ...
[[Category:Poweruser Documentation]]


{{clear}}
===Erstellen von Makros ohne Aufzeichnung===
<languages/>

Sie können Python-Code auch direkt in ein Makro kopieren/einfügen, ohne Aufzeichnung von Aktionen. Erstellen Sie einfach ein neues Makro, bearbeiten Sie es, und fügen Sie den Code ein. Anschließend können Sie das Makro genau wie ein FreeCAD Dokument speichern. Beim nächsten Start von FreeCAD wird das Makro unter dem "Installierte Makros"-Punkt des Makro-Menü angezeigt.

===Makros Fundgrube===

Besuchen Sie die [[Macros recipes]] Seite, um sich einige nützliche Makros holen, um diese Ihrer FreeCAD Installation hinzuzufügen.

{{docnav/de|Image Module/de|Einführung in Python}}

{{languages/de | {{en|Macros}} {{cn|Macros/cn}} {{es|Macros/es}} {{fr|Macros/fr}} {{it|Macros/it}} {{jp|Macros/jp}} {{pl|Macros/pl}} {{ru|Macros/ru}} {{se|Macros/se}} }}

[[Category:Poweruser Documentation/de]]

Revision as of 21:41, 18 February 2014

Macros are a convenient way to create complex actions in FreeCAD. You simply record actions as you do them, then save that under a name, and replay them whenever you want. Since macros are in reality a list of python commands, you can also edit them, and create very complex scripts.

How it works

If you enable console output (Menu Edit -> Preferences -> General -> Macros -> Show scripts commands in python console), you will see that in FreeCAD, every action you do, such as pressing a button, outputs a python command. Thos commands are what can be recorded in a macro. The main tool for making macros is the macros toolbar: . On it you have 4 buttons: Record, stop recording, edit and play the current macro.

It is very simple to use: Press the record button, you will be asked to give a name to your macro, then perform some actions. When you are done, click the stop recording button, and your actions will be saved. You can now access the macro dialog with the edit button:

There you can manage your macros, delete, edit or create new ones from scratch. If you edit a macro, it will be opened in an editor window where you can make changes to its code.

Example

Press the record button, give a name, let's say "cylinder 10x10", then, in the Part Workbench, create a cylinder with radius = 10 and height = 10. Then, press the "stop recording" button. In the edit macros dialog, you can see the python code that has been recorded, and, if you want, make alterations to it. To execute your macro, simply press the execute button on the toolbar while your macro is in the editor. You macro is always saved to disk, so any change you make, or any new macro you create, will always be available next time you start FreeCAD.

Customizing

Of course it is not practical to load a macro in the editor in order to use it. FreeCAD provides much better ways to use your macro, such as assigning a keyboard shortcut to it or putting an entry in the menu. Once your macro is created, all this can be done via the Tools -> Customize menu:

This way you can make your macro become a real tool, just like any standard FreeCAD tool. This, added to the power of python scripting within FreeCAD, makes it possible to easily add your own tools to the interface. Read on to the Scripting page if you want to know more about python scripting...

Creating macros without recording

You can also directly copy/paste python code into a macro, without recording GUI action. Simply create a new macro, edit it, and paste your code. You can then save your macro the same way as you save a FreeCAD document. Next time you start FreeCAD, the macro will appear under the "Installed Macros" item of the Macro menu.

Macros repository

Visit the Macros recipes page to pick some useful macros to add to your FreeCAD installation.

Image Module
Introduction to python