QQ登录

只需一步,快速开始

快捷登录

登录 或者 注册 请先

UG爱好者

查看: 13370|回复: 22
打印 上一主题 下一主题

关于后处理程序头的刀具列表问题请教

[复制链接]

六级士官

Rank: 4

22

主题

217

帖子

1592

积分
跳转到指定楼层
楼主
发表于 2015-9-3 20:48:35 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
请问怎么修改才能使后处理处理出来的程序里没有红圈里的内容(就是把红圈里的数据去掉)



怎么修改下面的文件呢、
#  Place this custom command in either the start of program
#  or the end of program event marker to generate a tool list
#  in your NC file.
#
#  The Shop Doc template file "pb_post_tool_list.tpl" distributed with
#  Post Builder in "POSTBUILD/pblib/misc" directory can be copied
#  to the "mach/resource/postprocessor" or "mach/resource/shop_docs" directory,
#  in case that your UG runtime environment does not have access to the
#  Post Builder installation.
#
#  Accessing "pb_post_tool_list.tpl" in other location can also be accomplished
#  by changing the code below titled "Generate tool list data" in this proc.
#
#  The variable "mom_sys_tool_list_output_type" set in this proc allows you
#  to select the type of tool list to be generated.
#  The options are:
#
#   "ORDER_IN_USE"     - List tools used in the program in the order of operations.
#   "ALL_UNIQUE"       - List all unique tools once for each in the order of use.
#   "GROUP_BY_TYPE"    - List tools in groups of different tool types.
#
# The desired tool list type can be set by changing the code below.
# The default is set to "GROUP_BY_TYPE".
#
   global mom_sys_tool_list_initialized
   global mom_sys_tool_list_output_type

   if { ![info exists mom_sys_tool_list_initialized] || !$mom_sys_tool_list_initialized } {
      MOM_output_to_listing_device "proc PB_CMD_init_tool_list must be executed in the\
                                    Start of Program before PB_CMD_create_tool_list is called."
return
   }

  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  # Set mom_sys_tool_list_output_type to the desired output fashion.
  #
  #   "ORDER_IN_USE"     - List tools used in the program in the order of operations.
  #   "ALL_UNIQUE"       - List all unique tools once for each in the order of use.
  #   "GROUP_BY_TYPE"    - List tools in groups of different tool types.
  #
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  # set mom_sys_tool_list_output_type "ORDER_IN_USE"
  # set mom_sys_tool_list_output_type "ALL_UNIQUE"
   set mom_sys_tool_list_output_type "GROUP_BY_TYPE"

   global mom_sys_control_out mom_sys_control_in
   global current_program_name
   global mom_tool_number mom_tool_length_adjust_register mom_tool_name

  #----------------------------------------------------------------------------
  # Save info for the currently active tool in the program being post-prcessed
  # before starting Shop Doc mechanism for tool list generation.
  #----------------------------------------------------------------------------
   if [llength [info commands PB_CMD_save_active_oper_tool_data] ] {
      PB_CMD_save_active_oper_tool_data
   }

  #-----------------------------------------------------------
  # Create tool list per selected top-level group.
  # Group name is set to blank if no group has been selected.
  #-----------------------------------------------------------
   global mom_parent_group_name
   if [info exists mom_parent_group_name] {
      set current_program_name $mom_parent_group_name
   } else {
      set current_program_name ""
   }

   set ci " "
   set co " "
   if [info exists mom_sys_control_in] { set ci $mom_sys_control_in }
   if [info exists mom_sys_control_out] { set co $mom_sys_control_out }

  #*************************
  # Generate tool list data
  #*************************
   set template_file pb_post_tool_list.tpl
   global tcl_platform
   if [string match "windows" $tcl_platform(platform)] {
      set pb_lib_misc_dir [MOM_ask_env_var UGII_BASE_DIR]\\postbuild\\pblib\\misc\\
   } else {
      set pb_lib_misc_dir [MOM_ask_env_var UGII_BASE_DIR]/postbuild/pblib/misc/
   }
   set cam_post_dir     [MOM_ask_env_var UGII_CAM_POST_DIR]
   set cam_shop_doc_dir [MOM_ask_env_var UGII_CAM_SHOP_DOC_DIR]
   if { [file exists ${pb_lib_misc_dir}${template_file}] } {
      MOM_do_template_file ${pb_lib_misc_dir}${template_file}
   } elseif { [file exists ${cam_post_dir}${template_file}] } {
      MOM_do_template_file ${cam_post_dir}${template_file}
   } elseif { [file exists ${cam_shop_doc_dir}${template_file}] } {
      MOM_do_template_file ${cam_shop_doc_dir}${template_file}
   } else {
      MOM_output_to_listing_device \
         "ERROR : Template file $template_file is not found in the following directories:\
          \n\
          \n          $pb_lib_misc_dir\
          \n          $cam_post_dir\
          \n          $cam_shop_doc_dir\
          \n\
          \n        Tool list cannot be generated.\n"
return
   }

  #------------------
  # Tool list header
  #------------------
   shop_doc_output_literal "$co===============================================================================================$ci"
   shop_doc_output_literal "$co                                   T O O L   L I S T                                           $ci"
   shop_doc_output_literal "$co===============================================================================================$ci"

  #------------------
  # Output tool list
  #------------------
   global tool_data_buffer
   global mom_sys_tool_stack
   switch $mom_sys_tool_list_output_type {
      "ORDER_IN_USE" {
         set tool_list $mom_sys_tool_stack(IN_USE)
      }
      "GROUP_BY_TYPE" {
         set tool_list [concat $mom_sys_tool_stack(LATHE) \
                               $mom_sys_tool_stack(DRILL) \
                               $mom_sys_tool_stack(MILL)]
      }
      default {
         set tool_list $mom_sys_tool_stack(ALL)
      }
   }

   set prev_tool_type ""
   foreach tool $tool_list {
      set tool_type $tool_data_buffer($tool,type)
     # Output tool type header if it changes.
      if { ![string match "$tool_type" $prev_tool_type] } {
         if { [info exists tool_data_buffer($tool_type,header)] && \
              [string length $tool_data_buffer($tool_type,header)] != 0 } {
            shop_doc_output_literal "$tool_data_buffer($tool_type,header)"
         }
      }
      if [info exists tool_data_buffer($tool,output)] {
         shop_doc_output_literal "$tool_data_buffer($tool,output)"
      }
      set prev_tool_type $tool_type
   }

  #------------------
  # Tool list footer
  #------------------
   shop_doc_output_literal "$co===============================================================================================$ci"

  #-------------------------------------------------------------------------------
  # Restore info for the currently active tool in the program being post-prcessed.
  #-------------------------------------------------------------------------------
   if [llength [info commands PB_CMD_restore_active_oper_tool_data] ] {
      PB_CMD_restore_active_oper_tool_data
   }

