Calling Python custom scripts with Buttons and Aliases
✨ In this article, I demonstrate how to simplify your workflow when modelling a generic object within Rhino… using custom buttons and aliases.
It is more likely that many of you will already know that Rhinon’s flexibility in customizing its UI is one of its greatest strengths. In fact, through the methods that I will illustrate in the video at the bottom of this page, you will be able to quickly recall, through a button or through an alias (this is my favourite method) a Python script that you have coded specifically to perform any repetitive action that you would otherwise have to perform manually.
The actions in the video show two Python scripts I have created personally.
In the first case, the first script will allow you to mirror an object through a Median Axis defined by the user — (“Mirror_Between.py”); in the second example instead, I will run a script that will allow you to mirror the object-based on its axis of symmetry (X, Y, Z) — (“Mirror_Symmetrical.py”).
Mirror_Between script
This simple script lets to perform a mirror operation by providing a median axis as input, obtained by selecting two extreme points. The script also applies to a multiple selection of objects.
Mirror_Symmetrical script
This simple script lets to perform a mirror operation by selecting one object-symmetry axes (X, Y, Z). The script also applies to a multiple selection of objects.
Button creation
Mouse-right click on the Rhino toolbar > New Button… > (fill in the content as described in the video demo)
Aliases creation
Rhino Options > Aliases > (fill in the content as described in the video demo)
For aliases in the command macro area, brackets must not be inserted. Very important, in this case, is to insert in quotes exactly the name of the Python file (.py) with your custom code/script.
Video demo
if you watch it on my YouTube channel it is possible to jump among different highlights 😉