Repository navigation
Releases: theObjectCo/PillScript
Release list
PillScript 0.5.0
PillScript is a C# script component for Grasshopper in Rhino 8.
Download the .yak below, put it in a folder of its own, and install it from there:
"C:\Program Files\Rhino 8\System\Yak.exe" install --source C:\path\to\the\folder pillscript
Restart Rhino afterwards. The package is not on the Rhino package server, so the Package
Manager will not find it by name. Adding the same folder to
Rhino.Options.PackageManager.Sources under Options > Advanced lists it there beside the
public packages.
Windows, Rhino 8.30 or newer. The editor runs in the WebView2 runtime that Rhino 8 installs
for its own interface.
The component is called PillScript
It was called C# Script, the same as Rhino's own script component, and the two stood side by side
under Maths > Script. A search by name found both, or the wrong one. The nickname on the canvas
stays C#. Saved files keep working, because a .gh file finds a component by its id and not by its
name.
A compile asked for during another compile is not lost
Placing a component compiles its template. A compile requested through the bridge before that
finished was dropped, and the bridge waited two minutes and answered that Rhino did not answer. The
editor's Compile button went through the same path. A second request now waits for the running
compile, and one more compile follows it with the sources as they stand by then. Every caller that
waited gets that result.
Other plug-ins reach the bridge tools without a port
PillScript.Bridge.Entry.Run(tool, argumentsJson) runs one bridge tool and answers JSON text. A
plug-in in the same Rhino calls it by name, with no reference to PillScript, and needs neither
PILLSCRIPT_BRIDGE nor the port. Phenome Link uses it for its pillscript verb, in the first
release after 0.34.1.
Every declared input type receives its data
An item or list input declared as long, float, decimal, Point3f, NurbsCurve, PolyCurve,
Polyline, NurbsSurface or GeometryBase turned the component red with "Invalid cast" and the
script saw nothing. A tree of Point3f, Polyline, NurbsSurface or GeometryBase arrived empty
with a warning. Grasshopper converts an input only as far as its goo allows, and a Number does not
become a float. Item, list and tree inputs now go through one conversion, which narrows a curve to a
polyline, NURBS curve or polycurve, a surface to a NURBS surface, a point to a Point3f, and a
number to any numeric type. An item that still does not convert is reported on the component by
input and type.
Complex numbers reach a Complex parameter
A Complex output went to a Complex Number parameter as System.Numerics.Complex, which
Grasshopper could not convert. The solve opened modal "Grasshopper breakpoint" dialogs, and Rhino
answered nothing until each was closed. Grasshopper's own Complex, the one the template's usings
name, now maps to that parameter, and System.Numerics.Complex travels as generic data.
A check that runs in Rhino
tools/test.js sends each of 38 types from one script to another as an item, a list and a tree, and
compiles every example in the readme. It found the two faults above. It also found two examples that
did not build as printed: the first called a PolyHelper the readme never defined, and the panel
example had no RunScript. Both are complete now. The readme's section on building says how to run
the check.
PillScript 0.4.1
PillScript is a C# script component for Grasshopper in Rhino 8.
Download the .yak below, put it in a folder of its own, and install it from there:
"C:\Program Files\Rhino 8\System\Yak.exe" install --source C:\path\to\the\folder pillscript
Restart Rhino afterwards. The package is not on the Rhino package server, so the Package
Manager will not find it by name. Adding the same folder to
Rhino.Options.PackageManager.Sources under Options > Advanced lists it there beside the
public packages.
Windows, Rhino 8.30 or newer. The editor runs in the WebView2 runtime that Rhino 8 installs
for its own interface.
Tree inputs of a plain type receive their data
An input declared as DataTree<Curve>, DataTree<string> or a DataTree of any other type with
its own Grasshopper parameter arrived empty in every earlier version, with no message on the
component. Only GH_Structure<IGH_Goo> and DataTree<object> carried the tree. The component asked
Grasshopper for the tree as plain goo, and Grasshopper hands a tree over only in the exact goo type
the parameter holds, which for a Curve input is GH_Curve. The tree is now read from the input
itself and each item converted. An empty branch now stays in the tree, where before it disappeared
from a DataTree.
Verified in Rhino 8: three grafted lines into DataTree<Curve> arrive as three branches of one
LineCurve, three panel lines into DataTree<string> arrive as one branch of three strings, and
the same text into DataTree<double> gives one empty branch and a warning naming the input.
PillScript 0.4.0
PillScript is a C# script component for Grasshopper in Rhino 8.
Download the .yak below, put it in a folder of its own, and install it from there:
"C:\Program Files\Rhino 8\System\Yak.exe" install --source C:\path\to\the\folder pillscript
Restart Rhino afterwards. The package is not on the Rhino package server, so the Package
Manager will not find it by name. Adding the same folder to
Rhino.Options.PackageManager.Sources under Options > Advanced lists it there beside the
public packages.
Windows, Rhino 8.30 or newer. The editor runs in the WebView2 runtime that Rhino 8 installs
for its own interface.
Drawing in the viewport
A script can override DrawWires and DrawMeshes to draw into the Rhino viewport, and DrawBounds
to say what the drawing covers so that Zoom Extents and the clipping planes account for it. Output
geometry is still previewed as before; these run after it.
Grasshopper decides whether to run the viewport passes from the outputs, so a script that draws
without producing geometry would never have been asked. Overriding either method now counts as being
preview capable.
An exception thrown while drawing cannot be allowed back into the display pipeline. It is caught,
reported once on the Rhino command line, and the script is left out of the passes until the next
compile.
Verified on an installed package: a component whose only outputs are a number and the print text
draws a ring of points and the polygon through them, Zoom Extents frames the drawing with nothing
else in the Rhino document, a deliberate throw inside DrawWires leaves Rhino running and prints
one line naming the file and the line, and the next compile brings the drawing back.
PillScript 0.3.0
PillScript is a C# script component for Grasshopper in Rhino 8.
Download the .yak below, put it in a folder of its own, and install it from there:
"C:\Program Files\Rhino 8\System\Yak.exe" install --source C:\path\to\the\folder pillscript
Restart Rhino afterwards. The package is not on the Rhino package server, so the Package Manager
will not find it by name. Adding the same folder to Rhino.Options.PackageManager.Sources under
Options > Advanced lists it there beside the public packages.
Windows, Rhino 8.30 or newer. The editor runs in the WebView2 runtime that Rhino 8 installs for its
own interface.
First public release.
Controls in a Rhino panel
A script can override RegisterUi and register sliders, number and integer fields, toggles,
choices, text fields, vectors, colour swatches, layer pickers, buttons and captions. Each call
declares one control and assigns its current value to the variable passed in, so a control is
declared and read in one line. The controls appear in a Rhino panel docked with Layers and
Properties, and Publish to panel in the component menu puts a component there.
Several components share the panel. Each gets a heading that rolls its section up and can be dragged
to reorder it, and the arrangement, the collapsed state and the values are saved in the .gh file. A
dragged slider costs one solve after the drag instead of one per step. A button is true for the
single solve its press caused. Colour swatches open Rhino's own picker, and the layer picker lists
the document's layers as they stand when the panel draws.
A script may carry a ui.css to restyle the panel, and a saved stylesheet reaches the panel without
a compile or a solve.
Component icons
Phosphor icon in the component menu takes any name from https://phosphoricons.com. The icon is
fetched once, cached under %LOCALAPPDATA%\PillScript\icons, and drawn both on the canvas and at
the head of the component's section in the panel.
Fixes and smaller changes
- Tree inputs report the items they could not convert instead of silently dropping them, naming the
first refusal and the branch it came from. - CS1701 and CS1702 are suppressed, since a script author cannot act on an assembly version that
Rhino resolved before the script was written. Nullable annotations are on with their warnings off,
soout Brep? brepcompiles without annotating the rest of the file. - Eto resolves for scripts that reference it. It sits one folder above the other Rhino assemblies,
and both locations are now searched. - Working folders that nothing has compiled from for a week are deleted in the background as
Grasshopper loads. The scripts themselves live in the .gh files, so only the restore is lost. Publish to panelis no longer greyed out when a component declares no controls, which used to
trap a published component whose controls had been renamed.- Dropdowns in the panel are drawn in the page. A native
selectopens a window that a docked panel
loses to Rhino's focus handling. - A press on a section heading rolls the section up again. Pointer capture started on the press and
swallowed the click that followed. - The panel uses JetBrains Mono, shipped in the package, so it draws with no network.
Examples
examples/perforated-sheet.gh drives a sheet of holes entirely from the panel. Nothing on the
canvas feeds it.
examples/diffusion-limited-aggregation.gh grows a dendrite from two source files, with a spatial
grid that cuts 1500 particles down to about a fifth of a second, where the same run without it
takes minutes.