有奖推广贴子: 

回复

使用道具 举报

六级士官

Rank: 4

8

主题

309

帖子

1446

积分
推荐
发表于 2018-8-6 20:22:04 | 只看该作者
UG后置处理——输出加工信息(最大最小值)在程序头
最大最小值和加工时间等信息一般只有在程序最后才能输出,因为必须每一条刀轨计算后才能输出。而为了将这些信息在程序头输出,我们可以用文件操作,在proc MOM_end_of_program中增加以下代码,先输出最大最小值,然后再将原文件中已经输出的代码重新写入此文件。
global ptp_file_name
global tmp_file_name

set tmp_file_name "${ptp_file_name}_"
if {[file exists $tmp_file_name]} {
MOM_remove_file $tmp_file_name
}
MOM_close_output_file $ptp_file_name

file rename $ptp_file_name $tmp_file_name
set ifile [open $tmp_file_name r]
set ofile [open $ptp_file_name w]

global mom_sys_max_travel
global mom_sys_min_travel
puts $ofile "( Max X = $mom_sys_max_travel(0)   MIN X = $mom_sys_min_travel(0) )"
puts $ofile "( Max Y = $mom_sys_max_travel(1)   MIN Y = $mom_sys_min_travel(1) )"
puts $ofile "( Max Z = $mom_sys_max_travel(2)   MIN Z = $mom_sys_min_travel(2) )"

