In brief
- Open Rhino’s Python script editor by entering the ScriptEditor command.
- When creating a new script, select Python 3 and run the code with Run > Run.
- Rhino offers CPython-based Python 3 and IronPython-based Python 2 as separate runtimes.
- PyPI packages can be installed through ScriptEditor and specified as requirements in a script.
What you’ll learn in this guide
This guide focuses on creating a small Python script that runs inside Rhino. First, we’ll open a new file in ScriptEditor and create an example that adds a line between two points you select. Then we’ll cover running the script, debugging, choosing a Python runtime, and managing package requirements.
The example uses Rhino’s rhinoscriptsyntax functions. The goal isn’t to build a comprehensive tool, but to demonstrate the basic workflow of a script that accepts user input and creates geometry in Rhino. This introduction can provide a foundation for automating repetitive modeling tasks later on.
Requirements and version selection
The workflow uses Rhino and its built-in ScriptEditor. Enter ScriptEditor in the command line to open the editor. When creating a new script, choose Python 3 from File > New. The sources don’t specify any additional account, fee, or special hardware requirements for this workflow.
Rhino offers its Python options as separate implementations, not as different versions of the same engine. The guide identifies Python 3 as CPython and Python 2 as IronPython. Python 3 can use PyPI packages. Python 2 may be considered for some scripts that make extensive RhinoCommon calls or need to use .NET multithreading. The developer documentation recommends Python 3 as the starting point for most new scripts.
When checking version numbers, take the dates of the sources into account. The general Rhino.Python guide, updated in 2025, lists Python 3.9.11 for Rhino 8 and IronPython 2.7.12 for Rhino 7. The ScriptEditor documentation, updated in 2026, describes the runtimes but doesn’t specify these numbers. So the best place to start is by checking the options in the editor for your installed version of Rhino.
Create your first script
Run the
ScriptEditorcommand in Rhino’s command line. When the editor opens, go to File > New and select Python 3. ScriptEditor shows the language and runtime used by the file you’re editing.Add the following code to the new script:
import rhinoscriptsyntax as rs
first_point = rs.GetPoint("Çizginin başlangıç noktası")
if first_point:
second_point = rs.GetPoint("Çizginin bitiş noktası")
if second_point:
rs.AddLine(first_point, second_point)The code prompts you to select a start point in Rhino, followed by an endpoint. Once you’ve selected both, it creates a line between them. If either point isn’t selected, the script doesn’t proceed to the step that adds the line. The function names in this example use Rhino’s rhinoscriptsyntax interface.
Run the script with Run > Run, then select the requested points in the Rhino viewport. You can save the file with the
.pyextension. The editor’s File > New From Template option provides another way to start a new file from a template.Keep the example small and observe the result of each step. You can then adapt the same approach to repetitive selection and geometry-creation tasks. Rhino.Python supports use cases such as interactive scripts, custom commands, and generating geometry with algorithms. This example, however, covers only the workflow for getting points and creating a line.
Running, debugging, and choosing a Python engine
You don’t have to start a script from inside the editor every time. According to the Rhino developer guide, ScriptEditor can run saved files from the Rhino command line, a macro, a toolbar button, or an alias. This lets you connect a script to different launch points in Rhino, depending on how you plan to use it. If you write code directly in a macro, remember to add a language indicator so Rhino can select the right engine.
The file extension and an indicator in the script determine which Python environment opens the file. #! python 3 or #! python 2 specifies the relevant engine; the .py3 and .py2 extensions also indicate a specific environment. For plain .py files, the environment requested by the script is taken into account. If a file behaves unexpectedly, this is one of the things to check.
To pause the script on a line and inspect its variables, click in the margin next to that line in the editor to add a breakpoint. Then start debugging via Run > Debug. When the script pauses, you can step through it and inspect variables in the relevant panels. The Debug option is unavailable if you haven’t added a breakpoint.
Packages and issues to check
To add PyPI packages to Python 3 scripts, use Install Package in the ScriptEditor panel. You can search for a package or enter its name and version. If you need to include package information in the script, check whether Add Package Reference to Script is selected; the developer guide says this option lets you specify required packages in the script text.
You can also list package requirements using multiple names. For example, the following line lists the numpy and requests packages:
#requirements: numpy, requestsAfter installing packages or changing imported modules, you may need to reload the relevant Python engine. Use Tools > Reload Python 3 (CPython) Engine or Tools > Reload Python 2 (IronPython) Engine in ScriptEditor for this; according to the guide, you don’t need to restart Rhino.
If a script doesn’t run, first check whether it’s compatible with the Python engine you selected and what its extension or language indicator specifies. For a file that uses packages, check whether its requirements are included in the script. These aren’t issues that the sources identify as especially common, but they are possibilities to investigate when troubleshooting. When debugging, also try adding a breakpoint before selecting Debug.
Next steps
You can move code that you use across multiple scripts into a separate module and import it from other files. For Rhino to find the module, its folder needs to be included in the search paths, which are listed under Module Search Paths in Options. The developer guide also mentions adding a path with a .pth file.
For more advanced use, scripts can access RhinoCommon. Python 3 provides this access through Python.NET, while Python 2 runs on .NET. It’s also possible to use Python in Grasshopper, but there’s a separate Grasshopper Python guide covering its components and editor workflow. So when choosing your next step, decide whether you’re aiming to create a standalone script inside Rhino or a custom component that runs in a Grasshopper definition.
Sources and licensing
This article has been adapted into original Turkish-language prose based on McNeel’s “Scripting: Python” (K1) and “What is Rhino.Python?” (K2) developer guides. The source records classify the license as “free”; the pages include a copyright notice and “All Rights Reserved” statement, and don’t specify an open-source license name.
Sources
2 sourcesSource texts are not republished; short quotes are marked, everything else is our own summary and commentary.
For architecture firms and students who repeat the same selection and geometry steps in Rhino, Python offers a useful starting point for trying small-scale automation. Although the example of selecting points and creating a line is limited in scope, it provides a practical way to understand how a script affects Rhino and how to debug it.
For teams in Turkey, it’s important to check the Python environment in their current Rhino installation and the packages they plan to use before expanding the scope. Since the sources don’t specify pricing, hardware requirements, or licensing costs, no assumptions should be made about these. Keep in mind, too, that moving on to RhinoCommon or Grasshopper involves different workflows.
Frequently asked questions
How do you run a Python script in Rhino?
Run the ScriptEditor command in the command line, create a new script, and select Run > Run. Script files can also be launched from the command line, a macro, a toolbar, or an alias.
Does Rhino use Python 3 or Python 2?
The developer guides describe Rhino as offering a CPython-based Python 3 runtime and an IronPython-based Python 2 runtime. Python 3 can use PyPI packages; the engine you choose depends on the script’s requirements.
How do you add a PyPI package to a Rhino Python script?
Use Install Package in the ScriptEditor panel to search for a package or enter its name and version. The Add Package Reference to Script option helps specify package requirements in the script.



