|
|
#*********************计算Zrtcp***********************
set e1 [expr cos($rad_b)-1.0]
set e2 [expr sin($rad_b)]
set d1 [expr round($e1*1000000.0)/1000000.0]
set d2 [expr round($e2*1000000.0)/1000000.0]
set vz [expr round($mom_pos(2)*10000.0)/10000.0]
set w1 [format "%.6f" $d1]
if {![string compare "-1.000000" $w1]} {
set s1 "-#103"
} elseif {![string compare "1.000000" $w1]} {
set s1 "#103"
} else {
if {[string index $w1 end-0] == "0"} {
if {[string index $w1 end-1] == "0"} {
if {[string index $w1 end-2] == "0"} {
if {[string index $w1 end-3] == "0"} {
if {[string index $w1 end-4] == "0"} {
if {[string index $w1 end-5] == "0"} {
set w1 [format "%d." [expr round($d1)]]
} else {
set w1 [format "%.1f" $d1]
}
} else {
set w1 [format "%.2f" $d1]
}
} else {
set w1 [format "%.3f" $d1]
}
} else {
set w1 [format "%.4f" $d1]
}
} else {
set w1 [format "%.5f" $d1]
}
}
if {$d1 != 0.0} {
set s1 [format "%s*#103" $w1]
} else {
set s1 "NONE"
}
}
set w2 [format "%.6f" $d2]
if {![string compare "-1.000000" $w2]} {
set s2 "-#101"
} elseif {![string compare "1.000000" $w2]} {
set s2 "+#101"
} else {
if {[string index $w2 end-0] == "0"} {
if {[string index $w2 end-1] == "0"} {
if {[string index $w2 end-2] == "0"} {
if {[string index $w2 end-3] == "0"} {
if {[string index $w2 end-4] == "0"} {
if {[string index $w2 end-5] == "0"} {
set w2 [format "%d." [expr round($d2)]]
} else {
set w2 [format "%.1f" $d2]
}
} else {
set w2 [format "%.2f" $d2]
}
} else {
set w2 [format "%.3f" $d2]
}
} else {
set w2 [format "%.4f" $d2]
}
} else {
set w2 [format "%.5f" $d2]
}
}
if {$d2 > 0.0} {
set s2 [format "+%s*#101" $w2]
} elseif {$d2 < 0.0} {
set s2 [format "%s*#101" $w2]
} else {
set s2 "NONE"
}
}
set w4 [format "%.4f" $vz]
if {[string index $w4 end-0] == "0"} {
if {[string index $w4 end-1] == "0"} {
if {[string index $w4 end-2] == "0"} {
if {[string index $w4 end-3] == "0"} {
set w4 [format "%d." [expr round($vz)]]
} else {
set w4 [format "%.1f" $vz]
}
} else {
set w4 [format "%.2f" $vz]
}
} else {
set w4 [format "%.3f" $vz]
}
}
if {$vz > 0.0} {
set s4 [format "+%s" $w4]
} elseif {$vz < 0.0} {
set s4 [format "%s" $w4]
} else {
set s4 "NONE"
}
if {[string compare "NONE" $s1] && ![string compare "NONE" $s2]} {
set s $s1
} elseif {![string compare "NONE" $s1] && [string compare "NONE" $s2]} {
set s $s2
} elseif {[string compare "NONE" $s1] && [string compare "NONE" $s2]} {
set s [format "%s%s" $s1 $s2]
} else {
set s "NONE"
}
if {[string compare "NONE" $s] && [string compare "NONE" $s4]} {
set sz [format "\[%s%s\]" $s $s4]
} elseif {![string compare "NONE" $s] && [string compare "NONE" $s4]} {
set sz $s4
} elseif {[string compare "NONE" $s] && ![string compare "NONE" $s4]} {
set sz [format "\[%s\]" $s]
} else {
set sz "0."
}
return 1
}
return 0
点击确定。
7.在"程序和刀轨"选项卡中,选择左侧"工序结束序列"选项,在"刀轨结束"事件下添加G91 G28 Z0.行。
8.在"程序和刀轨"选项卡中,选择左侧"程序结束序列"选项:
(1).在"程序结束"事件下添加G91 G28 X0. Y0. M9行。
(2).在"程序结束"事件下的G91 G28 X0. Y0. M9行下面添加G91 G28 B0. M5行。
(3).在"程序结束"事件下的G91 G28 B0. M5行下面添加M30行。
(4).在"程序结束"事件下的M30行下面添加%行。
9.保存后处理文件。
10.四轴转台B宏联动后处理制作完成。
大功告成。。。。。。。。。。。。。作者 南京六合标子
|
|