UG后处理—进给速度R模式输出研究

进给速度F之R模式输出

前言:

问题描述:

在机床加工过程中,通过UG CAM生成的数控程序段中可能存在多个进给速度,比如切削进给速度,逼近速度,进刀速度,第一刀切削速度,步进速度,退刀速度等等,如果利用常用的数值模式输出,在实际加工过程中容易出现两个问题:
① 在数控程序较大时候,如果需要对其中一个速度进行修改,可能出现搜索困难等问题
② 在数控程序中,同一个速度类型可能在多个代码段中使用,如果用数值模式输出,往往需要一一进行修改,造成工作量增大等问题

解决:

针对这个问题,不同的数控系统厂商都提供了自家关于进给速度变量控制方式,需要用户自行通过后置处理程序进行配置,那么以变量控制的好处是什么呢?
首先,如果以变量形式控制进给速度,可以在程序头统一体现,便于统一观察、管理及调用变量值,
其次,在修改进给参数时候,可以通过修改变量对应的数值来修改整个类型的进给速度,也可以通过对过程中的具体某个数值进行修改,操作方式更为灵活。

后处理编程过程:

虽然不同数控厂商的变量设置形式不同,当后处理程序段逻辑思路类似,以下我们以西门子840D系统为例,进行编程验证:

TCL程序段

#=============================================================
proc PB_CMD_wjc_value_msg_ini { } {
#=============================================================
uplevel #0 {
#  # 常规进给速度输出格式:
#  # "0" 或其它非 "1" "2"字符, 输出数字
#  # "1", 输出 R 参数格式进给速度, R 值为进给速度值
 set wjc_feed_output_format                "1"
#
#  # 当常规进给速度只有一个或一种速度时输出格式:
#  # "0" 或其它非 "1" 字符, 输出数字
#  # "1", 只有一个或一种速度时跟随输出 R 参数格式进给速度
 set wjc_feed_single_output_format            "0"
};#enduplevel
}
#=============================================================
proc PB_CMD_wjc_value_set_ini { } {
#=============================================================
#初始用户变量设定,在系统初始变量中设定
uplevel #0 {
  set mom_feed_rapid_value                                        "0"
  set mom_feed_approach_value                                     "0"
  set mom_feed_engage_value                                       "0"
  set mom_feed_first_cut_value                                    "0"
  set mom_feed_stepover_value                                     "0"
  set mom_feed_cut_value                                          "0"
  set mom_feed_traversal_value                                    "0"
  set mom_feed_retract_value                                      "0"
  set mom_feed_return_value                                       "0"
  set mom_feed_departure_value                                    "0"

  set custom_feed_rapid_text                                       ""
  set custom_feed_approach_text                                    ""
  set custom_feed_engage_text                                      ""
  set custom_feed_first_cut_text                                   ""
  set custom_feed_stepover_text                                    ""
  set custom_feed_cut_text                                         ""
  set custom_feed_traversal_text                                   ""
  set custom_feed_retract_text                                     ""
  set custom_feed_return_text                                      ""
  set custom_feed_departure_text                                   ""
  set custom_feed_rate_text                                        ""
  set custom_feed_base_value_text                                  ""

  set custom_sys_leader_F                                          "F"
  set custom_sys_trailer_F                                          ""
   }; # end_uplevel
}

