MACHINE Default

FORMATTING
{
    FORMAT Int "%d"
    
    ADDRESS TSE
    {
        FORMAT      String
        FORCE       off
        LEADER      "TSE("
        TRAILER     ")"
    }
    ADDRESS cycle_70_first
    {
        FORMAT Coordinate
        FORCE always
        LEADER ""
        ZERO_FORMAT Zero_int
    }
    
    ADDRESS cycle_70_parameters
    {
        FORMAT Coordinate
        FORCE always
        LEADER ","
        ZERO_FORMAT Zero_int
    }
    
    ADDRESS cycle_70_int
    {
        FORMAT Int
        FORCE always
        LEADER ","
    }
    ADDRESS NN
    {
        FORMAT Int
        FORCE always
        LEADER "NN"
        TRAILER ":"
    }
    ADDRESS header_program
    {
        FORMAT      String
        FORCE       always
        LEADER      "%_N_"
        TRAILER     "_MPF"
    }
    ADDRESS S_A_TOOL
    {
        FORMAT String
        FORCE always
        LEADER "_S_A_TOOL = "
    }
    ADDRESS S_V_TOOL
    {
        FORMAT String
        FORCE always
        LEADER "_S_V_TOOL = "
    }
    ADDRESS RET
    {
        FORMAT String
        FORCE always
        LEADER "RET"
    }
    ADDRESS STOPRE
    {
        FORMAT String
        FORCE always
        LEADER "STOPRE"
    }
    ADDRESS T_Text
    {
        FORMAT      String
        FORCE       always
        LEADER      ""
    }
    ADDRESS S_s_tec
    {
        FORMAT      String
        FORCE       off
        LEADER      ["S="]
    }
    ADDRESS M_coolant_1
    {
        FORMAT String
        FORCE off
        LEADER "M"
        OMIT "-"
    }
    ADDRESS M_coolant_2
    {
        FORMAT String
        FORCE off
        LEADER "M"
        OMIT "-"
    }
    ADDRESS M_coolant_off
    {
        FORMAT String
        FORCE off
        LEADER "M"
        OMIT "-"
    }
    ADDRESS U
    {
        FORMAT      Coordinate
        FORCE       off
        MAX         99999.999 Abort
        MIN         -99999.999 Abort
        LEADER      ["U"]
    }
    ADDRESS Path
    {
        FORMAT      String
        FORCE       always
        LEADER      ";$PATH=/_N_WKS_DIR/_N_"
        TRAILER     ""
    }
    ADDRESS XC
    {
        FORMAT      Coordinate
        FORCE       off
        MAX         99999.999 Abort
        MIN         -99999.999 Abort
        LEADER      ["XC="]
    }
    ADDRESS G_motion_setting
    {
        FORMAT      Digit_command
        FORCE       off
        LEADER      "G"
        ZERO_FORMAT Zero_command
        OMIT "99"
    }
    BLOCK_TEMPLATE end_of_program
    {
        M[$mom_sys_rewind_code]
    }
    BLOCK_TEMPLATE return_home_value
    {
        Text[SUPA]
        G_motion[$mom_sys_rapid_code]
        X[$mom_retract_home_pos(0)]
        Y[$mom_retract_home_pos(1)]
        Z[$mom_retract_home_pos(2)]
        D[0]
    }
    BLOCK_TEMPLATE return_wcs_value
    {
        G_motion[$mom_sys_rapid_code]
        X[$mom_retract_home_pos(0)]
        Y[$mom_retract_home_pos(1)]
        Z[$mom_retract_home_pos(2)]
    }
    BLOCK_TEMPLATE tool_change_tse
    {
        TSE[\"$je_service_var(tc_vars)\"]
        T_Text[" ; $je_service_var(T_Text)"]
        Text["TCH"]
    }
    BLOCK_TEMPLATE tool_change
    {
        T[=$je_service_var(tc_vars)]
        T_Text[" ; $je_service_var(T_Text)"]
        Text["TCH"]
    }
    BLOCK_TEMPLATE rapid_move_fh
    {
        G_zero[$lib_main_zero_register]
        G_plane[$mom_sys_cutcom_plane_code($mom_cutcom_plane)]\opt
        #G_spin[$mom_sys_spindle_mode_code($spindle_mode)]\opt
        G_cutcom[$mom_sys_cutcom_code($mom_cutcom_status)]\opt
        G_motion[$mom_sys_rapid_code]
        Y[0]
        X[0]
        Z[$mom_pos(2)]
        fourth_axis[$mom_out_angle_pos(0)]
        D[$mom_tool_adjust_register]\opt
        M_spindle[$mom_sys_spindle_direction_code($mom_spindle_direction)]\opt
        M_range[$mom_sys_spindle_range_code($mom_spindle_range)]\opt
        M_coolant[$mom_sys_coolant_code($mom_coolant_mode)]\opt
    }
    BLOCK_TEMPLATE group_begin
    {
        cycle_call[GROUP_BEGIN]\nows
        cycle_start_character[(]\nows
        cycle_text_first[\$lib_parameter(group_begin,_LEVEL)]\nows
        cycle_text[\"\$lib_parameter(group_begin,_NAME)\"]\nows
        cycle_text[\$lib_parameter(group_begin,_SP)]\nows
        cycle_text[\$lib_parameter(group_begin,_MODE)]\nows
        cycle_end_character[)]\nows
    }
    BLOCK_TEMPLATE group_end
    {
        cycle_call[GROUP_END]\nows
        cycle_start_character[(]\nows
        cycle_text_first[\$lib_parameter(group_begin,_LEVEL)]\nows
        cycle_text[\$lib_parameter(group_begin,_SP)]\nows
        cycle_end_character[)]\nows
    }
    BLOCK_TEMPLATE CYCLE70
    {
        cycle_call[CYCLE70] \nows
        cycle_start_character[(] \nows
        cycle_70_first[\$lib_parameter(cycle70,_RTP)] \nows
        cycle_70_parameters[\$lib_parameter(cycle70,_RFP)] \nows
        cycle_70_parameters[\$lib_parameter(cycle70,_SDIS)] \nows
        cycle_70_parameters[\$lib_parameter(cycle70,_DP)] \nows
        cycle_70_parameters[\$lib_parameter(cycle70,_DIATH)] \nows
        cycle_70_parameters[\$lib_parameter(cycle70,_H1)] \nows
        cycle_70_parameters[\$lib_parameter(cycle70,_FAL)] \nows
        cycle_70_parameters[\$lib_parameter(cycle70,_PIT)] \nows
        cycle_70_int[\$lib_parameter(cycle70,_NT)] \nows
        cycle_70_parameters[\$lib_parameter(cycle70,_MID)] \nows
        cycle_text[\$lib_parameter(cycle70,_FFR)]\nows
        cycle_70_int[\$lib_parameter(cycle70,_TYPTH)] \nows
        cycle_text[\$lib_parameter(cycle70,_PA)] \nows
        cycle_text[\$lib_parameter(cycle70,_PO)] \nows
        cycle_text[\$lib_parameter(cycle70,_NSP)] \nows
        cycle_70_int[\$lib_parameter(cycle70,_VARI)] \nows
        cycle_text[1,,,,,100,1] \nows
        cycle_end_character[)] \nows
    }
    BLOCK_TEMPLATE PAL_AUSW
    {
        cycle_call[PAL_AUSW]\nows
        cycle_start_character[(] \nows
        cycle_text_first[\$je_service_var(pgm_count)] \nows
        cycle_end_character[)] \nows
    }
    BLOCK_TEMPLATE machine_mode_mill_init
    {
        G_plane[$mom_sys_cutcom_plane_code($mom_cutcom_plane)]\opt
    }
    BLOCK_TEMPLATE external_subprogram
    {
        Text[$lib_spf(value,subprogram_output_name)]
    }
    BLOCK_TEMPLATE jump_mark
    {
        NN[$je_service_var(pgm_count,safe)]
    }
    BLOCK_TEMPLATE tool_var_S_A_TOOL
    {
        S_A_TOOL[\"$mom_tool_name\"]
        Text[" ; $mom_tool_data($mom_tool_name,tool_description)"]
    }
    BLOCK_TEMPLATE tool_var_S_V_TOOL
    {
        S_V_TOOL[\"$mom_next_tool_name\"]
        Text[" ; $mom_tool_data($mom_next_tool_name,tool_description)"]
    }
    BLOCK_TEMPLATE end_of_subprogram
    {
        STOPRE[ ]
        RET[ ]
    }
    BLOCK_TEMPLATE tool_change_init
    {
        G_cutcom[40]
        G_zero[99]
        G_plane[99]
        G_feed[0]
        G_motion[99]
        G_mode[99]
        X[99999.999]
        Y[99999.999]
        Z[99999.999]
        fourth_axis[9999.999]
        fifth_axis[9999.999]
        I[99999.999]
        J[99999.999]
        K[99999.999]
        R[99999.999]
        D[99]
        M_spindle[$mom_sys_spindle_direction_code(OFF)]
        F[0.0001]
    }
    BLOCK_TEMPLATE rapid_move
    {
        G_cutcom[$mom_sys_cutcom_code($mom_cutcom_status)]\opt
        G_plane[$mom_sys_cutcom_plane_code($mom_cutcom_plane)]\opt
        G_motion[$mom_sys_rapid_code]
        X[$mom_pos(0)*$x_factor]
        Y[$mom_pos(1)]
        Z[$mom_pos(2)]
        fourth_axis[$mom_out_angle_pos(0)]
        fifth_axis[$mom_out_angle_pos(1)]
        X_vector[$mom_tool_axis(0)]\opt
        Y_vector[$mom_tool_axis(1)]\opt
        Z_vector[$mom_tool_axis(2)]\opt
        S[$mom_spindle_rpm]
        D[$mom_tool_adjust_register]
        M_spindle[$mom_sys_spindle_direction_code($mom_spindle_direction)]\opt
        M_range[$mom_sys_spindle_range_code($mom_spindle_range)]\opt
        M_coolant_1[$coolant_on(1)]
        M_coolant_2[$coolant_on(2)]
    }
    BLOCK_TEMPLATE rapid_move_turn_fh
    {
        G_plane[17]\opt
        #G_spin[$mom_sys_spindle_mode_code($spindle_mode)]\opt
        G_cutcom[$mom_sys_cutcom_code($mom_cutcom_status)]\opt
        G_motion[$mom_sys_rapid_code]
        X[$X_value]
        Y[0]
        Z[$mom_pos(2)]
        fourth_axis[$mom_out_angle_pos(0)]
        D[$mom_tool_adjust_register]\opt
        # M_spindle[$mom_sys_spindle_direction_code($mom_spindle_direction)]\opt
        M_range[$mom_sys_spindle_range_code($mom_spindle_range)]\opt
        M_coolant_1[$coolant_on(1)]
        M_coolant_2[$coolant_on(2)]
    }
    BLOCK_TEMPLATE coolant_on
    {
        M_coolant_1[$coolant_on(1)]
        M_coolant_2[$coolant_on(2)]
    }
    BLOCK_TEMPLATE coolant_init
    {
        M_coolant_1[99]
        M_coolant_2[99]
        M_coolant_off[99]
    }
    BLOCK_TEMPLATE coolant_off
    {
        M_coolant_off[$coolant_off(1)]
    }
    BLOCK_TEMPLATE wzw_pos
    {
        Text["WZW_POS"]
    }
    BLOCK_TEMPLATE reset_pos_XYZ
    {
        X[99999]
        Y[99999]
        Z[99999]
    }
    BLOCK_TEMPLATE geoax
    {
        cycle_call[GEOAX]\nows
        cycle_start_character[(]\nows
        cycle_text_first[\$je_service_var(geoax,n)]\nows
        cycle_text[\$je_service_var(geoax,AXIS)]\nows
        cycle_end_character[)] \nows
    }
    BLOCK_TEMPLATE turning_plane_fh
    {
        D[$mom_tool_adjust_register]\opt
        G_plane[18]\opt
        XC[0]
    }
    BLOCK_TEMPLATE reset_u_axis
    {
        G_motion[$mom_sys_rapid_code]
        G_spin[94]
        U[0]
    }
    BLOCK_TEMPLATE path_header
    {
        Path["$je_service_var(wpd)"]
    }
    BLOCK_TEMPLATE header_program
    {
        header_program[$lib_spf(value,output_file_basename)]
    }
    BLOCK_TEMPLATE cycle_move_pre_pos
    {
        G_feed[$mom_sys_feed_rate_mode_code($feed_mode)]
        G_motion[$mom_sys_linear_code]
        X[$mom_cycle_rapid_to_pos(0)*$x_factor]
        Y[$mom_cycle_rapid_to_pos(1)]
        Z[$mom_cycle_rapid_to_pos(2)]
        fourth_axis[$mom_out_angle_pos(0)]
        fifth_axis[$mom_out_angle_pos(1)]
        M_coolant[$mom_sys_coolant_code($mom_coolant_mode)]\opt
        D[$mom_tool_adjust_register]\opt
        F[$mom_feed_engage_value]
    }
    BLOCK_TEMPLATE rapid_move_s_tec
    {
        G_cutcom[$mom_sys_cutcom_code($mom_cutcom_status)]\opt
        G_plane[$mom_sys_cutcom_plane_code($mom_cutcom_plane)]\opt
        G_motion[$mom_sys_rapid_code]
        X[$mom_pos(0)*$x_factor]
        Y[$mom_pos(1)]
        Z[$mom_pos(2)]
        fourth_axis[$mom_out_angle_pos(0)]
        fifth_axis[$mom_out_angle_pos(1)]
        X_vector[$mom_tool_axis(0)]\opt
        Y_vector[$mom_tool_axis(1)]\opt
        Z_vector[$mom_tool_axis(2)]\opt
        S_s_tec["R717"]
        D[$mom_tool_adjust_register]
        M_spindle[$mom_sys_spindle_direction_code($mom_spindle_direction)]\opt
        M_range[$mom_sys_spindle_range_code($mom_spindle_range)]\opt
        M_coolant_1[$coolant_on(1)]
        M_coolant_2[$coolant_on(2)]
    }
    BLOCK_TEMPLATE linear_move_s_tec
    {
        G_cutcom[$mom_sys_cutcom_code($mom_cutcom_status)]\opt
        G_plane[$mom_sys_cutcom_plane_code($mom_cutcom_plane)]\opt
        G_feed[$mom_sys_feed_rate_mode_code($feed_mode)]
        G_motion[$mom_sys_linear_code]
        G_mode[$mom_sys_output_code($mom_output_mode)]
        X[$mom_pos(0)*$x_factor]
        Y[$mom_pos(1)]
        Z[$mom_pos(2)]
        fourth_axis[$mom_out_angle_pos(0)]
        fifth_axis[$mom_out_angle_pos(1)]
        X_vector[$mom_tool_axis(0)]\opt
        Y_vector[$mom_tool_axis(1)]\opt
        Z_vector[$mom_tool_axis(2)]\opt
        A5[$mom_contact_normal(0)]\opt
        B5[$mom_contact_normal(1)]\opt
        C5[$mom_contact_normal(2)]\opt
        S_s_tec["R717"]
        D[$mom_tool_adjust_register]\opt
        M_spindle[$mom_sys_spindle_direction_code($mom_spindle_direction)]\opt
        M_range[$mom_sys_spindle_range_code($mom_spindle_range)]\opt
        M_coolant[$mom_sys_coolant_code($mom_coolant_mode)]\opt
        F[$feed]
    }
    BLOCK_TEMPLATE circular_move_s_tec
    {
        G_cutcom[$mom_sys_cutcom_code($mom_cutcom_status)]\opt
        G_plane[$mom_sys_cutcom_plane_code($mom_pos_arc_plane)]\opt
        G_feed[$mom_sys_feed_rate_mode_code($feed_mode)]
        G_motion[$mom_sys_circle_code($mom_arc_direction)]\opt
        G_mode[$mom_sys_output_code($mom_output_mode)]
        X[$mom_pos(0)*$x_factor]
        Y[$mom_pos(1)]
        Z[$mom_pos(2)]
        I[($mom_pos_arc_center(0) - $mom_prev_pos(0))*$i_factor]
        J[$mom_pos_arc_center(1) - $mom_prev_pos(1)]
        K[$mom_pos_arc_center(2) - $mom_prev_pos(2)]
        R[$mom_arc_radius]
        helix_turn[$mom_helix_turn_number]\opt
        S_s_tec["R717"]
        M_spindle[$mom_sys_spindle_direction_code($mom_spindle_direction)]\opt
        M_range[$mom_sys_spindle_range_code($mom_spindle_range)]\opt
        M_coolant[$mom_sys_coolant_code($mom_coolant_mode)]\opt
        F[$feed]
    }
    BLOCK_TEMPLATE cycle_feed_mode_s_tec
    {
        G_plane[$mom_sys_cutcom_plane_code($mom_cutcom_plane)]\opt
        G_feed[$mom_sys_feed_rate_mode_code($mom_cycle_feed_rate_mode)]
        S_s_tec["R717"]
        M_spindle[$mom_sys_spindle_direction_code($mom_spindle_direction)]\opt
        M_range[$mom_sys_spindle_range_code($mom_spindle_range)]\opt
        F[$feed]
    }
    BLOCK_TEMPLATE motion_settings
    {
        G_motion_setting[$je_service_var(motion_setting)]
    }
}