Turtle Script

The following commands can be parsed with Turtle Script within the logic panel of shape nodes.

Values inside () are optional.

mov x y (a)move, x y (set angle)
dir arotate, degrees
drw x ydraw, x y
rmove dx dyrelative move, offset-x offset-y
turnl arotate counter-clockwise, angle
turnr arotate clockwise, angle
fwd c (d)forward (offset)
back c (d)back (offset)
right c (d)right (offset)
left c (d)left (offset)
arcr a r sarc right, angle radius segments
arcl a r s arc left, angle radius segments
bezier ax ay ahx ahy bhx bhy bx by segmentsCubic bezier with 4 control points
molding type ax ay bx by segments tensiontype: cove, ovolo, cymarecta, cymareversa, *dome
closedadds a segment to connect the last point to the first
(also a bool switch under Output/Input Shape)
setset the value of a parameter
letcreate a temporary variable
loop repeat (name) (step)open a loop and repeat until done
(temp counter name) (steps per count)
endloopterminate loop
if conditionalopen a conditional directive when true
if boolrun conditional when bool is true
if !boolrun conditional when bool is false
endifterminate conditional directive
GTgreater than conditional
LTless than conditional
GEgreater or equal conditional
LElesser or equal conditional
EQequal conditional
NEnot equal conditional
//comment line

subtract (negative)
order of operations
mathf functionsComplete List of mathf functions
parameter namethe value of a node’s parameter
DetailLevelread-only parameter from graph, 0-1
reduces all segs

Example scripts:

The best way to learn AX Turtle Script is to open the Logic panel on any 2D shape node to see how it was made.

Parameter names on the node become dynamic variables in the script.

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

if !shift_origin
molding cove 0 height width 0 segs tension

Output Shape: open
if inputHypotenuse
if solveWidth
set width Sqrt(hypotenuse*hypotenuseheight*height)
set height Sqrt(hypotenuse*hypotenusewidth*width)

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(bXaX)/(segs-1)
if bX LT aX
let mdX -abs(bXaX)/(segs-1)
if bY GE aY
let mdY abs(bYaY)/(segs-1)
if bY LT aY
let mdY -abs(bYaY)/(segs-1)
if cX GE bX
let ndX abs(cXbX)/(segs-1)
if cX LT bX
let ndX -abs(cXbX)/(segs-1)
if cY GE bY
let ndY abs(cYbY)/(segs-1)
if cY LT bY
let ndY -abs(cYbY)/(segs-1)

mov aX aY
loop segs i
mov aX+mdX*i aY+mdY*i
drw bX+ndX*i bY+ndY*i

Output Shape: open

Comments are closed.