set buf ""
while { [gets $ifile buf] > 0 } {
puts $ofile $buf
}
close $ifile
close $ofile
MOM_remove_file $tmp_file_name
MOM_open_output_file $ptp_file_name
输出加工时间原理和这个一样,只要把灰显的代码改为puts $ofile "( machine time = $mom_machine_time )" 就可以了
回复 支持 1 反对 0

使用道具 举报

少尉

Rank: 5Rank: 5

2

主题

158

帖子

2037

积分
推荐
发表于 2017-1-5 20:57:24 | 只看该作者
都是伸手党 没有下文了,
回复 支持 1 反对 0

使用道具 举报

六级士官

Rank: 4

22

主题

217

帖子

1592

积分
推荐
 楼主| 发表于 2015-9-15 12:44:43 | 只看该作者
wjm2118 发表于 2015-9-14 10:30
把你后处理发给我。我给你改,是这样的吗??

能不能 在刀具列表里 加个 D和H啊?》
回复 支持 0 反对 1

使用道具 举报

中尉

Rank: 5Rank: 5

12

主题

425

帖子

3975

积分
推荐
发表于 2015-9-14 10:30:37 | 只看该作者
把你后处理发给我。我给你改,是这样的吗??

回复 支持 1 反对 0

使用道具 举报

超级版主

小梁原创UG后处理视频教程出售,微信公众号:UG爱好者小梁

Rank: 13Rank: 13Rank: 13Rank: 13

519

主题

4871

帖子

9万

积分
沙发
发表于 2015-9-4 09:06:42 | 只看该作者
可以改,不过有点复杂
小梁原创UG后处理视频教程-UG后处理构造器与TCL语言和MOM命令讲解与四五轴,微信公众号:UG爱好者小梁
回复 支持 反对

使用道具 举报

六级士官

Rank: 4

22

主题

217

帖子

1592

积分
地板
 楼主| 发表于 2015-9-15 12:42:56 | 只看该作者
wjm2118 发表于 2015-9-14 10:30
把你后处理发给我。我给你改,是这样的吗??

麻烦啦!@

Fanuc-M.zip

36.64 KB, 下载次数: 295, 下载积分: G币 -1

回复 支持 反对

使用道具 举报

中尉

Rank: 5Rank: 5

12

主题

425

帖子

3975

积分
6#
发表于 2015-9-17 19:15:20 | 只看该作者
ccchhh 发表于 2015-9-15 12:44
能不能 在刀具列表里 加个 D和H啊?》

可以的
回复 支持 反对

使用道具 举报

中尉

Rank: 5Rank: 5

12

主题

425

帖子

3975

积分
7#
发表于 2015-9-17 19:15:52 | 只看该作者

把刀具清单格式给我
回复 支持 反对

使用道具 举报

六级士官

Rank: 4

22

主题

217

帖子

1592

积分
8#
 楼主| 发表于 2015-9-18 08:08:32 | 只看该作者
wjm2118 发表于 2015-9-17 19:15
把刀具清单格式给我

麻烦啦  顺序无所谓的 !

刀具列表格式.zip

253 Bytes, 下载次数: 316, 下载积分: G币 -1

回复 支持 反对

使用道具 举报

中尉

Rank: 5Rank: 5

12

主题

425

帖子

3975

积分
9#
发表于 2015-10-28 18:26:05 | 只看该作者
ccchhh 发表于 2015-9-18 08:08
麻烦啦  顺序无所谓的 !

你的后处理呢?
回复 支持 反对

使用道具 举报

六级士官

Rank: 4

22

主题

217

帖子

1592

积分
10#
 楼主| 发表于 2015-10-31 16:05:01 | 只看该作者

在三楼呢 谢谢
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

 
 
QQ:1359218528
工作时间:
9:00-17:00
 
微信公众号
手机APP
机械社区
微信小程序

手机版|UG爱好者论坛 ( 京ICP备10217105号-2 )    论坛管理员QQ:1359218528

本站信息均由会员发表,不代表本网站立场,如侵犯了您的权利请联系管理员,邮箱:1359218528@qq.com  

Powered by UG爱好者 X3.2  © 2001-2014 Comsenz Inc. GMT+8, 2024-4-26 12:27

返回顶部