Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
iconfalse
titleMacro
// Macro Implementation
// Spiral($x,$y,$rad,$count,$speed) 
//$x and $y are the location of the center of the spiral. This implementation changes the radius at the 0 and 180 degree points.
//the starting angle is 0 so the starting location of the X axis is offset from the circle center by the radius
//$rad is the maximum radius of the spiral
//$count is the number of iterations of the spiral
//$speed is the velocity used along the spiral path

//Comments:
//A critical section is used to ensure continuous motion through the "For-Next" loop. Otherwise the motion could stop during the 
//variable increment and test
//Macro's cannot declare variables so a task variable ($task0) is used as the index variable for the loop
//Change to a different task or global variable if the $task0 is used in the calling program for other purposes
#MACRO Spiral($x,$y,$rad,$count,$speed) G0 X $x+$rad Y $y \ 
 CRITICAL START 600 \ 
 for $task0=$count To 1 STEP -1 \ 
 G2 P0 Q180 R $task0*$rad/$count \ 
 G2 P180 Q0 R ($task0-0.5)*$rad/$count \ 
 next $task0 \ 
 CRITICAL END \
//END



Info
iconfalse
titleCalling Program
//Calling the Macro
//Enable and home the axes. 
//The G16 command defines the coordinate system for G2/G3 motion and the direction of motion in each of the planes (X/Y, Y/Z, Z/X)
//This example programs motion on the X/Y axes. G17 selects the X/Y plane
//VELOCITY ON enables contouring (constant velocity) between G1/G2/G3 moves
 
ENABLE X Y 
HOME X Y 
G16 X Y Z 
G17
VELOCITY ON 

SCOPETRIG
//Place spiral with center at X=0, Y=0, radius=10, number of turns=5 and speed=10
Spiral(0,0,10,5,10)

...