|
楼主 |
发表于 2024-8-24 10:41:55
|
显示全部楼层
这个可以# 声明全局变量
global mom_stock_floor mom_stock_part mom_wall_stock mom_stock_part_use
global sidestock floorstock mom_operation_type
# 设置sidestock的值
if {[info exists mom_stock_part]} {
set sidestock $mom_stock_part
# 如果mom_wall_stock存在且不为0,‌则更新sidestock的值
if {[info exists mom_wall_stock] && $mom_wall_stock != 0} {
set sidestock $mom_wall_stock
}
} else {
# 如果mom_stock_part不存在,‌则将sidestock设置为0
set sidestock 0
}
# 设置floorstock的值
if {[info exists mom_stock_floor]} {
# 如果mom_stock_part_use为1且mom_stock_part存在,‌则设置floorstock为mom_stock_part的值
if {[info exists mom_stock_part_use] && $mom_stock_part_use == 1 && [info exists mom_stock_part]} {
set floorstock $mom_stock_part
} else {
# 否则,‌将floorstock设置为mom_stock_floor的值
set floorstock $mom_stock_floor
}
} else {
# 如果mom_stock_floor不存在,‌则将floorstock设置为0
set floorstock 0
}
# 如果sidestock或floorstock不为0,‌并且mom_operation_type不是特定值,‌则输出它们的值
if {([info exists sidestock] && $sidestock != 0) || ([info exists floorstock] && $floorstock != 0)} {
if {$mom_operation_type != "Point to Point" && $mom_operation_type != "Drilling"} {
# 输出sidestock和floorstock的值,‌格式化为两位小数,‌并去除尾部的0
MOM_output_literal "(XY=[string trimright [format "%.2f" $sidestock] "0"]mm Z=[string trimright [format "%.2f" $floorstock] "0"]mm)"
}
} |
|