Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5835

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

$
0
0

Hi,

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()

6 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 5835

Latest Images

Trending Articles



Latest Images