This shows you the differences between two versions of the page.
es:rhino:basicmacros [2020/08/14] 127.0.0.1 external edit |
es:rhino:basicmacros [2023/10/27] (current) noemi |
||
---|---|---|---|
Line 3: | Line 3: | ||
>A basic tutorial on creating macros (scripting together Rhino commands) | >A basic tutorial on creating macros (scripting together Rhino commands) | ||
- | You can create macros in Rhino to automate many tasks, customize your commands, and improve your workflow. | + | You can create |
- | There may be some confusion about the use of the term “scripting” | + | There may be some confusion about the use of the term “scripting”. |
- | The two things are actually very different. Writing functions in RhinoScript or other programming languages is a lot more complex than creating macros, and requires some programming knowledge and skills. | + | //The two things are actually very different.// Writing functions in RhinoScript, Python |
- | I use the term “Macro” here exclusively to describe the putting together of strings of ordinary Rhino commands and their options to create an automated function. | + | I use the term “Macro” here exclusively to describe the putting together of strings of ordinary Rhino commands and their options to create an automated function. |
=====The tools you need===== | =====The tools you need===== | ||
- | Your brain. | + | * Your brain :-P |
+ | * The **Rhino Help file** - lists all Rhino commands and their sub-options. This is your most important reference. | ||
+ | * The Rhino **MacroEditor**, | ||
+ | * An understanding of how to add your macros to your workflow in the form of aliases or toolbar buttons (explained [[developer: | ||
+ | =====You' | ||
+ | First, if you are a user of Rhino, you are already a macro user even though you may not know it. Many of the commands in Rhino are already “macroed” for you. When you click a toolbar button or call a command from the menu, it is often a preset macro. | ||
+ | //(shown: V6 for Windows)// | ||
- | The Rhino Help file - lists all Rhino commands and their sub-options. This is your most important reference. | + | {{: |
- | + | ||
- | The Rhino **MacroEditor**, | + | |
- | + | ||
- | =====You' | + | |
- | First, if you are a user of Rhino, you are already a macro user even though you may not know it. Many of the commands in Rhino are already “macroed” for you. When you click a toolbar button or call a command from the menu, it is often a preset macro. | + | |
- | {{: | + | It just calls the **ExtrudeCrv** command and sets it to make a closed solid. |
- | This is an example of the simplest macro, which sets a series of options within a single command so that you don’t have to specify | + | This is an example of the simplest |
In a sense, you’re doing the same thing as if you clicked or typed the options one at a time at the command line. In fact, that’s all macros really are -- just a set of instructions to repeat a sequence of commands that you would otherwise input manually one at a time. | In a sense, you’re doing the same thing as if you clicked or typed the options one at a time at the command line. In fact, that’s all macros really are -- just a set of instructions to repeat a sequence of commands that you would otherwise input manually one at a time. | ||
Line 62: | Line 63: | ||
! _Box _Center _Pause r5,5 _Enter | ! _Box _Center _Pause r5,5 _Enter | ||
Now that the macro is running, [[rhino: | Now that the macro is running, [[rhino: | ||
+ | |||
+ | > //Note on the Pause command:// | ||
+ | |||
+ | For example the macro below | ||
+ | |||
+ | ! _Polyline _Pause _SelLast | ||
+ | |||
+ | will work fine to make the polyline, but it will not be selected at the end. Why? Because the single Pause is ' | ||
+ | |||
+ | However, the following macro | ||
+ | |||
+ | ! _Polyline _Multipause _SelLast | ||
+ | | ||
+ | works including selecting the polyline at the end because the Multipause includes //all// the picks for the polyline, allowing the SelLast to be executed and work at the end. | ||
=====OK, let’s get a bit more complicated…===== | =====OK, let’s get a bit more complicated…===== | ||
Line 156: | Line 171: | ||
</ | </ | ||
Notice the reference to each individual command option name. Specifying them inside the script is like clicking on them with the mouse. | Notice the reference to each individual command option name. Specifying them inside the script is like clicking on them with the mouse. | ||
+ | |||
+ | **EnterEnd** is a good way to 'back out' of a command without the need to keep track of how many levels deep you've gone - | ||
+ | |||
+ | < | ||
+ | -_Options _Appearance _Visibility _Crosshairs _EnterEnd | ||
+ | </ | ||
Or, if you just use an exclamation point **!** at the end (which in a script means “end now!”), it takes you all the way out regardless of how many sub-levels you're in. Note, if you want to continue your macro with something else, do not use !, use the Enters instead, otherwise your macro will always stop at the ! and terminate. | Or, if you just use an exclamation point **!** at the end (which in a script means “end now!”), it takes you all the way out regardless of how many sub-levels you're in. Note, if you want to continue your macro with something else, do not use !, use the Enters instead, otherwise your macro will always stop at the ! and terminate. | ||
Line 232: | Line 253: | ||
</ | </ | ||
+ | |||
+ | //last edited: 28.08.19/ | ||
**Please feel free to add to or edit this tutorial!** | **Please feel free to add to or edit this tutorial!** | ||
This is a work in progress... | This is a work in progress... | ||