How to run a Python script¶. Your best way to get started with Python on Mac OS X is through the IDLE integrated development environment, see section The IDE and use the Help menu when the IDE is running. If you want to run Python scripts from the Terminal window command line or from the Finder you first need an editor to create your script. Great Cocoa editor with Python support including syntax coloring, integrated documentation, and a runtime wrapper with hyperlinked tracebacks. Note that code-folding of classes is currently broken for PEP 8 compliant code. ![]() NOTE: This thread is obsolete. Go to read about setting up Python scripting on Rhino for Mac We created a new package called rhino-python for the that in combination with provides code completion for RhinoCommon and provides a convenient way to launch your python scripts. Setup: • Download and install • Download and install the (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 [email protected] apm install [email protected] Quick Start: • 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. 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. Script Editor For MacThe 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. Alain: To send the file to Rhino for execution press the ctrl-alt-r keys. Helvetosaur: And will there be at some point a “silent” automatic install when installing Rhino without having to download and configure an external package? This isn’t something that we are focused on at the moment.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |