Structure of a Program

The example that follows is a simple program written in the AeroScript programming language. Source files for AeroScript programs and libraries must use the UTF-8 encoding.

#include"MyDefines.ascript"
#define NUM_POS 2

program
   var $positions[NUM_POS] as real

   // Enable and home axes
   Enable([X, Y, Z])
   Home([X, Y, Z])

   // Start free-running axis Z
   MoveFreerun(Z, 100)

   // Move X and Y to positions 10 and 20, respectively
   MoveRapid([X, Y], [10, 20])

   // Perform G-code motion on axes X and Y
   G1 X20 Y10 F100
   G1 X30 Y5
   G1 X45 Y25 F35

   // Dwell for 0.5 seconds using G-code
   G4 P0.5

   // Call a function to get axis positions, perform a trigonometric
   // function, and then multiply the result by 1000
   $positions[0] = Sin(MyFunc(X)) * 1000.0
   $positions[1] = Cos(MyFunc(Y)) * 1000.0
end
 

function MyFunc($myAxis as axis) as real
   return StatusGetAxisItem($myAxis, AxisStatusItem.PositionCommand)
end

This program example has the elements that follow:

Next Topic: Comments and Whitespace