# MACRO cut_ruled
# this is a macro to cut a ruled surface.
# It will position over the XY point defined by Xstart,Ystart
# Insert diameter comp in a move to the ruled_surface start point
# Cuts the ruled_surface
# Turns off comp in a move away from the ruled_surface
#
CUTRULED: 
ASSIGN: X1= X; Y1= Y;
ASSIGN: Ruledendpt
ASSIGN: Cut_compx= Xnormal*Lead_out;
ASSIGN: Cut_compy= Ynormal*Lead_out;
ASSIGN: Pre_posx= Xend+ Cut_compx;
ASSIGN: Pre_posy= Yend+ Cut_compy;
ASSIGN: Length_rem= Length_cut; Time_rem= Machine_time; Plot_on=0;
ASSIGN: X= Xend+ Xtangent; Y= Yend+ Ytangent;
FEED: 	Codes= "G44";
ASSIGN: Length_cut= Length_rem; Machine_time= Time_rem;
#ASSIGN: X= Xend; Y= Yend; U= Uend; V= Vend;
ASSIGN: X= X1; Y= Y1; U= Uend; V= Vend;
ASSIGN: Setcoordinates
ASSIGN: X= Pre_posx; Y= Pre_posy; Plot_on=1;
FEED: 	Codes= "G40M21";
ASSIGN: U= X; V= Y;
ASSIGN: Setcoordinates
OUTPUT: G45M21
