Turtle Script is parsed within the logic panel of 2D shape nodes.
Use a new line of script for each command.
The turtle can only read/write the parameters on its own node.
Values inside () are optional.
newp | new point creates a vertex in-situ and restarts the UV map |
mov x y (a) | move to x y (degrees) teleport turtle to location (face direction) |
drw x y | draw to location x y |
dir a | direction angle in degrees 0 is east, 90 is north |
bezier ax ay ahx ahy bhx bhy bx by segments | cubic bezier with 2 handles start handle1 handle2 end segments |
molding type ax ay bx by segments tension | point-to-point tension curves type* start end segments tension *type: cove, ovolo, cymarecta, cymareversa, dome |
rmov dx dy | relative move offset-x offset-y teleport to offset, restarts the UV map *shape must be OPEN |
rdrw dx dy | relative draw offset-x offset-y |
movfwd c (d) | move forward value (offset) *shape must be OPEN |
fwd c (d) | forward value (offset) |
back c (d) | back value (offset) |
right c (d) | right value (offset) |
left c (d) | left value (offset) |
turnl a | rotate counter-clockwise degrees |
turnr a | rotate clockwise degrees |
arcr angle radius segments | draw an arc to the right angle in degrees radius of the arc segments (int) line segments |
arcl angle radius segments | draw an arc to the left angle in degrees radius of the arc segments (int) line segments |
closed | adds a segment connecting the last point to the first, and removes overlapped vertices *required for ‘manifold topology’ *changes options under Shape Output *also a bool switch under Shape Output |
set | set the value on a parameter or variable set parameter value set var value |
let | create a temporary variable let var value |
loop repeat (count) (step) | open a loop and repeat (int) until done (count) create temp var (int) = the loop value (step) steps through the count by (int) loop 360 rotate 90 dir rotate // rotate = 0, 90, 180, 270 endloop |
endloop | terminate loop |
if conditional | open a conditional directive when true if parameter GT value endif |
var GT value var LT value var GE value var LE value var EQ value var NE value | greater than less than greater or equal lesser or equal equal not equal |
if bool | run conditional when bool is true |
if !bool | run conditional when bool is false |
endif | terminate conditional |
// | comment line |
+ – * / (…) | add subtract (negative) multiply divide order of operations |
mathf functions | function returns a value sqrt(pow(width,2)+pow(height,2)) |
parameter | the value of a parameter mov width 0 set width value |
DetailLevel | read-only parameter from graph: 0-1 *reduces segments on all nodes: 0.5 is 50% *generate LOD models by reducing vertices if DetailLevel LT .67 endif |
Example scripts:
The best way to learn AX Turtle Script is to open the Logic panel on any 2D shape to see how it was made.
![]() | mov width/2 0 90 drw 0 height/2 drw –width/2 0 drw 0 –height/2 Output Shape: closed |
![]() | if shift_origin molding cove –width height 0 0 segs tension endif if !shift_origin molding cove 0 height width 0 segs tension endif Output Shape: open |
![]() | if inputHypotenuse if solveWidth set width Sqrt(hypotenuse*hypotenuse–height*height) endif set height Sqrt(hypotenuse*hypotenuse–width*width) endif set hypotenuse Sqrt(width*width+height*height) set theta Atan2(height,width) mov 0 0 90 right width fwd height Output Shape: closed |
![]() | if bX GE aX let mdX abs(bX–aX)/(segs-1) endif if bX LT aX let mdX -abs(bX–aX)/(segs-1) endif if bY GE aY let mdY abs(bY–aY)/(segs-1) endif if bY LT aY let mdY -abs(bY–aY)/(segs-1) endif if cX GE bX let ndX abs(cX–bX)/(segs-1) endif if cX LT bX let ndX -abs(cX–bX)/(segs-1) endif if cY GE bY let ndY abs(cY–bY)/(segs-1) endif if cY LT bY let ndY -abs(cY–bY)/(segs-1) endif mov aX aY loop segs i mov aX+mdX*i aY+mdY*i drw bX+ndX*i bY+ndY*i endloop Output Shape: open |