#=============================================================
proc PB_CMD_wjc_feed_check { } {
#=============================================================
#检测当前Feed设置形式,用于mom_before_motion中PB_CMD_wjc_feed_R_mode_replace前判定
#用于判定UG进给速度设置形式,是否是同一速度或不同速度等
  global  mom_feed_rapid_value   #参数变量需要自行在mom变量中确认
  global  mom_feed_approach_value
  global  mom_feed_engage_value
  global  mom_feed_first_cut_value
  global  mom_feed_stepover_value
  global  mom_feed_cut_value
  global  mom_feed_traversal_value
  global  mom_feed_retract_value
  global  mom_feed_return_value
  global  mom_feed_departure_value
  global  custom_flag_feed_type_count
if {[EQ_is_zero $mom_feed_rapid_value]   &&  [EQ_is_zero $mom_feed_approach_value]        && \
  [EQ_is_zero $mom_feed_engage_value]  && [EQ_is_zero $mom_feed_first_cut_value]    && \
  [EQ_is_zero $mom_feed_stepover_value]  && [EQ_is_zero $mom_feed_traversal_value]    && \
  [EQ_is_zero $mom_feed_retract_value]  &&  [EQ_is_zero $mom_feed_departure_value] }  {
set custom_flag_feed_type_count 1
  } elseif {
 ([EQ_is_zero $mom_feed_rapid_value] || [EQ_is_equal $mom_feed_cut_value $mom_feed_rapid_value])  && \
 ([EQ_is_zero $mom_feed_approach_value]    || [EQ_is_equal $mom_feed_cut_value $mom_feed_approach_value])  && \
([EQ_is_zero $mom_feed_engage_value]  || [EQ_is_equal $mom_feed_cut_value $mom_feed_engage_value])        && \
([EQ_is_zero $mom_feed_first_cut_value]    || [EQ_is_equal $mom_feed_cut_value $mom_feed_first_cut_value])    && \
 ([EQ_is_zero $mom_feed_stepover_value]    || [EQ_is_equal $mom_feed_cut_value $mom_feed_stepover_value])    && \
 ([EQ_is_zero $mom_feed_traversal_value]    || [EQ_is_equal $mom_feed_cut_value $mom_feed_traversal_value])    && \
 ([EQ_is_zero $mom_feed_retract_value]        || [EQ_is_equal $mom_feed_cut_value $mom_feed_retract_value])     && \
  ([EQ_is_zero $mom_feed_departure_value]    || [EQ_is_equal $mom_feed_cut_value $mom_feed_departure_value])   }  {
  set custom_flag_feed_type_count 2
  } else {
  set custom_flag_feed_type_count 0
  }
}

