Create a function that can be typed into the command line to run a Python Script


I want to create a custom Rhino Command that I can run by typing it into the command line and having it run a Python Script. Typically I create a toolbar button and paste in the Python code, example shown below. I want to be able to run a script like this from the command line by typing a custom command. Thanks in advance for the help.


! _-RunPythonScript (

import rhinoscriptsyntax as rs
import Rhino

def AlignBottomToZero():
    msg="Select objects to align botttom to C Plane"	
    if objs==None: return
    for obj in objs:
        if bb: rs.MoveObject(obj,Rhino.Geometry.Vector3d(0,0,-bb[0][2]))

Does this help?

Or here is a second method:

Thanks. I’ll look them over.


Having some trouble with this. I created a test file using the workflow specified in Creating Rhino Commands Using Python. I can’t get Rhino to recognize the command. The tutorial said something about putting the guid in curly braces but that didn’t help. Any help would be greatly appreciated.

Python Editor put it here:

C:\Users\Eric Bunn\AppData\Roaming\McNeel\Rhinoceros\7.0\Plug-ins\PythonPlugins\RunPythonScriptTest {ee5de17e-c57a-4d7f-bd2a-40357f2a5a15}\dev


Got it to work.


For me the easiest way to do this is to store the script somewhere and make an alias… If you set up a path to the folder where you store your scripts in the Python editor, your alias can be simply

MyCommandAliasNoEcho ! _-RunPythonScript ""