ug后处理定制的命令.docx
《ug后处理定制的命令.docx》由会员分享,可在线阅读,更多相关《ug后处理定制的命令.docx(9页珍藏版)》请在冰豆网上搜索。
ug后处理定制的命令
在pd_cmd_custom_command(用户自定义)——定义命令
1.在程序的末尾加上加工的时间(注意字符间的空格,不能少也不能多)
globalmom_machine_time
MOM_output_literal(运行时间:
[format%.2f$mom_machine_time]分钟)
最后效果:
(运行时间:
0.76分钟)
2.在程序末尾加上生成程序的时间
globalmom_date
/u4?
(C9](t,N6S:
Z6Uwww.CAxHMOM_output_literal";dateis:
$mom_date"
最后效果:
;dateis:
SatJun0119:
38:
442013
3.加入刀具列表
#Placethiscustomcommandineitherthestartofprogram
#ortheendofprogrameventmarkertogenerateatoollist
#inyourNCfile.
#
#TheShopDoctemplatefile"pb_post_tool_list.tpl"distributedwith
#PostBuilderin"POSTBUILD/pblib/misc"directorycanbecopied
#tothe"mach/resource/postprocessor"or"mach/resource/shop_docs"directory,
#incasethatyourUGruntimeenvironmentdoesnothaveaccesstothe
#PostBuilderinstallation.
#
#Accessing"pb_post_tool_list.tpl"inotherlocationcanalsobeaccomplished
#bychangingthecodebelowtitled"Generatetoollistdata"inthisproc.
#
#Thevariable"mom_sys_tool_list_output_type"setinthisprocallowsyou
#toselectthetypeoftoollisttobegenerated.
#Theoptionsare:
#
#"ORDER_IN_USE"-Listtoolsusedintheprogramintheorderofoperations.
#"ALL_UNIQUE"-Listalluniquetoolsonceforeachintheorderofuse.
#"GROUP_BY_TYPE"-Listtoolsingroupsofdifferenttooltypes.
#
#Thedesiredtoollisttypecanbesetbychangingthecodebelow.
#Thedefaultissetto"GROUP_BY_TYPE".
#
globalmom_sys_tool_list_initialized
globalmom_sys_tool_list_output_type
if{!
[infoexistsmom_sys_tool_list_initialized]||!
$mom_sys_tool_list_initialized}{
MOM_output_to_listing_device"procPB_CMD_init_tool_listmustbeexecutedintheStartofProgrambeforePB_CMD_create_tool_listiscalled."
return
}
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#Setmom_sys_tool_list_output_typetothedesiredoutputfashion.
#
#"ORDER_IN_USE"-Listtoolsusedintheprogramintheorderofoperations.
#"ALL_UNIQUE"-Listalluniquetoolsonceforeachintheorderofuse.
#"GROUP_BY_TYPE"-Listtoolsingroupsofdifferenttooltypes.
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#setmom_sys_tool_list_output_type"ORDER_IN_USE"
#setmom_sys_tool_list_output_type"ALL_UNIQUE"
setmom_sys_tool_list_output_type"GROUP_BY_TYPE"
globalmom_sys_control_outmom_sys_control_in
globalcurrent_program_name
globalmom_tool_numbermom_tool_length_adjust_registermom_tool_name
#----------------------------------------------------------------------------
#Saveinfoforthecurrentlyactivetoolintheprogrambeingpost-prcessed
#beforestartingShopDocmechanismfortoollistgeneration.
#----------------------------------------------------------------------------
if[llength[infocommandsPB_CMD_save_active_oper_tool_data]]{
PB_CMD_save_active_oper_tool_data
}
#-----------------------------------------------------------
#Createtoollistperselectedtop-levelgroup.
#Groupnameissettoblankifnogrouphasbeenselected.
#-----------------------------------------------------------
globalmom_parent_group_name
if[infoexistsmom_parent_group_name]{
setcurrent_program_name$mom_parent_group_name
}else{
setcurrent_program_name""
}
setci""
setco""
if[infoexistsmom_sys_control_in]{setci$mom_sys_control_in}
if[infoexistsmom_sys_control_out]{setco$mom_sys_control_out}
#*************************
#Generatetoollistdata
#*************************
settemplate_filepb_post_tool_list.tpl
globaltcl_platform
if[stringmatch"windows"$tcl_platform(platform)]{
setpb_lib_misc_dir[MOM_ask_env_varUGII_BASE_DIR]\\postbuild\\pblib\\misc\\
}else{
setpb_lib_misc_dir[MOM_ask_env_varUGII_BASE_DIR]/postbuild/pblib/misc/
}
setcam_post_dir[MOM_ask_env_varUGII_CAM_POST_DIR]
setcam_shop_doc_dir[MOM_ask_env_varUGII_CAM_SHOP_DOC_DIR]
if{[fileexists${pb_lib_misc_dir}${template_file}]}{
MOM_do_template_file${pb_lib_misc_dir}${template_file}
}elseif{[fileexists${cam_post_dir}${template_file}]}{
MOM_do_template_file${cam_post_dir}${template_file}
}elseif{[fileexists${cam_shop_doc_dir}${template_file}]}{
MOM_do_template_file${cam_shop_doc_dir}${template_file}
}else{
MOM_output_to_listing_device"ERROR:
Templatefilepb_post_tool_list.tplisnotfoundinthefollowingdirectories:
\n\n$pb_lib_misc_dir\n$cam_post_dir\n$cam_shop_doc_dir\n\nToollistcannotbegenerated.\n"
return
}
#------------------
#Toollistheader
#------------------
shop_doc_output_literal"$co===============================================================================================$ci"
shop_doc_output_literal"$coTOOLLIST$ci"
shop_doc_output_literal"$co===============================================================================================$ci"
#------------------
#Outputtoollist
#------------------
globaltool_data_buffer
globalmom_sys_tool_stack
switch$mom_sys_tool_list_output_type{
"ORDER_IN_USE"{
settool_list$mom_sys_tool_stack(IN_USE)
}
"GROUP_BY_TYPE"{
settool_list[concat$mom_sys_tool_stack(LATHE)$mom_sys_tool_stack(DRILL)$mom_sys_tool_stack(MILL)]
}
default{
settool_list$mom_sys_tool_stack(ALL)
}
}
setprev_tool_type""
foreachtool$tool_list{
settool_type$tool_data_buffer($tool,type)
#Outputtooltypeheaderifitchanges.
if{!
[stringmatch"$tool_type"$prev_tool_type]}{
if{[infoexiststool_data_buffer($tool_type,header)]&&$tool_data_buffer($tool_type,header)!
=""}{
shop_doc_output_literal"$tool_data_buffer($tool_type,header)"
}
}
if[infoexiststool_data_buffer($tool,output)]{
shop_doc_output_literal"$tool_data_buffer($tool,output)"
}
setprev_tool_type$tool_type
}
#------------------
#Toollistfooter
#------------------
shop_doc_output_literal"$co===============================================================================================$ci"
#-------------------------------------------------------------------------------
#Restoreinfoforthecurrentlyactivetoolintheprogrambeingpost-prcessed.
#-------------------------------------------------------------------------------
if[llength[infocommandsPB_CMD_restore_active_oper_tool_data]]{
PB_CMD_restore_active_oper_tool_data
}
结果:
(===============================================================================================)
(TOOLLIST)
(===============================================================================================)
()
(-----------------------------------------------------------------------------------------------)
(MILLDESCRIPTIONDIAMETERCORRADFLUTELENADJREGMACHTIME)
(-----------------------------------------------------------------------------------------------)
(D10MILL10.00000.000050.000000.16)
(D6R3MILL6.00003.000050.000000.20)
(D4MILL4.00000.000050.000000.23)
(===============================================================================================)
5.插入刀具详细信息
globalmom_tool_namemom_tool_diametermom_tool_corner1_radiusmom_tool_numbermom_tool_lengthmom_tool_flute_length
MOM_output_literal"(T_N:
$mom_tool_nameT_D:
[format"%.2f"$mom_tool_diameter]T_R:
[format"%.2f"$mom_tool_corner1_radius]T_NO.:
$mom_tool_numberT_L:
[format"%.2f"$mom_tool_length]T_F_L:
[format"%.2f"$mom_tool_flute_length])"
效果:
(T_N:
D10T_D:
10.00T_R:
0.00T_NO.:
1T_L:
75.00T_F_L:
50.00)
在运算程序消息
1.MOM_output_literal“(刀具名称:
$mom_tool_name)”
2.MOM_output_literal“(刀具直径:
$mom_tool_diameter)”
3.MOM_output_literal“(刀具R角半径:
$mom_tool_nose_radius)”
WelcomeTo
Download!
!
!
欢迎您的下载,资料仅供参考!