# MACRO cut_contour
# this is a macro to cut a path.
# It will position over the XY point defined by Xstart,Ystart
# Rapid in Z to the Rap Level
# Feed in Z to the Finish depth
# Insert diameter comp in a move to the path start point
# Cuts the path
# Turns off comp in a move away from the contour
# retracts to the rap level.
#
ASSIGN: Pathstartpt
MACRO: safe_start
ASSIGN: X=Xstart;  Z=Safe_z;
#
ASSIGN: D1= 12.0984*25.4;
ASSIGN: D2= D1-Z;
ASSIGN: Xorgshift= D2*TAN(B);
ASSIGN: Zorgshift= (D1-D2/COS(B))-Z;
ASSIGN: Xplotshift= -Xorgshift;
ASSIGN: Zplotshift= -Zorgshift;
#
MACRO: rotate_A
SELECT: Constant_y
CASE: 1
STD_BLK: ROTARY_FEED:     gcode= 1 feed     std blk= N*F*X*Z*A(-R49)
CASE ELSE:
STD_BLK: ROTARY_FEED:     gcode= 1 feed     std blk= N*F*X*Y*Z*A(-R49)
END SELECT:
ASSIGN: Z= Rap_level- Finish_depth; Feed= Zfeed;
OUTPUT: M08M90
OUTPUT: M75
OUTPUT: G01
OUTPUT: R43e{Dia_comp_angle}
OUTPUT: R44=R42*R43
OUTPUT: R49=R48-R44
#
ASSIGN: D1= 12.0984*25.4;
ASSIGN: D2= D1-Zstart;
ASSIGN: Xorgshift= D2*TAN(B);
ASSIGN: Zorgshift= (D1-D2/COS(B))-Zstart;
ASSIGN: Xplotshift= -Xorgshift;
ASSIGN: Zplotshift= -Zorgshift;
#
OUTPUT: F{Feed/25.4}X{Xstart}Z{Zstart}A{Acoder}-R49
OUTPUT: G151
OUTPUT: R43e{Dia_comp_angle}
OUTPUT: R44=R42*R43
OUTPUT: R49=R48-R44
ASSIGN: Feed= Tfeed;
CUTPATH:
OUTPUT: G150
OUTPUT: **@714
ASSIGN: Pathendpt
ASSIGN: Xendr= Xend; Yendr= Yend; Zendr= Zend;
OUTPUT: F{Zfeed/25.4}X{Xend}Z{Safe_z}A{Acoder}-R49
STD_BLK: ROTARY_FEED:       gcode= 1  feed      std blk= N*G*F*X*Y*Z*A*(-R49)B
OUTPUT: G00M74M93Z{Initial_z}



