Hi;
I has write a python script and want to run it as aiases, but not succeed.
!-_RunPythonScript (
import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
import Rhino
ids = rs.GetObjects("select objects",0,True, True, True)
if ids:
box = rs.BoundingBox(ids)
if box:
box1 = rg.BoundingBox(box)
poi1=Rhino.Geometry.Point3d.Origin
translation = poi1 - box1.Center
rs.MoveObjects(ids,translation) )
If I run it in Macro Editor, it run good. What did I do wrong ?
You need a space between the ! and the -. I also put the last close parentheses on a separate line below.
However, not sure if you can actually run Python scripts like that as an alias. What is better is to store the script somewhere and then create an alias that uses the full path to the script file like this (default path for scripts shown):
MyAlias : ! -_RunPythonScript "C:\Users\<your user name>\AppData\Roaming\McNeel\Rhinoceros\7.0\scripts\YourScriptName.py"
By default, that path may already be set in your script editor, in that case you can just use this:
MyAlias : ! -_RunPythonScript "YourScriptName.py"
https://wiki.mcneel.com/developer/macroscriptsetup
Hi@ Helvetosaur, got it, thank you.