NOTE: This thread is obsolete. Go here to read about setting up Python scripting on Rhino for Mac
We created a new package called rhino-python for the Atom text editor that in combination with Rhino 5 for Mac Build 5A671 provides code completion for RhinoCommon and provides a convenient way to launch your python scripts.
- Download and install Rhino 5 for Mac Build 5A671
- Download and install the Atom text editor (tested with version 0.174.0)
- From the “Atom” menu select “Install Shell Commands”
- Close Atom and open a Terminal window
- In the terminal window command prompt type:
apm install firstname.lastname@example.org apm install email@example.com
- From Rhino run the StartAtomEditorListener command.
- ignore the error: “looking for …PlatformServices.dll could not find file”. That missing file is not necessary and the error message won’t be in the next wip release of Rhino.
- Launch the Atom editor and save the “untitled” document as mypythonscript.py. The file needs to have a “.py” extension for the rhino-python package to be activated.
- Type "import " (trailing space) and a window with completion data will pop up. If too much time elapsed between typing the last two characters (t and space) the completion window will not open. If it didn’t you can open it by pressing the shift-ctrl-space keys.
- As you type “rhinos” you’ll see the completion data being filtered until the only option left is “rhinoscriptsyntax”. Press the “tab” key to accept it. Finish the line so it looks like this: import rhinoscriptsyntax as rs
- On the next line type “from Rhino.Geometry import Point3d”. The completion data will pop up for “Rhino”, “Geometry”, and “Point3d”. Press the tab key to accept each.
- For the next line type rs.AddCircle(Point3d.Origin, 5.0) and again notice the completion window after each “.” and keep typing until the desired data is highlighted in the completion window. Press the tab key to accept. After you type the “(” nothing happens that’s because in this release completion data for function arguments is not supported. That will come in a future release.
- To send the file to Rhino for execution press the ctrl-alt-r keys.
known problems and limitations:
- completion data for function arguments is not provided in this release.
- if your script prompts the user for input, the ./samples/CircleFromLength.py for example, the parameter input pane (top left) will not be visible because Rhino doesn’t refresh the display when it comes into focus.
- this is a first release so I’m sure you’ll find more. Please report them here.
The Atom text editor and the rhino-python package are both early releases. Atom (now at 0.174.0) is evolving rapidly and may introduce breaking changes as it moves towards a 1.0 release so the rhino-python package will need to be updated to keep up with the changes. We chose Atom because it’s a new editor that holds a lot of promise: it is made by the folks at GitHub, is getting a lot of attention, is cross platform, and is open source. Let us know what you think …