Pretty Poly Editor Documentation
I. PPE Manual - 9. Personalizing, Macros and Scripts - b Macros
Under construction!
This page does not reflect the current state of PPE or vice versa :-),
so read at your own risk!
In the last topic, we saw that PPE stores commands in the
log-files and reads them from the startup-file. In this
topic we will see that it can store/read from arbitrary files
and that you can bind macros to keys so that you can call
them very fast.
Lets do an example. Lets say we want to do "babushka dolls",
that is have 10 dolls, the first inside the second, the second inside
the third etc. If you don't have the model for a doll, you can use
any other model, for example *******.
The aim is to input the repetitive commands once and bind them to a
key.
Then you only have to press nine times this key and you are done.
Before doing such a task you should think about several things.
Which commands are repetitive?
In this example, for each of the dolls, we have to shrink it and load
the next doll.
Where to start?
We could have also used load next doll and shrink it (start one
command earlier/later)
What state of PPE does the macro need?
Cursor?****
While reading this, try:
-
Open the model.
-
The next steps will already belong to the repetitive ones.
So, choose file/start macro recording from the viewer-menu.
-
Shrink the model by scaling it with factor of, say 0.85
-
Merge the next model into the scene by using file/merge model.
-
We are done with one repetition, so say file/stop macro recording.
PPE will ask you what to do with the macro. Tell it we want to bind it
(not permanently) to a key, lets say the key "t".
BTW, while recording the macro, we have already done the first
repetition.
So, if we want 10 repetitions, we only have to use the macro 9 times
-
Press "t" once. You will see that one model is added, in the
correct size.
-
Press "t" as often as you like (probably 8 more times).
So, you saw that all the commands that the user submits between
"start macro recording" and "stop macro recording",
are recorded. After "stop macro recording", you are asked what to do
with the recorded commands. You can
-
Save them into a file. This can later be used through "load macro".
-
Bind them to a key. This can be either permanently or just for the
current session. For example, if you are the designer of a babushka factory,
you might bind the macro permanently, since you will need it many more times.
-
Use the macro straight away n times. We could have done that in the above example,
and write "9" into the "use ... times"-field. The reason I used the bind-to-key
in the example instead, is that you see each call of the macro and therefore it is easier to see whats going on.
However, if a PPE-expert would have to do the 10 dolls, he would probably use the "use ... times"-option.
-
Put into Clipboard. Lets say, you want to see whether the scaling-factor 0.85 or 0.75 is better.
You would then use the feature, that the operations you can do with the macro are not exclusive, you may use several at once.
In this instance, you would use the macro 9 times straight away to get the dolls with
a factor of 0.85 AND you would say put into clipboard. You then open your favorite
ASCII-editor, create a new document and paste from the clipboard. You can now change the 0.85 into
a 0.75 and save the macro. You would start this macro with the menu-item "load macro".
Macrodebug mode can be used to debug macros or scripts.
All the PPE-commands that are executed from a macro or script
are displayed. Please note that in a script, "normal" python commands,
for example assignment to a variable or a for-statement
are not displayed. The command is displayed before it is executed.