How to create a new Rhino command using Python

When I follow the steps on this page:

Shouldn’t I be able to use the new command MyNewCommand? I can’t get that to work.

I can create and run scripts and I can run the code for my new commands when I put RunCommand(True) at the bottom of the script. Shouldn’t I be able to run this from the Rhino GUI with MyNewCommand? I remembered to remove the RunCommand and I restarted Rhino. As best I can tell I followed all the steps on that page.

I am using Rhino 5 on Windows.

Hi @james.schmitz,

In the document you’ve reference is this important note:

Note: Sometimes, using this system, Rhino requires that Python be loaded before it can see the new command for the first time in a session - running EditPythonScript, or any other python script should allow the command to work.

Another approach to enduring that the Python plug-in is loaded when Rhino loads is to add something like this to Rhino’s list of commands to run at startup:

_NoEcho _-RunPythonScript _Enter

Does this help?

– Dale

1 Like

I thought that applied to the RHI Installer stuff. I ran that command and now my custom commands work. I’m a bit confused why it didn’t work before though. I had the Python editor open already as I was writing code in Python. Anyhow, it works and I can move forward.

Thanks for your reply. My custom commands work great and my productivity will increase. Much appreciated.