// 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
|