#=============================================================
proc PB_CMD_wjc_feed_R_mode_output { } {
#=============================================================
#输出R模式格式,该程序段用于生成R模式的参数值及程序段头显示
#custom_flag_feed_type_count 均为0设置为1  均为0或者与切削速度相同为2  其他情况为0
  global  feed
  global  custom_feed
  global  mom_template_type

  global  custom_sys_leader_F
  global  custom_sys_trailer_F
  global  custom_sys_leader_F_output
  global  custom_sys_trailer_F_output

  global  mom_feed_rapid_value
  global  mom_feed_approach_value
  global  mom_feed_engage_value
  global  mom_feed_first_cut_value
  global  mom_feed_stepover_value
  global  mom_feed_cut_value
  global  mom_feed_traversal_value
  global  mom_feed_retract_value
  global  mom_feed_return_value
  global  mom_feed_departure_value

  global  custom_feed_rapid_value
  global  custom_feed_approach_value
  global  custom_feed_engage_value
  global  custom_feed_first_cut_value
  global  custom_feed_stepover_value
  global  custom_feed_cut_value
  global  custom_feed_traversal_value
  global  custom_feed_retract_value
  global  custom_feed_return_value
  global  custom_feed_departure_value

  global  custom_feed_rapid_text
  global  custom_feed_approach_text
  global  custom_feed_engage_text
  global  custom_feed_first_cut_text
  global  custom_feed_stepover_text
  global  custom_feed_cut_text
  global  custom_feed_traversal_text
  global  custom_feed_retract_text
  global  custom_feed_return_text
  global  custom_feed_departure_text
  global  custom_feed_rate_text
  global  custom_feed_base_value_text

  global  custom_flag_feed_type_count

  global  mom_seqnum
  global  custom_seqnum_length_old
  global  custom_seqnum_length_new

  global  custom_R_number
  global  custom_blanks_length_max
  global  custom_blanks_length_min
  global  custom_blanks_temp
  global  custom_blanks
  global  custom_blanks_1
  global  custom_blanks_2

  # for NX8
  global  mom_feed_rapid_unit
  global  mom_feed_approach_unit
  global  mom_feed_engage_unit
  global  mom_feed_first_cut_unit
  global  mom_feed_stepover_unit
  global  mom_feed_cut_unit
  global  mom_feed_traversal_unit
  global  mom_feed_retract_unit
  global  mom_feed_return_unit
  global  mom_feed_departure_unit

  global  mom_feed_rapid_nominal_unit
  global  mom_feed_approach_nominal_unit
  global  mom_feed_engage_nominal_unit
  global  mom_feed_first_cut_nominal_unit
  global  mom_feed_stepover_nominal_unit
  global  mom_feed_cut_nominal_unit
  global  mom_feed_traversal_nominal_unit
  global  mom_feed_retract_nominal_unit
  global  mom_feed_return_nominal_unit
  global  mom_feed_departure_nominal_unit

  global  mom_feed_rapid_nominal_value
  global  mom_feed_approach_nominal_value
  global  mom_feed_engage_nominal_value
  global  mom_feed_first_cut_nominal_value
  global  mom_feed_stepover_nominal_value
  global  mom_feed_cut_nominal_value
  global  mom_feed_traversal_nominal_value
  global  mom_feed_retract_nominal_value
  global  mom_feed_return_nominal_value
  global  mom_feed_departure_nominal_value
  global  mom_ug_version
 #MOM_output_literal "mom_ug_version = $mom_ug_version "
 #MOM_output_literal "mom_feed_first_cut_nominal_value = $mom_feed_first_cut_nominal_value "    

 if  {$mom_ug_version >= "8.0"} {
# -01-
      if {[info exists mom_feed_cut_nominal_unit]} {
      switch $mom_feed_cut_nominal_unit {
                "None"            { }
                "mmpm"            { }
                "mmpr"            { }
                default            { }
      }
      }

      # -02-
      if {[info exists mom_feed_rapid_nominal_unit]} {
  switch $mom_feed_rapid_nominal_unit {
                "None"            {    }
                "mmpm"            { }
                "mmpr"            { }
                "Rapid"            { }
   "%Cut"    { set mom_feed_rapid_value     [expr $mom_feed_rapid_nominal_value / 100.0 * $mom_feed_cut_value] }
                default            { }
      }
      }

        # -03-
        if {[info exists mom_feed_approach_nominal_unit]} {
        switch $mom_feed_approach_nominal_unit {
                "None"            {    }
                "mmpm"            { }
                "mmpr"            { }
                "Rapid"            { }
    "%Cut" { set mom_feed_approach_value  [expr $mom_feed_approach_nominal_value / 100.0 * $mom_feed_cut_value] }
                default            { }
      }
      }

      # -04-
      if {[info exists mom_feed_engage_nominal_unit]} {
      switch $mom_feed_engage_nominal_unit {
                "None"            {    }
                "mmpm"            { }
                "mmpr"            { }
                "Rapid"            { }
 "%Cut"   { set mom_feed_engage_value    [expr $mom_feed_engage_nominal_value / 100.0 * $mom_feed_cut_value] }
                default            { }
      }
      }

      # -05-
      if {[info exists mom_feed_first_cut_nominal_unit]} {
      switch $mom_feed_first_cut_nominal_unit {
                "None"            {    }
                "mmpm"            { }
                "mmpr"            { }
                "Rapid"            { }
   "%Cut"   { set mom_feed_first_cut_value  [expr $mom_feed_first_cut_nominal_value / 100.0 * $mom_feed_cut_value] }
                default            { }
      }
      }

      # -06-
      if {[info exists mom_feed_stepover_nominal_unit]} {
      switch $mom_feed_stepover_nominal_unit {
                "None"            {    }
                "mmpm"            { }
                "mmpr"            { }
                "Rapid"            { }
     "%Cut"  { set mom_feed_stepover_value  [expr $mom_feed_stepover_nominal_value / 100.0 * $mom_feed_cut_value] }
                default            { }
      }
      }

      # -07-
      if {[info exists mom_feed_traversal_nominal_unit]} {
      switch $mom_feed_traversal_nominal_unit {
                "None"            {    }
                "mmpm"            { }
                "mmpr"            { }
                "Rapid"            { }
  "%Cut"  { set mom_feed_traversal_value   [expr $mom_feed_traversal_nominal_value / 100.0 * $mom_feed_cut_value] }
                default            { }
      }
      }

      # -08-
      if {[info exists mom_feed_retract_nominal_unit]} {
      switch $mom_feed_retract_nominal_unit {
                "None"            {    }
                "mmpm"            { }
                "mmpr"            { }
                "Rapid"            { }
   "%Cut"    { set mom_feed_retract_value  [expr $mom_feed_retract_nominal_value / 100.0 * $mom_feed_cut_value] }
                default            { }
      }
      }

      # -09-
   if {[info exists mom_feed_return_nominal_unit]} {
   switch $mom_feed_return_nominal_unit {
                "None"            {    }
              "mmpm"            { }
                "mmpr"            { }
                "Rapid"            { }
  "%Cut"    { set mom_feed_return_value   [expr $mom_feed_return_nominal_value / 100.0 * $mom_feed_cut_value] }
              default            { }
        }
      }

      # -10-
      if {[info exists mom_feed_departure_nominal_unit]} {
      switch $mom_feed_departure_nominal_unit {
                "None"            {    }
                "mmpm"            { }
                "mmpr"            { }
                "Rapid"            { }
     "%Cut" { set mom_feed_departure_value[expr $mom_feed_departure_nominal_value / 100.0 * $mom_feed_cut_value] }
                default            { }
      }
      }
}
 #MOM_output_literal "mom_feed_first_cut_value = $mom_feed_first_cut_value"
#-----------------------
#设置F输出格式flag,如无pui文件,则在def中修改格式
  set custom_sys_leader_F_output                      $custom_sys_leader_F
  set custom_sys_trailer_F_output                     $custom_sys_trailer_F
  set custom_template_type                           [string toupper $mom_template_type]

 if {[EQ_is_zero $mom_feed_rapid_value]  &&  [EQ_is_zero $mom_feed_approach_value]     && \
   [EQ_is_zero $mom_feed_engage_value]   &&  [EQ_is_zero $mom_feed_first_cut_value]    && \
   [EQ_is_zero $mom_feed_stepover_value]  && [EQ_is_zero $mom_feed_traversal_value]    && \
   [EQ_is_zero $mom_feed_retract_value]  &&  [EQ_is_zero $mom_feed_departure_value]    } {
  set custom_flag_feed_type_count 1
  } elseif {
([EQ_is_zero $mom_feed_rapid_value]  || [EQ_is_equal $mom_feed_cut_value $mom_feed_rapid_value])   && \ ([EQ_is_zero $mom_feed_approach_value]   || [EQ_is_equal $mom_feed_cut_value $mom_feed_approach_value])    && \
([EQ_is_zero $mom_feed_engage_value]  || [EQ_is_equal $mom_feed_cut_value $mom_feed_engage_value])        && \ ([EQ_is_zero $mom_feed_first_cut_value]    || [EQ_is_equal $mom_feed_cut_value $mom_feed_first_cut_value])    && \
 ([EQ_is_zero $mom_feed_stepover_value]    || [EQ_is_equal $mom_feed_cut_value $mom_feed_stepover_value])    && \
 ([EQ_is_zero $mom_feed_traversal_value]    || [EQ_is_equal $mom_feed_cut_value $mom_feed_traversal_value])    && \
([EQ_is_zero $mom_feed_retract_value]  || [EQ_is_equal $mom_feed_cut_value $mom_feed_retract_value])        && \
([EQ_is_zero $mom_feed_departure_value] || [EQ_is_equal $mom_feed_cut_value $mom_feed_departure_value])  } {
  set custom_flag_feed_type_count 2
  } else {
  set custom_flag_feed_type_count 0
  }
  #测试用
  global  wjc_feed_output_format  wjc_feed_single_output_format

  if {$wjc_feed_output_format != 1 } {return}
    if {$wjc_feed_single_output_format != 1} {
    if {$custom_flag_feed_type_count == 1 || $custom_flag_feed_type_count == 2} {
  return
    }
   }

  set custom_R_number    0

  set custom_blanks                 ""
  set custom_blanks_1               "    "
  set custom_blanks_2               "; "
   #-----------------------------------
  set custom_feed_rapid_value           [string trimright [string trimright [format %.3f $mom_feed_rapid_value] 0] .]
  set custom_feed_approach_value        [string trimright [string trimright [format %.3f $mom_feed_approach_value] 0] .]
  set custom_feed_engage_value          [string trimright [string trimright [format %.3f $mom_feed_engage_value] 0] .]
  set custom_feed_first_cut_value       [string trimright [string trimright [format %.3f $mom_feed_first_cut_value] 0] .]
  set custom_feed_stepover_value        [string trimright [string trimright [format %.3f $mom_feed_stepover_value] 0] .]
  set custom_feed_cut_value             [string trimright [string trimright [format %.3f $mom_feed_cut_value] 0] .]
  set custom_feed_traversal_value       [string trimright [string trimright [format %.3f $mom_feed_traversal_value] 0] .]
  set custom_feed_retract_value         [string trimright [string trimright [format %.3f $mom_feed_retract_value] 0] .]
  set custom_feed_return_value          [string trimright [string trimright [format %.3f $mom_feed_return_value] 0] .]
  set custom_feed_departure_value       [string trimright [string trimright [format %.3f $mom_feed_departure_value] 0] .]
  #-----------------------------------
  set custom_blanks_length_max            [string length $custom_feed_rapid_value]

  set custom_seqnum_length_old              [expr [string length $mom_seqnum]-18]
  set custom_blanks_length_max                 [expr $custom_seqnum_length_old+6+$custom_blanks_length_max]
#测试用
#    MOM_output_literal "mom_seqnum:$mom_seqnum"
#   MOM_output_literal "custom_seqnum_length_old:$custom_seqnum_length_old"
#  MOM_output_literal "custom_blanks_length_max:$custom_blanks_length_max"
 #-----------------------------------
 #输出R模式程序头
 #1
 if {![EQ_is_zero $mom_feed_rapid_value] && ($mom_feed_cut_value != $mom_feed_rapid_value)} {
  incr custom_R_number
  set custom_blanks_length_min            [string length $custom_feed_rapid_value]
 #PB_CMD_wjc_blank_comment $custom_blanks_length_max    $custom_blanks_length_min
  MOM_output_literal "R\[$custom_R_number\]=${custom_feed_rapid_value}${custom_blanks}${custom_blanks_2}FEED_RAPID"
  set custom_feed_rapid_text                "=R\[$custom_R_number\]"
  } else {
  set custom_feed_rapid_text                ""
  }
 #2
 if {![EQ_is_zero $mom_feed_approach_value] && ($mom_feed_cut_value != $mom_feed_approach_value)} {
  incr custom_R_number
  set custom_blanks_length_min            [string length $custom_feed_approach_value]
 #PB_CMD_wjc_blank_comment $custom_blanks_length_max    $custom_blanks_length_min
  MOM_output_literal "R\[$custom_R_number\]=${custom_feed_approach_value}${custom_blanks}${custom_blanks_2}FEED_APPROACH"
  set custom_feed_approach_text            "=R\[$custom_R_number\]"
  } else {
  set custom_feed_approach_text            ""
  }
  #3
  if {![EQ_is_zero $mom_feed_engage_value] && ($mom_feed_cut_value != $mom_feed_engage_value)} {
  incr custom_R_number
  set custom_blanks_length_min            [string length $custom_feed_engage_value]
  #PB_CMD_wjc_blank_comment $custom_blanks_length_max    $custom_blanks_length_min 
  MOM_output_literal "R\[$custom_R_number\]=${custom_feed_engage_value}${custom_blanks}${custom_blanks_2}FEED_ENGAGE"
  set custom_feed_engage_text                "=R\[$custom_R_number\]"
  } else {
  set custom_feed_engage_text                ""
  }
  #4
  if {![EQ_is_zero $mom_feed_first_cut_value] && ($mom_feed_cut_value != $mom_feed_first_cut_value)} {
  incr custom_R_number
  set custom_blanks_length_min            [string length $custom_feed_first_cut_value]
  #PB_CMD_wjc_blank_comment $custom_blanks_length_max    $custom_blanks_length_min
  MOM_output_literal "R\[$custom_R_number\]=${custom_feed_first_cut_value}${custom_blanks}${custom_blanks_2}FEED_FIRST_CUT"
  set custom_feed_first_cut_text        "=R\[$custom_R_number\]"
  } else {
  set custom_feed_first_cut_text        ""
  }
  #5
  if {![EQ_is_zero $mom_feed_stepover_value] && ($mom_feed_cut_value != $mom_feed_stepover_value)} {
  incr custom_R_number
  set custom_blanks_length_min            [string length $custom_feed_stepover_value]
  #PB_CMD_wjc_blank_comment $custom_blanks_length_max    $custom_blanks_length_min
  MOM_output_literal "R\[$custom_R_number\]=${custom_feed_stepover_value}${custom_blanks}${custom_blanks_2}FEED_STEPOVER"
  set custom_feed_stepover_text            "=R\[$custom_R_number\]"
  } else {
  set custom_feed_stepover_text            ""
  }
  #6
  if {![EQ_is_zero $mom_feed_cut_value]} {
  incr custom_R_number
  set custom_blanks_length_min            [string length $custom_feed_cut_value]
  #PB_CMD_wjc_blank_comment $custom_blanks_length_max    $custom_blanks_length_min
  MOM_output_literal "R\[$custom_R_number\]=${custom_feed_cut_value}${custom_blanks}${custom_blanks_2}FEED_CUT"
  set custom_feed_cut_text                    "=R\[$custom_R_number\]"
  } else {
  set custom_feed_cut_text                    "250."
  }
  #7
  if {![EQ_is_zero $mom_feed_traversal_value] && ($mom_feed_cut_value != $mom_feed_traversal_value)} {
  incr custom_R_number
  set custom_blanks_length_min            [string length $custom_feed_traversal_value]
  #PB_CMD_wjc_blank_comment $custom_blanks_length_max    $custom_blanks_length_min
  MOM_output_literal "R\[$custom_R_number\]=${custom_feed_traversal_value}${custom_blanks}${custom_blanks_2}FEED_TRAVERSAL"
  set custom_feed_traversal_text        "=R\[$custom_R_number\]"
  } else {
  set custom_feed_traversal_text        ""
  }
  #8
  if {![EQ_is_zero $mom_feed_retract_value] && ($mom_feed_cut_value != $mom_feed_retract_value)} {
  incr custom_R_number
  set custom_blanks_length_min            [string length $custom_feed_retract_value]
  #PB_CMD_wjc_blank_comment $custom_blanks_length_max    $custom_blanks_length_min
  MOM_output_literal "R\[$custom_R_number\]=${custom_feed_retract_value}${custom_blanks}${custom_blanks_2}FEED_RETRACT"
  set custom_feed_retract_text            "=R\[$custom_R_number\]"
  } else {
  set custom_feed_retract_text            ""
  }
  #9
  if {![EQ_is_zero $mom_feed_return_value] && ($mom_feed_cut_value != $mom_feed_return_value)} {
  incr custom_R_number
  set custom_blanks_length_min            [string length $custom_feed_return_value]
  #PB_CMD_wjc_blank_comment $custom_blanks_length_max    $custom_blanks_length_min
  MOM_output_literal "R\[$custom_R_number\]=${custom_feed_return_value}${custom_blanks}${custom_blanks_2}FEED_RETURN"
  set custom_feed_return_text                "=R\[$custom_R_number\]"
  } else {
  set custom_feed_return_text                ""
  }
  #10
  if {![EQ_is_zero $mom_feed_departure_value] && ($mom_feed_cut_value != $mom_feed_departure_value)} {
  incr custom_R_number
  set custom_blanks_length_min            [string length $custom_feed_departure_value]
  #PB_CMD_wjc_blank_comment $custom_blanks_length_max    $custom_blanks_length_min
  MOM_output_literal "R\[$custom_R_number\]=${custom_feed_departure_value}${custom_blanks}${custom_blanks_2}FEED_DEPARTURE"
  set custom_feed_departure_text        "=R\[$custom_R_number\]"
  } else {
  set custom_feed_departure_text        ""
  }
  #-----------------------------------
 #进行string文本内容更新
  if {$custom_feed_engage_text == "" } {
  set custom_feed_engage_text                $custom_feed_cut_text
  }

  if {$custom_feed_first_cut_text == ""} {
  set custom_feed_first_cut_text        $custom_feed_cut_text
  }

  if {$custom_feed_stepover_text == ""} {
  set custom_feed_stepover_text            $custom_feed_cut_text
  }

  #-----------------------------------
  # for NX8
  if {$mom_feed_cut_value == $mom_feed_rapid_value} {
  set custom_feed_rapid_text                $custom_feed_cut_text
  }

  if {$mom_feed_cut_value == $mom_feed_approach_value} {
  set custom_feed_approach_text            $custom_feed_cut_text
  }

  if {$mom_feed_cut_value == $mom_feed_engage_value} {
  set custom_feed_engage_text                $custom_feed_cut_text
  }

  if {$mom_feed_cut_value == $mom_feed_first_cut_value} {
  set custom_feed_first_cut_text        $custom_feed_cut_text
  }

  if {$mom_feed_cut_value == $mom_feed_stepover_value} {
  set custom_feed_stepover_text          $custom_feed_cut_text
  }

  if {$mom_feed_cut_value == $mom_feed_traversal_value} {
  set custom_feed_traversal_text        $custom_feed_cut_text
  }

  if {$mom_feed_cut_value == $mom_feed_retract_value} {
  set custom_feed_retract_text           $custom_feed_cut_text
  }

  if {$mom_feed_cut_value == $mom_feed_return_value} {
  set custom_feed_return_text            $custom_feed_cut_text
  }

  if {$mom_feed_cut_value == $mom_feed_departure_value} {
  set custom_feed_departure_text        $custom_feed_cut_text
  }
}


#=============================================================
proc PB_CMD_wjc_feed_R_mode_replace { } {
#=============================================================
#F输出R模式
#替换数字输出格式,需要在初始移动和第一刀位移放置,并置于R_mode_output后,同时需要在before_motion中放置

  global  wjc_feed_output_format
  global  wjc_feed_single_output_format
  global  feed
  global  custom_feed
  global  mom_template_type

  global  mom_feed_rapid_value
  global  mom_feed_approach_value
  global  mom_feed_engage_value
  global  mom_feed_first_cut_value
  global  mom_feed_stepover_value
  global  mom_feed_cut_value
  global  mom_feed_traversal_value
  global  mom_feed_retract_value
  global  mom_feed_return_value
  global  mom_feed_departure_value

  global  custom_flag_feed_type_count
  global  feed
  global  custom_feed
  global  mom_template_type

  global  mom_feed_rapid_value
  global  mom_feed_approach_value
  global  mom_feed_engage_value
  global  mom_feed_first_cut_value
  global  mom_feed_stepover_value
  global  mom_feed_cut_value
  global  mom_feed_traversal_value
  global  mom_feed_retract_value
  global  mom_feed_return_value
  global  mom_feed_departure_value

  global  custom_flag_feed_type_count
#以下内容为判别是否需要R模式输出
 if {$wjc_feed_output_format != 1} {
  return
 } else {
  if {$custom_flag_feed_type_count == 1 || $custom_flag_feed_type_count == 2} {
  MOM_set_address_format F Feed
  set custom_feed $feed
  return
  }
}

  if {$wjc_feed_single_output_format = 0} {
  	if {$custom_flag_feed_type_count == 1 || $custom_flag_feed_type_count == 2} {
  MOM_set_address_format F Feed
  set custom_feed $feed
  return
  }
}
 #替换变量过程 	
  global  mom_motion_type

  global  custom_feed_rapid_text
  global  custom_feed_approach_text
  global  custom_feed_engage_text
  global  custom_feed_first_cut_text
  global  custom_feed_stepover_text
  global  custom_feed_cut_text
  global  custom_feed_traversal_text
  global  custom_feed_retract_text
  global  custom_feed_return_text
  global  custom_feed_departure_text
  MOM_set_address_format F String

 switch $mom_motion_type {
  RAPID        {
           set custom_feed        $custom_feed_rapid_text
              }
  APPROACH    {
           set custom_feed        $custom_feed_approach_text
              }
  ENGAGE      {
           set custom_feed        $custom_feed_engage_text
              }
  FIRSTCUT    {
           set custom_feed        $custom_feed_first_cut_text
              }
  STEPOVER   {
           set custom_feed        $custom_feed_stepover_text
             }
  CUT        {
          set custom_feed         $custom_feed_cut_text
             }
  TRAVERSAL  {
         set custom_feed          $custom_feed_traversal_text
             }
  RETRACT    {
         set custom_feed          $custom_feed_retract_text
             }
  RETURN     {
         set custom_feed          $custom_feed_return_text
   if {$custom_feed_return_text == "" && $custom_feed_departure_text != ""} {
         set custom_feed          $custom_feed_departure_text
             }
             }
  DEPARTURE  {
         set custom_feed          $custom_feed_departure_text
       if {$custom_feed_return_text != "" && $custom_feed_departure_text == ""} {
         set custom_feed          $custom_feed_return_text
             }
             }
  default    {
         set custom_feed          $custom_feed_cut_text
             }
  }
}

