UG爱好者

标题: NC文件名同程序组名称 [打印本页]

作者: chenzm    时间: 2024-1-27 11:48
标题: NC文件名同程序组名称
在站内找的资源,NC文件名同程序组名称,代码如下:

global mom_parent_group_name ptp_file_name output_extn
MOM_close_output_file $ptp_file_name
#关闭后处理输出的文件
if {[file exists $mom_parent_group_name${output_extn}]} {
MOM_remove_file $mom_parent_group_name${output_extn}
}
#检查当前分组命令的文件是否存在(再次后处理时)
#如果存在,删除它
file rename $ptp_file_name $mom_parent_group_name${output_extn}
#从命令输出的NC文件为选中分组名的NC文件
set ifile [open $mom_parent_group_name${output_extn} r]
set buf ""
while { [gets $ifile buf] > 0 } {
MOM_output_to_listing_device $buf
}

现在的问题是:
1、他不提示覆盖文件
2、单个程序无法后处理
3、有时候后处理会自动删除已处理出来的文件

我做过一些修改尝试,修改后一直报警。
有没有大佬能修改一下,只要将NC程序名修改为程序组名称功能即可。其他自动覆盖和自动删除文件功能不需要。


作者: bey2008    时间: 2024-1-27 15:36
程序头加入定制命令,选什么就生成什么

global mom_parent_group_name
if {[info exists mom_parent_group_name]} {
set CW A} else {
set CW B}

global ptp_file_name
global mom_operation_name mom_group_name
global mom_output_file_directory
global mom_output_file_basename
global output_extn
global mom_sys_output_file_suffix
if {$CW == "A"} {set yj $mom_output_file_directory$mom_group_name$output_extn}
if {$CW == "B"} {set yj $mom_output_file_directory$mom_operation_name$output_extn}
if {($CW == "A")||($CW == "B")} {
MOM_close_output_file $ptp_file_name
MOM_remove_file $yj
MOM_remove_file $ptp_file_name
MOM_open_output_file $yj
}





作者: chenzm    时间: 2024-1-27 18:19
好像不行,还是报警。加程序头尾都一样。感觉跟程序头的刀具Z最小值变量冲突。


作者: pujifeng*    时间: 2024-1-29 16:09
本帖最后由 pujifeng* 于 2024-1-29 16:22 编辑

这个完全满足本帖的要求

说明
不手动更改名称,自动命名为图档名加工序名,
手动更改输出手动设定名称



自动输出文件名加工序名.zip

289 Bytes, 下载次数: 12, 下载积分: G币 -1

售价: 1 元宝  [记录]


作者: 妖幺贰壹    时间: 2024-4-23 11:21
pujifeng* 发表于 2024-1-29 16:09
这个完全满足本帖的要求

说明

怎么看不到附件呢
作者: pujifeng*    时间: 2024-5-5 12:39
妖幺贰壹 发表于 2024-4-23 11:21
怎么看不到附件呢

这里下载
链接:https://pan.baidu.com/s/1Jc9kcT5Fr7f-isE7nLoVCg?pwd=f70s
提取码:f70s
--来自百度网盘超级会员V5的分享
作者: y150108    时间: 2024-5-19 14:02
pujifeng* 发表于 2024-1-29 16:09
这个完全满足本帖的要求

说明

浪费一元宝  用不了
作者: pujifeng*    时间: 2024-5-19 20:57
本帖最后由 pujifeng* 于 2024-5-19 20:59 编辑
y150108 发表于 2024-5-19 14:02
浪费一元宝  用不了

不可能不能用啊 元宝不会让你浪费,我给你使用方法的视频
链接:https://pan.baidu.com/s/1IHsBs22VKAQ5xyb0KYnVSQ?pwd=tudf
提取码:tudf
--来自百度网盘超级会员V5的分享

作者: 妖幺贰壹    时间: 2024-5-21 13:30
pujifeng* 发表于 2024-5-19 20:57
不可能不能用啊 元宝不会让你浪费,我给你使用方法的视频
链接:https://pan.baidu.com/s/1IHsBs22VKAQ5 ...

我下载的也用不了
作者: pujifeng*    时间: 2024-5-21 14:22
妖幺贰壹 发表于 2024-5-21 13:30
我下载的也用不了

疏忽了少放了一个文件,不好意思我重新上传了,不需要元宝,非常抱歉
https://www.ugsnx.com/thread-342609-1-1.html




欢迎光临 UG爱好者 (https://www.ugsnx.com/) Powered by Discuz! X3.2