-- Default rough parameter file from ToolMaker Version 5.5
-- Generic copymill information
set TOL 0.050
set IN_MM INCH
set TOO_RAD .250
set COR_RAD .050
set TOO_AXIS ( 0.000 0.000 1.000 )
set Q_FLAG false
set OUT_FILE RTEST.TPR
set IN_FILE TMP.PDB
set MTL_THK 0.100
set CTR_TIP TIPS

set ENABLE_ANALYSIS false
set ANALYSIS_NOR false
set ANALYSIS_CRV false
set SPINDLE_SPEED 2000
set PROG_NUM 1234
set START_SEQ 1
set INC_SEQ 1
set TOOL_NUMBER 1
set DIA_OFF 1
set LENGHT_OFF 1
--Cimsurf setup information
surf FROM 0.000 0.000 1.000
surf CSR Z 1.000
surf FSR Z .750
surf FED 20.000 10.000

-- Copymill finish cutting information
set ENABLE_FINISH false
-- Copymill rough cutting information
set ISLAND_FILE RTEST.ISL
set ENABLE_QROUGH true
set QROUGH_DELTA 0.100
set QROUGH_THI true
set QROUGH_DIR ( 1.000 0.000 0.000 )
set CONT_LEVELS false
set ZIGZAG_LEVELS true
set SPRL_LEVELS false
set SPRL_REVERSE false
set SPRL_TOWARDS false
set ROUGH_AXIS ( 0.000 0.000 1.000 )
set ROUGH_INCR 0.200
set ROUGH_STEP 0.250
set ROUGH_START ( 0.000 0.000 0.000 )
set ROUGH_END ( 0.000 0.000 -5.000 )
set SEC_AXIS ( 0.866 0.500 0.000 )
set INCR_BY 0.200
rampset RAMP_CIRC 3.000 0.500
set RAMP_HI0 0.250
-- Stitcher information
set STITCH_ZIG true
set ADVANCE ( 0.000 0.000 1.000 )
set CLFILE_NAME TMP.CL
set ADD_FROM true
set RET_FROM true
set DIR_CUT FORWARD
set DIR_STEP FORWARD

set FINISH_USE_FSR true
set FINISH_USE_CSR true
set FINISH_NO_LIFT false
set CLDIS 0.100
set FDDIS 0.100
set FRDIS 0.100
set RAMP_FEED_RATE 20.000
stitchop define-lift L_lift (
set USE_FEED_PLANE true ;
set USE_CLEAR_PLANE true ;
set SUPPRESS_LIFT false ;
set INCR_RAPID_DIS 0.1 ;
set INCR_FEED_DESC 0.1 ;
set INCR_FEED_RETR 0.1 ;
)

stitchop define-lift C_lift (
set USE_FEED_PLANE true ;
set USE_CLEAR_PLANE true ;
set SUPPRESS_LIFT false ;
set INCR_RAPID_DIS 0.1 ;
set INCR_FEED_DESC 0.1 ;
set INCR_FEED_RETR 0.1 ;
)

stitchop define-post R_post (
post-cmd FEDRAT 20 INPM ;
)

stitchop define-post LR_post (
post-cmd FEDRAT 20 INPM ;
)

stitchop define-lift R_lift (
set USE_FEED_PLANE true ;
set USE_CLEAR_PLANE true ;
set SUPPRESS_LIFT false ;
set POST_CMDS R_post ;
set INCR_RAPID_DIS 0.1 ;
set INCR_FEED_DESC 0.1 ;
set INCR_FEED_RETR 0.1 ;
)

stitchop define-lift LR_lift (
set USE_FEED_PLANE true ;
set USE_CLEAR_PLANE true ;
set SUPPRESS_LIFT false ;
set POST_CMDS LR_post ;
set INCR_RAPID_DIS 0.1 ;
set INCR_FEED_DESC 0.1 ;
set INCR_FEED_RETR 0.1 ;
)

stitchop define-ctxt ctxt-levpock (
stch-cmd FIND_PATH_ON_REGION true ;
stch-cmd STITCH_ZIG true ;
stch-cmd FIND_PATH_IN_REGION true ;
set DIR_CUT FORWARD ;
)

stitchop define-ctxt ctxt-conspi (
stch-cmd FIND_PATH_IN_REGION false ;
stch-cmd FIND_PATH_ON_REGION true ;
stch-cmd STITCH_ZIG true ;
)

stitchop define-ctxt ctxt-oneway (
stch-cmd FIND_PATH_IN_REGION true ;
stch-cmd FIND_PATH_ON_REGION true ;
stch-cmd STITCH_ZIG false ;
set DIR_CUT FORWARD ;
)

stitchop define-ctxt ctxt-levramp (
stch-cmd FIND_PATH_ON_REGION true ;
stch-cmd STITCH_ZIG false ;
stch-cmd FIND_PATH_IN_REGION false ;
stch-cmd FED 20 10 ;
set DIR_CUT FORWARD ;
)

stitchop define-ctxt ctxt-conramp (
stch-cmd FIND_PATH_ON_REGION true ;
stch-cmd STITCH_ZIG false ;
stch-cmd FIND_PATH_IN_REGION true ;
stch-cmd FED 20 10 ;
set DIR_CUT FORWARD ;
)

stitchop define-ctxt ctxt-spiramp (
stch-cmd FIND_PATH_ON_REGION true ;
stch-cmd STITCH_ZIG false ;
stch-cmd FIND_PATH_IN_REGION true ;
stch-cmd FED 20 10 ;
stch-cmd set DIR_CUT FORWARD ;
)

stitchop define-rules R_rules (
assign-lift RP%dP%*d LR_lift ctxt-levramp ;
assign-lift R%*c%dP%*d R_lift ctxt-spiramp ;
)

stitchop define-rules P_rules (
assign-lift RP%dP%*d L_lift ctxt-conramp ;
assign-lift R%*c%dP%*d L_lift ctxt-levpock ;
)

stitchop define-rules C_rules (
assign-lift RL%*dP%*dS0C%d R_lift ctxt-oneway ;
assign-lift RP%*dP%*dS0C%d L_lift ctxt-conramp ;
assign-lift R%*c%*dP%*dS%*dC%d C_lift ctxt-conspi ;
)

stitchop define-rules S_rules (
assign-lift RL%*dP%*dS0C%d L_lift ctxt-oneway ;
assign-lift RP%*dP%*dS0C%d L_lift ctxt-conramp ;
assign-lift R%*c%*dP%*dS%dC%*d L_lift ctxt-conspi ;
)

set STITCH_USE_RAMPS true 
stitchop define-range POCKET_RANGE ()
stitchop define-range LEVEL_RANGE ()
stitchop define-range RAMP_RANGE ()
stitchop define-range CONTOUR_RANGE ()
stitchop define-range SPIRAL_RANGE ()

stitchop define-filter ramp_filt ()

stitchop define-filter non-ramp-filter ()

stitchop intersect-filters all-filters (
include-filter non-ramp-filter ;
include-filter ramp_filt ;
)

set POCKET_DESCEND true
stitchop define-order Order (
assign-order R%*c%*dP%d FWD P_rules ;
assign-order R%*c%dP%*d FWD R_rules ;
assign-order R%c%*dP%*d FWD R_rules ;
assign-order R%*c%*dP%*dS%1[0]C%*d REV C_rules ;
assign-order R%*c%*dP%*dS%*dC%d FWD C_rules ;
assign-order R%*c%*dP%*dS%dC%*d FWD S_rules ;
)




