Embedding python functions into toolbar

Hi, I am written a function that will take a list of points and pipe diameter and create a pipe with a certain fillet radius. This is all contained within my .py file that I run from Rhino Python Editor. I am no looking at making this function more useable and create a tile on the toolbar that runs this function. How do I put my custom functions onto the toolbar.

Hi Daniel

First how to add a new button:
https://docs.mcneel.com/rhino/5/help/en-us/toolbarsandmenus/toolbar_button_editor.htm

Next the macro to put on the button can be either the full script like so:

! _NoEcho _-RunPythonScript (
<<python code here>>>
)

Or run the script from a file:

! _-RunPythonScript "G:\myscripts\dothis.py"

This way you can edit the script and the button does not need to be updated.

Another option would be to create an Alias in the options with the macro like the example above
You can than use the alias command on the button or type it in the commandline.

Does this help?

1 Like