Sortal grammar interpreter (Grasshopper)   Index

 

The SortalGI Grasshopper plug-in encapsulates the SortalGI sortal grammar interpreter and makes part of its functionality available within Rhino/Grasshopper.

The SortalGI Grasshopper plug-in currently only supports (non-parametric) line and plane segments and labelled points.

 

Download

Download the SortalGI Grasshopper plug-in: sgi_gh_v030.zip (version 0.3.0)
This version supports line segments, plane segments, labelled points and descriptions. A dShape component supports the specification of a shape to include descriptions (either as attribute to a 'labelled' point or as separate descriptions). Separate descriptions need to be 'typed' and description types need to be predefined. The Setup component takes description types as an additional input.

Install

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 sortal-setup folder, a components folder, a sample folder and a PDF document explaining the installation process.

  • The sortal-setup folder contains a setup batch file and a number of support packages, including the SortalGI (Python) library.
  • The components folder contains the Grasshopper user objects that give access to (part of) the functionality of the SortalGI (Python) sortal grammar interpreter.
  • The sample folder offers a few demonstrations of the use of the SortalGI Grasshopper plug-in.
  • Annex E Installation (Windows) provides the installation instructions for the SortalGI Grasshopper plug-in for Windows.

The installation involves two steps. The first step is the installation of the SortalGI library, the second step is the installation of the SortalGI plug-in user objects. These steps are also explained in the Annex E Installation (Windows) instructions.

  1. Execute the setup.bat batch file which can be found in the sortal-setup folder. This will copy the content of the sortal-setup\site-packages folder into the Plug-ins\IronPython\Lib\site-packages folder of your Rhino installation folder. Alternatively, you can do so manually.
  2. Next, add the Plug-ins\IronPython\Lib\site-packages folder of your Rhino installation folder into Rhino's Module Search Paths.
    • Launch Rhino
    • Type EditPythonScript in the Command box
    • In the Rhino Python Editor window, select 'Options...' from the Tools menu
    • Add the Plug-ins\IronPython\Lib\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'.
  3. Open Grasshopper and select the 'User Object Folder', under 'Special Folders', from the File menu. Copy the content of the sgi_components folder into the UserObjects folder.
  4. Exit Rhino and relaunch Rhino. 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.

 

Reference

The SortalGI plug-in contains the following components:

  • SGI Setup initializes the sortal grammar interpreter. This component should always be present in a Grasshopper file when any other components of the plug-in are used. In addition, it takes four inputs: a X displacement and a Y displacement (see Apply and Apply All), a text size (for the display of text points), and a list of shape description types (names, see dShape).
  • Text Point creates a text point from a point and a text. The text may be serve as a label or as a shape description attribute. This component is provided for convenience.
  • Shape takes a geometry of lines, polylines, (flat) surfaces, meshes, boundary representations and/or text points and returns a shape object. Other geometric elements are ignored. A geometry of lines, surfaces and text points corresponding to the shape object is additionally returned. Shape also accepts a reference point. If specified, the shape is moved from the reference point to the origin.
  • dShape is similar to Shape but takes an additional list of shape descriptions. Each shape description must specify its type followed by a colon and the description instance. Multiple instances can be separated with a vertical bar. Shape description types must be predefined using Setup.
    S2G converts any shape (object) into a geometry of lines, surfaces and/or text points, and a list of shape descriptions, if any.
  • Rule defines a shape rule from a left-hand-side shape and a right-hand-side shape, as well as a rule name and a rule description. It returns a rule object.
    Rule Info deconstructs a rule into its left-hand-side shape, right-hand-side shape, and a multi-line text containing its GUID, name and rule description.
  • Apply applies a rule onto a shape. It takes as inputs a rule, a shape, an optional subshape, and an optional rule application index. The subshape, if specified, must be a part of the shape; then, the matching is performed on the subshape, while the rule application is performed on the shape. An index value of -1 (default) selects a random rule application, any number outside the index range yields the last rule application (see Apply All to determine all rule applications).
    Next to the resulting shape, the corresponding geometry and a list of shape descriptions, if any, Apply returns True or False indicating success, and a translation vector. If no rule application was determined (success equals False), the original shape is returned. The translation vector allows the resulting shape to be visualized aside from the original shape. The translation vector is defined by the X displacement specified for SGI Setup or, if omitted, from the bounding box of the original shape (see Move Shape).
  • Apply All applies a rule onto a shape, returning all rule applications. It takes as inputs a rule, a shape, an optional subshape. The subshape, if specified, must be a part of the shape; then, the matching is performed on the subshape, while the rule application is performed on the shape.
    Next to the resulting shapes, Apply All returns True or False indicating success, and a list of translation vectors. If no rule application was determined (success equals False), the original shape is returned. The translation vectors allow the resulting shapes to be visualized one above the other and aside from the original shape. The translation vectors are defined by the X displacement and a multiple of the Y displacement specified for SGI Setup or, if omitted, similarly from the bounding box of the original shape (see Move Shape).
  • Move Shape takes a shape and a vector and moves the shape along the vector. It returns the moved shape and the corresponding geometry. It serves, among others, to display the results from Apply or Apply All aside the original shape and one above the other, in case of multiple rule applications.
    Rotate Shape takes a shape, a base plane and a rotation angle and rotates the shape about the normal vector of the base plane by the specified angle. It returns the rotated shape and the corresponding geometry.
    Mirror Shape takes a shape and a mirror plane and mirrors the shape about the base plane. It returns the mirrored shape and the corresponding geometry.
    Scale Shape takes a shape and a scaling factor and scales the shape accordingly. It returns the scaled shape and the corresponding geometry. Note that the scaling occurs relative to the origin.
  • Sum combines two shapes together and returns the resulting shape and the corresponding geometry.
    Product takes two shapes and returns the common part and the corresponding geometry.
    Difference takes two shapes and returns the complement of the first shape with respect to the second shape, as well as the corresponding geometry.

 

Use

The demo folder contains three grasshopper demonstration files

  • rules 1 creation.gh shows the creation of two rules. One to move a square diagonally and another to move an L-shape diagonally.
  • rules 2 application.gh shows a derivation (Knight, 2003)1 applying the two rules created above, using a series of Apply nodes.

  • rules 3 exploration.gh shows an extended derivation of all possible rule applications over two steps, applying the two rules created above, using two Apply All nodes. Note that if you change the input values to the SGI Setup node, you may need to press function key 'F5' in order to re-execute all the nodes, based on the new input.

  • inscribed square.gh shows a derivation (Stiny, 1985) applying a rule to inscribe a square with a rotated square, using a labeled point to constrain rule application.

 

  1. T.W. Knight, 2003, Computing with emergence, Environment and Planning B: Planning and Design 30, 125–155.
  2. G. Stiny, 1985, Computing with Form and Meaning in Architecture, Journal of Architectural Education 39(1), 7-19.
 
 
 

Last update: 14 May 2018, webmaster @ sortal.org