The header
Two comment lines at the top of the script give the component its pins:divide_curve.py
NODE_INPUTSandNODE_OUTPUTSlist the pins. You can use several lines of each.- Each input is
name:type, then optionally| "description"and settings:min=,max=,step=,decimals=,default=,options="a|b|c". # CATEGORY:puts the component in a library category. The next comment line is its listing in the library.- In C#, the same lines start with
//.
Pin names are how Alien keeps your wires. Rename a pin and its wires drop, so keep names stable.
Controls come from the header
Leave an input unwired and it gets a control right on the component:
Wire something in and the control folds away to its pin. Values you set save with the
.gh file and can be undone.
Input dots: green means wired, blue means a value you set on the component (or an agent set), grey means the header’s default.
Types
float int bool str Color Interval Point3d Vector3d Plane Line Circle Arc Box Rectangle3d Curve Surface Brep Mesh SubD Geometry Transform object
Add list[T] for a list, or tree[T] for a data tree, which arrives as a list of branches. Values arrive as plain RhinoCommon and .NET types. Outputs are the top-level variables named in NODE_OUTPUTS: a list becomes a Grasshopper list, and a list of lists becomes a data tree.
Reading a component at a glance
The component shows the Alien mark, the script’s name, a PY or C# badge and its state: ok, error or running. When a run fails, the error itself is printed on the component, not hidden in a log. The selected component glows.Right-click menu
Where your files live
Your scripts live in the script repository:Documents/Alien scripts unless you choose another folder (right-click › Script repository). Your .gh files point to scripts relative to it, so a folder you share with a colleague works on their machine too.
The ready-made components are copied into its suite/ folder. Alien keeps the ones you haven’t touched up to date, and leaves alone any you edit or delete. What the generators make is kept in .alien/assets/.
Python and C#
- Python
- C#
Real CPython 3.9 inside Rhino 8.
import Rhino.Geometry as rg. Add packages with # r: numpy near the top; Rhino installs them on the first run. Put shared helpers in helpers.py in your script folder and import helpers.