The interpreter project


Create a grammar

  gray line

Home

About me

About shape grammars

Publications

gray line

The interpreter project

Set up

Create a grammar

Run a grammar

gray line

The Yingzao fashi project

gray line

Fractal with Hs

A fractal specified by a grammar of two rules.

 

Creating a grammar comes down to creating shapes and rules. Here’s how.


Create a shape

First, draw a shape in Rhino.

  1. Draw a shape. You can use straight lines and annotation dots (i.e., labeled points). You can use a script (as I did in the video). You can probably use Grasshopper, although I haven’t tried it.
  2. Select Tools > PythonScript > Run… from the menu bar. An Run Python script dialog box will appear.
  3. Select shape_exporter.py. A prompt will appear on the command line.
  4. Select the lines and labeled points. A prompt will appear.
  5. Enter the name of the shape (e.g., test). A Save shape as dialog box will appear. The shape name will be suggested as the file name (e.g., test.is).

Then, switch to the grammar environment and import the shape.

  1. Select Initial shape > Import initial shape from file… from the menu. An Open dialog box will appear.
  2. Select the shape file (e.g., test.is). It will appear (in plan view) in the initial shape list.
  3. Select File > Save as… from the menu. A Save as dialog box will appear. (For some reason that I’ve forgotten, Save doesn’t work for a new file. Once a file has a name, Save works as expected.)

Create a rule

Say you want to create a rule A → B. Then you need to draw the shape C that contains every element in A, in B, or in both. (I did this in the video too.)

First, draw the shape C in Rhino.

  1. Draw the shape as above.
  2. Select Tools > PythonScript > Run… from the menu bar. An Open file dialog box will appear.
  3. Select rule_exporter.py. A prompt will appear.
  4. Select the lines and labeled points in A. A prompt will appear.
  5. Enter the name of A. A prompt will appear.
  6. Select the lines and labeled points in B. A prompt will appear.
  7. Enter the name of B. A prompt will appear.
  8. Enter the name of the rule (e.g., test). A Save rule as dialog box will appear. The rule name will be suggested as the file name (e.g., test.rul).

Then, switch to the environment and import the rule.

  1. Select Rule > Import a rule… from the menu. An Open dialog box will appear.
  2. Select the rule file (e.g., test.rul). It will appear (in plan view) in the rule list.
  3. Select File > Save from the menu. (I’m assuming that you’ve already done a Save as.)

If you find this hard to follow, try the manual or the video.

 

gray line
Contact me

i (at) andrew (dot) li

gray line