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.
Eric
! _-RunPythonScript (
import rhinoscriptsyntax as rs
import Rhino
def AlignBottomToZero():
msg="Select objects to align botttom to C Plane"
objs=rs.GetObjects(msg,4+8+16+32,preselect=True)
if objs==None: return
rs.EnableRedraw(False)
for obj in objs:
bb=rs.BoundingBox(obj)
if bb: rs.MoveObject(obj,Rhino.Geometry.Vector3d(0,0,-bb[0][2]))
AlignBottomToZero()
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.
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