Matrix Transformation Spiral

This AeroScript program uses matrix transformations to perform a spiral.

// Matrix Transformation Spiral Example:
// Demonstrates using the built-in transformation API to perform
// a spiral on X and Y about the U axis.


// Function to create a spiral on axes X, Y centered at the current location.
function Spiral($endRadius as real, $degrees  as real)
	// Configure task so that move targets are specified as incremental distances.
	SetupTaskTargetMode(TargetMode.Incremental)

	// Define a rotation on axes X, Y with the U axis as an angle in degrees.
	TransformationConfigure(0, [MatrixCreateRotateK(U)], [X, Y], [X, Y])

	// Enable the transform.
	TransformationEnable(0)

	// Move the X axis and the angle axis at the same time to perform a spiral.
	MoveLinear([X, U], [$endRadius, $degrees], 1000)

	// Disable the transform.
	TransformationDisable(0)
end

// Main program.
program

	// Enable and home the axes.
	Enable([X, Y, U])
	Home([X, Y, U])

	// Trigger a data collection snapshot in Studio.
	AppDataCollectionSnapshot()

	// Perform a spiral.
	Spiral(10, 720)

	// Disable the axes.
	Disable([X, Y, U])

	// Stop data collection.
	AppDataCollectionStop()

end