Month: December 2016



2D Library

We can consider Shapes to be “closed’ or “open.” Of course, any open shape can be closed and any closed shape set to open, but some shapes lend themselves to one or the other. For example, a gear shape, would normally be closed while a molding profile would normally be open.

Closed Shapes
















Open Shapes

Column Profiles the are Lathed


Wall Sections the are PlanSwept


Moldings that are PlanSwept

Archimatix Turtle Script API

Turtle logic, originally developed as a feature in the Logo programing language, is an important tool for the description of line shapes. Each line of a turtle script draws a 2D line relative to the current position of the turtle cursor. While this may seem conceptually simple, it is a powerful concept in parametric graphics. For example, to draw circular arc, with five segments, one need not calculate each of the five vertices, if one can simply tell the turtle to draw an arc to the right through 45 degrees at a radius or 3 units. The command in turtle script may look like this.

arcr 45 3 5

Archimatix has its own implementation of a turtle scripting API, borrowing more closely from GSDL, a 4th generation language developed by GIST, Inc., than from Logo.


Absolute Commands

mov x y <a>

Before drawing a shape, we have to place the turtle somewhere in 2D space and point it in a certain direction.  This command moves the turtle to the point x, y with out drawing any lines. The optional argument a tells the turtle in which direction to face. The default direction is 90 degrees.

 dir a

dir sets an absolute direction.

This command, which reorients the turtle to a new direction,  can be called anywhere in the script whenever you would like it to abruptly change direction.

Relative Commands

turnl avoila_capture-2016-12-03_07-37-00_pm

Turns the current direction a degrees to the left.

turnr a

Turns the current direction a degrees to the right.

fwd c <d>

Draws a line c units long in the current direction. For example, fwd 30, or if using a parameter, fwd height. Optionally, d will a diagonal line will be drawn c units forward and d units perpendicular to the current direction.

 back c

voila_capture-2016-12-03_07-57-33_pmDraws a line c units long, backwards, or in the opposite of the current direction.

right c

voila_capture-2016-12-03_07-58-27_pmDraws a line c units long to the right, without changing direction.

left c

Draws a line c units long to the right, without changing direction.

arcr a r s

voila_capture-2016-12-03_08-13-10_pm Draws a circular arc of a degrees, with a radius of r, beginning at the current point and tangential to the current direction and arcing to the right. After the command is execute, the turtle’s direction is automatically turned to the tangent of the end of the arc. For example, with a dir 45, arcr 45 3 5 will leave the turtle at a direction of 0 degrees so that if you follow with a fwd 4, the turtle will draw a line 4 units long at an angle of 0 degrees.

arcl a r s

Similar to arcr, but curving to the left.



Mathf Functions

All of the Mathf Functions have been mapped to AX Turtle Script. They follow the general form of:




A rad2degs conversion goes on inside the function, so the argument is in degrees.

Another example is

atan(x, y)

Mathf variables can also be used in your equations such as x*PI





AX Script has a limited looping syntax that basically repeats the code with a counter.

loop counter

The loop command opens the scope of the loop. The counter is a variable that you can use inside the loop code.


Teminates the scope of the loop.

For example, this loop will draw a gear shape with teeth number of teeth.

loop teeth

arcl degs radius segs
right tooth
arcl degs radius+tooth segs
left tooth


This example will produce a stair shape:

loop steps-1
fwd ariser
left tread

Conditional Block

The conditional command does not use parentheses.

if var1 GT var2

You can also reference a bool parameter

if bool


Closes the conditional block.

The conditional uses the boolean operators:

LT for "equals"

GT for "greater than"

EQ for "equals"

NE for "not equals"


There is currently no else if. The workaround is to create a second block with the opposite conditional.


Parameter and Variables

set parameter value

The set command will set a parameter based on the parameter’s name. This is particularly useful for defining a max and min value for a parametr.

set width greater(width, .01)


Or for making sure a parameter never rises above another:

set width lesser(shaftHeight, columnHeight)

Thus, even as the user drags a handle or types a value in a float field, it will not break the rule defined in the set command.


let tempVar value

The let command defines or resets a temporary variable. This is useful in the case that you have a long expression that you need to use in multiple function calls while drawing.

let buildingLength sine(angle)*buildingHeight

To reset a temporary variable, you must use let again.

let buildingLength 5

Absolute Commands (Cont.)


Special Curves

bezier   ax  ay   ahx  ahy   bhx  bhy   bx  by   segs

Draws a cubic Bezier curve between points a and b. The curve is modified by handles defined by absolute endpoints ah and bh.




molding  type  ax, ay  bx, by segs, tension

Moldings profiles are Shapes that have a very common use in architecture. This command uses one or more bezier curves to and makes certain assumptions about the handles so that you do not have to construct a sequence of beliers curves yourself. Borrowing from the timeless art of molding design, we have a few types that can be called in the molding command, including cove, ovolo, cyma recta, cyma reversa and onion.




© 2017

Theme by Anders NorenUp ↑