|  | 
 
 楼主|
发表于 2025-8-30 09:34:22
|
显示全部楼层 
| # Use this command to determine and output proper plane code
 # when G17/18/19 is used in the cycle definition.
 #
 # <04-15-08 gsl> - Add initialization for protection
 # <03-06-08 gsl> - Declare needed global variables
 # <02-28-08 gsl> - Make use of mom_spindle_axis
 # <06-22-09 gsl> - Call PB_CMD_set_principal_axis
 #
 
 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 # This option can be set to 1, if the address of cycle's
 # principal axis needs to be suppressed. (Ex. Siemens controller)
 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 set suppress_principal_axis 0
 
 
 #++++++++++++++++++++++++++++++++++++++++++++++++++++++
 # This option can be set to 1, if the plane code needs
 # to be forced out @ the start of every set of cycles.
 #++++++++++++++++++++++++++++++++++++++++++++++++++++++
 set force_plane_code 0
 
 global mom_cycle_spindle_axis afterG68 afterG68_A afterG68_C drill_G682
 global mom_out_angle_pos dpp_ge roaAMA roaAMC dri_A
 global mom_sys_adjust_code dri_C G80_A_C
 global mom_tool_pitch h_d_wa out_G69
 global mom_prev_out_angle_pos
 global mom_kin_machine_type
 global mom_pos
 global dpp_ge
 global mom_cycle_rapid_to_pos mom_cycle_rapid_to
 global mom_cycle_retract_to_pos mom_cycle_retract_to
 global mom_cycle_feed_to_pos mom_cycle_feed_to
 global mom_out_angle_pos
 global mom_cycle_feed_to_pos
 global mom_mcs_goto
 global mom_prev_pos un_cl
 global mom_prev_out_angle_pos
 global mom_kin_machine_type
 global save_mom_kin_machine_type
 global mom_tool_axis drill_angle
 global mom_result no_G682 dri_A_C_Z roaA_A roaC_C roaA_C
 set dri_A [format "%.3f" $mom_out_angle_pos(0)]
 set dri_C [format "%.3f" $mom_out_angle_pos(1)]
 set G80_A_C 0
 set drill_angle 0
 
 PB_CMD_set_principal_axis
 
 
 switch $mom_cycle_spindle_axis {
 0 {
 set principal_axis X
 }
 1 {
 set principal_axis Y
 }
 2 {
 set principal_axis Z
 }
 default {
 set principal_axis ""
 }
 }
 
 
 if { $suppress_principal_axis && [string length $principal_axis] > 0 } {
 MOM_suppress once $principal_axis
 }
 
 
 if { $force_plane_code } {
 global cycle_init_flag
 
 if { [info exists cycle_init_flag] && [string match "TRUE" $cycle_init_flag] } {
 MOM_force once G_plane
 }
 }
 
 # 钻孔坐标位置:
 if { $roaA_A == 1 || $roaC_C == 1 } {
 if { [format "%.3f" $mom_out_angle_pos(0)] != 0 } {
 if {[format "%.3f" $mom_cycle_retract_to_pos(2)] > $dri_A_C_Z} {
 MOM_output_literal "Z[format "%.3f" $mom_cycle_retract_to_pos(2)]"
 }
 }
 set roaA_A 0
 set roaC_C 0
 }
 
 if { $roaA_C == 1 } {
 if { [format "%.3f" $mom_out_angle_pos(0)] != 0 } {
 MOM_output_literal "output_MAX_Z"
 }
 set roaA_C 0
 }
 
 if {$afterG68 == 1} {
 if {[format "%.3f" $mom_out_angle_pos(0)] != $afterG68_A} {
 MOM_do_template output_caxis_unclamp1
 }
 if {[format "%.3f" $mom_out_angle_pos(1)] != $afterG68_C} {
 #MOM_do_template output_caxis_unclamp2
 }
 if {[format "%.3f" $mom_out_angle_pos(0)] != $afterG68_A || [format "%.3f" $mom_out_angle_pos(1)] != $afterG68_C} {
 if {[format "%.3f" $mom_out_angle_pos(0)] == 0.0} {
 MOM_output_literal "output_MAX_Z"
 MOM_do_template move_stop_time
 #MOM_force once X Y
 MOM_do_template machine_axis_A_C_Drill
 MOM_do_template output_clamp1 ;# 如果前面加“#”,第四轴就不会频繁出现夹紧命令(钻孔)。
 #MOM_do_template output_clamp2 ;# 如果前面加“#”,第五轴就不会频繁出现夹紧命令(钻孔)。
 } else {
 MOM_do_template move_stop_time
 #MOM_force once X Y
 MOM_do_template machine_axis_A_C_Drill
 MOM_do_template output_clamp1 ;# 如果前面加“#”,第四轴就不会频繁出现夹紧命令(钻孔)。
 #MOM_do_template output_clamp2 ;# 如果前面加“#”,第五轴就不会频繁出现夹紧命令(钻孔)。
 }
 }
 
 set afterG68 0
 }
 
 
 
 | 
 |