SortalGI Shape Grammar Interpreter
(by stouffs)
The SortalGI shape grammar interpreter supports the specification and application of parametric and non-parametric shape rules.
Support Email

The SortalGI Grasshopper plug-in encapsulates the SortalGI shape grammar interpreter and makes part of its functionality available within Grasshopper. It supports the specification and application of both parametric and non-parametric shape rules and the generation of single or multiple (in parallel or sequence) rule application results. The SortalGI Grasshopper plug-in supports points, line segments, plane segments, circles, ellipes, (circular) arcs and quadratic bezier curves, labels, graytones, colors and descriptions, in 2D or 3D. Emergence is naturally supported.


The SortalGI Grasshopper plug-in is made available as a .zip file. After unzipping it, you will find a folder containing the following components: a lib folder, a user objects folder, a samples folder and a PDF user manual.

  • The lib folder contains all Python support packages, including the SortalGI (Python) library.
  • The user objects folder contains the Grasshopper user objects that give access to (part of) the functionality of the SortalGI (Python) sortal grammar interpreter.
  • The samples folder offers demonstrations of the use of the SortalGI Grasshopper plug-in.
  • "SortalGI plug-in user manual 12.pdf" provides information on the plug-in, installation instructions, explanation on all of the components and their usage, and detailed information on specifying descriptions.

The installation involves two steps. The first step is to install the SortalGI library in a place where Rhino can find it. The second step is to install the SortalGI plug-in (user objects) for Grasshopper. These steps are fully explained in the "SortalGI plug-in user manual 15.pdf" instructions. They are summarized here for Rhino 6:

Step 1 [Windows]: Installing the SortalGI library -- Copy-paste the content of the lib folder (i.e., the subfolders sortal and site-packages) into the location C:\Users\me\AppData\Roaming\McNeel\Rhinoceros\6.0\scripts or C:\Program Files\Rhino 6\Plug-ins\IronPython\Lib or equivalent on your computer. Next:

  • Open Rhino
  • Type EditPythonScript in the Command box
  • In the Rhino Python Editor window, select 'Options...' from the Tools menu
  • Add the site-packages folder of your Rhino installation folder into the 'Module Search Paths'
  • Select the Script Engine tab, check the 'Frames Enabled' option and click 'OK'
  • Close Rhino completely

Step 1 [Mac]: Installing the SortalGI library -- Copy-paste the content of the lib folder (i.e., the folders sortal and site-packages) into the location Macintosh HD/Users/me/Library/Application Support/McNeel/Rhinoceros/6.0/scripts or equivalent on your computer. Unpack site-packages by moving its content to the scripts folder.

Step 2 [Windows/Mac]: Installing the SortalGI plug-in.

  • Open Rhino and Grasshopper
  • In Grasshopper, choose File > Special Folders > User Object folder
  • Copy-paste the content of the user objects folder into this User Object folder

The SortalGI plug-in should now be present as a specific tab in the Grasshopper Components Tab Panel, called 'SGI'.

You are now set to go.


Tutorial videos can be found at

