Getting started wit...
Clear all

Getting started with Turtle Script  


Joined: 2 years ago
Posts: 143
18/10/2019 9:53 am  

Custom 2D shape nodes can be created with turtle script, parameter variables, math functions, conditional logic, and iterating loops. 

The AX manual has a list of turtle script commands and simple examples:

But the best resources are the existing 2D shape nodes where working scripts can be tinkered and reverse-engineered. Editing the shape node's logic in the AX graph doesn't effect the original node – just be sure to change the node's name before saving it to the library.

IsosceleseTriangle and Rampline are simple turtle scripts with 2 float parameters: width and height
The variables are created as input parameters on the node, then the name of the parameter can be used within the script to substitute for script values.

On the RampLine node, the only line of script necessary to draw the shape is:

drw width height

The 2 variables width and height simply replace the X and Y values of the turtle script:

drw x y

HalfCircle uses 3 parameters: a float radius, an int segs, and a bool rectify.
The script also declares a temp variable (float) called hang which is used inside a conditional block when the rectify bool is true.