此後處理程式碼原作者為
閃光蝸牛
,經允許在數控微站上釋出,其它人轉載需註明原作者
先上效果圖,後面寫後處理製作方法
一.螺紋銑孔(兩圈)
二.銑孔
三,銑外螺紋
四.凸臺銑
此後處理碰到螺旋圓柱型刀路自動輸出宏程式,而其它刀路按正常輸出,孔銑凸臺銑,內外螺紋,平面銑的螺旋進刀均正常,能縮短程式行的數量,並方便操作員修改
下面釋出後處理製作步驟及螺旋銑孔宏程式程式碼,大家加入自己的後處理即可,自己測試,後果自負
第一步
3在Z上點右鍵建立,重新命名為Z_1 , 在Z_1上按4編輯選文字
第二步
第三步
在塊 circular_move_1 處刪除自帶Z,加入我們一開始建立的Z_1,選表示式,值輸#2
第四步
在塊 circular_move_helix 處刪除自帶Z 加入文字 Z#1
第五步
在程式頭加入後處理自帶的用與螺旋輸出的定製命令,如果在新增塊裡找不到,請百度搜索如果新增這個命令
在學習UG數控程式設計的朋友可以入群學習
最後一步,開啟第五步指令,用以下程式碼替換它
uplevel #0 {
#
# This ommand will be executed automatically at the start of program and
# anytime it is loaded as a slave post of a linked post。
#
# This procedure can be used to enable your post to output helix。
# You can choose from the following options to format the circle
# block template to output the helix parameters。
#
set mom_sys_helix_pitch_type “rise_revolution”
#
# The default setting for mom_sys_helix_pitch_type is “rise_radian”。
# This is the most common。 Other choices are:
#
# “rise_radian” Measures the rise over one radian。
# “rise_revolution” Measures the rise over 360 degrees。
# “none” Will suppress the output of pitch。
# “other” Allows you to calculate the pitch
# using your own formula。
#
# This custom command uses the block template circular_move to output
# the helix block。 If your post uses a block template with a different
# name, you must edit the line that outputs the helix block。
#
# The following variable deines the output mode for helical records。
#
# FULL_CIRCLE —— This mode will output a helix record for each 360
# degrees of the helix。
# QUADRANT —— This mode will output a helix record for each 90
# degrees of the helix。
# LINEAR —— This mode will output the entire helix as linear gotos。
# END_POINT —— This mode will assume the control can define an entire
# helix in a single block。
set mom_kin_helical_arc_output_mode END_POINT
MOM_reload_kinematics
#=============================================================
proc MOM_helix_move { } {
#=============================================================
global mom_pos_arc_plane
global mom_sys_cir_vector
global mom_sys_helix_pitch_type
global mom_helix_pitch
global mom_prev_pos mom_pos_arc_center
global PI
switch $mom_pos_arc_plane {
XY { MOM_suppress once K ; set cir_index 2 }
YZ { MOM_suppress once I ; set cir_index 0 }
ZX { MOM_suppress once J ; set cir_index 1 }
}
switch $mom_sys_helix_pitch_type {
none { }
rise_revolution { set pitch $mom_helix_pitch }
rise_radian { set pitch [expr $mom_helix_pitch / ($PI * 2。0)]}
other {
#
# Place your custom helix pitch code here
#
}
default { set mom_sys_helix_pitch_type “none” }
}
MOM_force once X Y Z
if { [string compare “none” $mom_sys_helix_pitch_type] } {
MOM_force once I J K
#
switch $mom_sys_cir_vector {
“Vector - Arc Center to Start” {
set mom_prev_pos($cir_index) $pitch
set mom_pos_arc_center($cir_index) 0。0
}
“Vector - Arc Start to Center” -
“Unsigned Vector - Arc Start to Center” {
set mom_prev_pos($cir_index) 0。0
set mom_pos_arc_center($cir_index) $pitch
}
“Vector - Absolute Arc Center” {
set mom_pos_arc_center($cir_index) $pitch
}
}
}
#
# You may need to edit this line if you output more than one block
# or if you have changed the name of your circular_move block template
#
# MOM_do_template circular_move
global mom_pos mom_last_pos
set dep [format “%0。3f” [expr $mom_pos($cir_index)-$mom_last_pos($cir_index)]]
set pit [format “%0。3f” $pitch]
set val [string trimright [expr $dep/$pit] 。0]
set val_int [expr int($val)]
set z_rem [expr abs(int($dep/$pit)-$dep/$pit)]
if {$mom_pos($cir_index)
set sym GE
} else {
set sym LE
}
if {$val
MOM_do_template circular_move
} else {
MOM_output_literal “(R)#1=[format ”%0。3f“ [expr $mom_last_pos($cir_index)+$pitch]]
(Z)#2=[format ”%0。3f“ $mom_pos($cir_index)]
WHILE \[#1 $sym #2\] DO1”
set last_cycle(0) $mom_pos(0)
set last_cycle(1) $mom_pos(1)
set mom_pos(0) $mom_last_pos(0)
set mom_pos(1) $mom_last_pos(1)
MOM_do_template circular_move_helix
MOM_output_literal “#1=#1+\[[format ”%0。3f“ $pitch]\]
END1”
if {[string compare $val $val_int]} {
set mom_pos(0) $last_cycle(0)
set mom_pos(1) $last_cycle(1)
MOM_force once X Y Z I J Z_1
MOM_do_template circular_move_1
}
}
}
} ;# uplevel