The samples folder contains a number of demonstrations of the use of SortalGI within Rhino and Grasshopper.

  1. emergence illustrates the concept of emergence with two rules using only line segments (the points that are drawn are not part of the respective shape, these serve as reference points). One rule moves a square diagonally and another moves an L-shape diagonally. It shows a derivation (Knight, 2003) applying the two rules, using a series of Apply nodes. It also shows an extended derivation of all possible rule applications over two steps, applying the two rules created above, using two Apply All nodes.
  2. step-by-step shows the emergence example in a step-by-step elaboration. Each step is contained in a different gh file.
  3. inscribed square llustrates the use of a point to constrain rule application, as well as the use of graytones as attributes to spatial elements. It shows a derivation (Stiny, 1985) applying a rule to inscribe a square with a rotated square, alternating the color between black and white.
  4. froebel blocks illustrates the use of labelled points, descriptions and plane segments in 3D. It shows a derivation (Stiny, 1981) composing a design made up of blocks ('oblongs', 'pillars' and 'squares') from Froebel's building gift 6. The parallel description rules extract information form the shape to provide a description of the design, from which a block-by-block description can be derived. Note that compared to Stiny (1981), the derivation uses fewer rules, because the description rules are able to interact with the parallel shape rules. However, the derivation uses an additional labeled point assigned to each pillar.
  5. curves illustrates the use of quadratic bezier curves. It shows a derivation (Jowers and Earl, 2011) of a Celtic knotwork.
  6. ice ray grammar illustrates the specification and application of parametric-associative rules. It shows a derivation (Stiny, 1977) of a Chinese ice-ray lattice from five rules, each splitting a triangle, quadrilateral or pentagon into two polygons from among triangles, quadrilaterals and pentagons. This is work in progress. randomly assigns the slitting points on the respective line segments. As such, it is hard to ensure a 'nice' ice-ray lattice. shows how with the use of predicates (shortest-line) and directives (point-on-line) one is able to split a quadrilateral more 'nicely'.
  7. massing illustrates the specification and application of parametric-associative rules using descriptions, predicates and directives. It determines all void quadrilaterals (plots) in a figure, scales each quad (footprint) a given distance (border), extrudes each quad by a factor dependent on the ratio of the new area wrt the original area (gfa for a given plot ratio) and adds a surface to each face (facade and roof). A variant of this approach determines a rectangular block within the quadrilateral plot before extrusion.
  8. flow with negation illustrates the use of flows as composite rules embedding the algorithmic patterns of sequence, selection and/or iteration. This particular example illustrates a collection of three rules, the first one activating squares, the second one constraining the activation of squares such that these are not adjacent (via a negation), and the third one applies a transformation rule to the activated squares replacing them with triangles. The flow application generates all possible outcomes. The entire flow is written as '(activate_rule{2} !constrain_rule){1}+ triangle rule{1,2}'.
  9. flow avoiding overlap also illustrates the use of flows as composite rules embedding the algorithmic patterns of sequence, selection and/or iteration. This example includes two generative rules, adding a rhombus aligned with an existing rhombus, while the third rule constrains any new rhombus to be void inside. Finally, the third rule replaces the square with a triangle. Every run of the flow will generate a different (random) configuration. The entire flow is written as '[*(mirror_rhombus void_rhombus) (move_rhombus void_rhombus)]{0,20}'.
  10. lawn chair illustrates a recursive approach to generate the planar components of a chair. It uses parametric directives to specify the size and gap distance of each newly added planar segment, drawing the values to the directive's parameters from descriptions. For each type of planar segment, front, back, side and arm, there exists one description that specifies the size and gap distance for this planar segment. This description is retrieved by a parametric description that is part of the left-hand-side of the rule and matches the type of planar segment from the matching shape and the parameter values from the corresponding description.
  11. garden illustrates how just a few rules can generate quite varying designs, using randomization. It generates a garden design as a semi-random patchwork with a path meandering from one end of the garden to the other. Each step in the path generation picks a random match from among three quasi-parallel lines, each quasi-perpendicular to the previous path segment. The resulting path may intersect itself. The last rule assigns a random label from a list of labels to each section of the garden. It does so using an attribute description to the plane segment being added. the description includes two functions. The first function picks a random number between zero and nine, ten being the length of the list of labels. The second function picks the item from the list corresponding to the random index.
  12. miesesque illustrates a small number of rules to generate the configuration of stone and glass walls resembling Mies van der Rohe's Barcelona Pavilion, not taking into account the varying lengths of the wall segments. In principle, the latter could be done with the same number of rules, simply by adding a number of parameters to the rule adding a wall segment. The values to these parameters could come from predefined descriptions. This is an approach followed in the lawn chair example. However, in that case, the descriptions reference specific parts of the chair, such as the seat, back, arm, etc., and their fixed relationships. Here, the parameters would need to be linked to specific matches or locations.
  13. mesh illustrates the application of two parametric-associative rules, one for quadrilaterals and the other for triangles, to generate an apparently quasi-random pattern across a mainly quadrilateral mesh. Three more rules, including one non-parametric rule, translate the pattern into a surface with outlines of holes for laser-cutting. The non-parametric rules serves to replace the perpendicular ends of a rectangular cut line into semi-circles.
  14. serpentine combines both non-parametric and parametric-associative rules to generate the pattern of the Serpentine Pavilion in London (by Toyo Ito and Cecil Balmond). The iterative rotation and scaling of the square is best captured under a similarity transformation while extending the sides of each transformed square until the boundary of the original square can only be achieved using a parametric-associative rule.
  15. mondrian illustrates the specification and application of rules using colors and line thicknesses. Specifically, the colors are described using variable expressions so as to allow for the same rule to apply to multiple colors. It takes as an example Piet Mondrian's Composition with Large Red Plane, Yellow, Black, Gray, and Blue, albeit the generation is incomplete.
License Cost:
For instructions on installing Grasshopper Add-Ons, please see FAQ for details.
Grasshopper for Rhino 6 for Win
Grasshopper for Rhino 7 for Win
Grasshopper for Rhino 6 Mac
Grasshopper for Rhino 7 Mac
SortalGI plug-in user manual 17
Grasshopper for Rhino 6 for Win
Grasshopper for Rhino 7 for Win
Grasshopper for Rhino 6 Mac
Grasshopper for Rhino 7 Mac