Matrix Transformation Rotate Mirror

This AeroScript program uses matrix transformation functions to perform a rotation and mirror.

// Matrix Transformation Rotate Mirror Example:
// Demonstrates using the built-in transformation API to apply a
// rotation or mirroring transformation to your moves.
 

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

	// Move to corner of square.
	MoveLinear([X, Y], [1, 1])

	// Make square.

	// Top Edge.
	MoveLinear(X, -2)
	// Left Edge.
	MoveLinear(Y, -2)
	// Bottom Edge.
	MoveLinear(X, 2)
	// Right Edge.
	MoveLinear(Y, 2)

	// Move back to center.
	MoveLinear([X, Y], [-1, -1])
end


// Main program.
program

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

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

	// Create a square.
	Square()

	// Define a 45 degree rotation and mirror on axes X and Y.
	TransformationConfigure(0, [MatrixCreateRotateK(45), MatrixCreateMirror()], [X, Y], [X, Y])

	// Enable the transform.
	TransformationEnable(0)

	// Create a transformed square.
	Square()

	// Disable the transform.
	TransformationDisable(0)

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

	// Stop data collection.
	AppDataCollectionStop()

end