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

Get out of trouble

gray line

The Yingzao fashi project

gray line

Fractal with Hs

A fractal specified by a grammar of two rules.

 

Now that you’re set up, let’s draw a grammar in Rhino.


Set up a new grammar
  1. Create a new Rhino document (File / New). I usually use the template Small objects / millimetres, although it may not make any difference.
  2. Open the Python script editor. Open the Python script editor (Tools / PythonScript / Edit).
  3. Open the ‘new_grammar’ script. Select File / Open. Navigate to ‘package / commands / new_grammar’. The script opens in the editor. (Try not to change the script. If you do, close the script without saving.)
  4. Run the ‘new_grammar’ script. Click the green play triangle or select File / Run Script. This clears the Rhino document and creates two layers: one for the first initial shape and one for the first rule. Each layer has one or two cubic frames.

Draw the initial shapes and rules
  1. Draw the initial shape and the first rule. Use lines and textdots (for labeled points) to create the shapes. Draw each shape on the correct layer and completely inside the frame. See the tips below on drawing shapes.
  2. Add new initial shape and rule layers as necessary using the ‘new_initial_shape’ and ‘new_rule’ scripts.

Tips on drawing shapes
  1. You can use polygons, polylines, and blocks. If you do, explode them into lines. But don’t explode the frames.
  2. You can use scripts to draw shapes.
  3. You’re drawing in three dimensions, so you can create three-dimensional shapes (the interpreter can handle them).
  4. To work with a curve, you can try replacing it with lines connecting its control points. (I haven’t tried it, so if you do, let me know how it goes.)

Export the grammar
  1. Go through the pre-export checklist below.
  2. Export the grammar as a .dat file. Use the ‘export_grammar’ script.
  3. Save the grammar regularly (as a Rhino .3dm file).

Pre-export check list
  1. Check that your shapes consist of only lines and textdots.
  2. Check that the frames are block instances. If you exploded a frame, delete its lines and insert a new frame block on the appropriate layer.
  3. Use the top, front, and right views to check for any elements that lie outside a frame, even partially.
  4. Use the perspective view to check that lines are what you think they are. For instance, a line that in the top view appears parallel to the xy-plane may not be.
  5. Set the current layer to ‘Default’. Turn the initial shape and rule layers off one at a time to check that lines and textdots are in the correct layer.
  6. Check that your lines are maximal, i.e., that you have no duplicated, overlapping, or abutting collinear lines.
  7. Check that the left and right shapes of each rule are correctly located in their frames. The front lower left vertex of each frame is the origin for the shape it contains.
gray line
Contact me

i (at) andrew (dot) li

gray line