#=============================================================
proc PB_CMD_wjc_feed_value_get { } {
#=============================================================
  #测试用,该段程序无实际意义,仅在编程过程中验证参数变量用
  global  mom_feed_rapid_value
  global  mom_feed_approach_value
  global  mom_feed_engage_value
  global  mom_feed_first_cut_value
  global  mom_feed_stepover_value
  global  mom_feed_cut_value
  global  mom_feed_traversal_value
  global  mom_feed_retract_value
  global  mom_feed_return_value
  global  mom_feed_departure_value

  global  custom_feed_rapid_value
  global  custom_feed_approach_value
  global  custom_feed_engage_value
  global  custom_feed_first_cut_value
  global  custom_feed_stepover_value
  global  custom_feed_cut_value
  global  custom_feed_traversal_value
  global  custom_feed_retract_value
  global  custom_feed_return_value
  global  custom_feed_departure_value

 MOM_output_literal "; BASE FEEDS REFERENCE"

 if {[info exists mom_feed_rapid_value]} {
  set custom_feed_rapid_value           [string trimright [string trimright [format %.3f $mom_feed_rapid_value] 0] .]
  if {$mom_feed_rapid_value != 0} {
      MOM_output_literal "; FEED_RAPID: $custom_feed_rapid_value"
     }
  }

 if {[info exists mom_feed_approach_value]} {
  set custom_feed_approach_value        [string trimright [string trimright [format %.3f $mom_feed_approach_value] 0] .]
  if {$mom_feed_approach_value != 0} {
      MOM_output_literal "; FEED_APPROACH: $custom_feed_approach_value"
    }
  }

 if {[info exists mom_feed_engage_value]} {
  set custom_feed_engage_value          [string trimright [string trimright [format %.3f $mom_feed_engage_value] 0] .]
   if {$mom_feed_engage_value != 0} {
      MOM_output_literal "; FEED_ENGAGE: $custom_feed_engage_value"
  }
 }

 if {[info exists mom_feed_first_cut_value]} {
  set custom_feed_first_cut_value       [string trimright [string trimright [format %.3f $mom_feed_first_cut_value] 0] .]
  if {$mom_feed_first_cut_value != 0} {
      MOM_output_literal "; FEED_FIRST_CUT: $custom_feed_first_cut_value"
  }
 }

 if {[info exists mom_feed_stepover_value]} {
   set custom_feed_stepover_value        [string trimright [string trimright [format %.3f $mom_feed_stepover_value] 0] .]
   if {$mom_feed_stepover_value != 0} {
      MOM_output_literal "; FEED_ENGAGE: $custom_feed_stepover_value"
   }
 }

  if {[info exists mom_feed_cut_value]} {
   set custom_feed_cut_value             [string trimright [string trimright [format %.3f $mom_feed_cut_value] 0] .]
   if {$mom_feed_cut_value != 0} {
      MOM_output_literal "; FEED_CUT: $custom_feed_cut_value"
  }
 }

  if {[info exists mom_feed_traversal_value]} {
   set custom_feed_traversal_value       [string trimright [string trimright [format %.3f $mom_feed_traversal_value] 0] .]
    if {$mom_feed_traversal_value != 0} {
      MOM_output_literal "; FEED_TRAVERSAL: $custom_feed_traversal_value"
  }
  }

if {[info exists mom_feed_retract_value]} {
  set custom_feed_retract_value         [string trimright [string trimright [format %.3f $mom_feed_retract_value] 0] .]
   if {$mom_feed_retract_value != 0} {
      MOM_output_literal "; FEED_RETRACT: $custom_feed_retract_value"
  }
 }

 if{[info exists mom_feed_return_value]} {
 set custom_feed_return_value          [string trimright [string trimright [format %.3f $mom_feed_return_value] 0] .]
 if {$mom_feed_return_value != 0} {
      MOM_output_literal "; FEED_RETURN: $custom_feed_return_value"
 }
 }


 if{[info exists mom_feed_departure_value]} {
  set custom_feed_departure_value       [string trimright [string trimright [format %.3f $mom_feed_departure_value] 0] .]
   if {$mom_feed_departure_value != 0} {
      MOM_output_literal "; FEED_DEPARTURE: $custom_feed_departure_value"
  }
}
}

编程验证结果

通过设置不同的进给率参数,分别用F-数值输出&F-R输出模式,验证程序效果,其次在多端程序中进行验证,均可执行.

UG加工视图:设置不同的进给参数
在这里插入图片描述
后置处理程序:
①R-数值输出模式,未设置F-R变量模式
在这里插入图片描述
② 设置F-R变量模式
在这里插入图片描述
③ 后置处理程序:
多段程序同时输出
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值