Calling different functions from a single python file

python

#1

Looking for a better way to do this:

I’m trying to create a Toolbar Menu Dropdown with preset layers. I have about 100 of these buttons, each loading just one layer of choice.

Currently, I’m using Rhino Buttons within the toolbar to run python scipts with -_RunPythonScript somefile.py 0 where the integer is then passed into the script with rs.GetInteger and then executes whichever function is associated with that integer.

Though this is working, I’m interested to see if theres a more efficient way of doing this. Preferably, one that does not add Text: 0 to the command line each time.


(Dale Fugier) #2

Hi Tim,

Precede your command macro with NoEcho. For example:

_NoEcho _-RunPythonScript (
import rhinoscriptsyntax
rhinoscriptsyntax.MessageBox('Hello Rhino!')
)

– Dale


#3

Thanks Dale!