|
本帖最后由 Deaton 于 2011-6-22 00:59 编辑
8 C0 e k( G. d) J& k' u; J; {) R
" @6 v- @, q! h x9 h0 N# z" V/ P! A非常详细实用,谢谢!! y4 M/ p$ e5 f+ w8 w9 X
, O% l/ a) N3 c附一个 Sodick 的后处理,已实现上下异形,子程序调用,供各位同学参考。
% k# {3 u9 G# Z; M( s2 Z8 @6 s5 R+ S& M+ }5 a
########################## TCL Event Handlers ##########################0 y: X( Q6 y* ]8 n7 i' K
#
F! j9 L9 T# r) v+ r# Created by Supervisor @ Mon Oct 09 15:07:32 2005 中国标准时间" ]# B; L$ f9 g6 e
# with Post Builder version 3.4.1.
3 }, k: H$ O( M! D \: E#* i0 n+ f+ R/ @# i. V" f4 Y
########################################################################
( u, w) M- Q# D7 f/ c' t; J
% T' e. c" T( V8 e( Y2 ` set cam_post_dir [MOM_ask_env_var UGII_CAM_POST_DIR]
* b. Z5 r; V( `) x2 N) ?+ @2 E* _$ z% x4 e# y6 k; s$ q
8 ]* j& u! K" n
if { ![info exists mom_sys_post_initialized] } {
3 ?6 |# I0 ]) ^! J$ P3 m
$ { {: i- N, n; H- B source ${cam_post_dir}ugpost_base.tcl
- i7 ?4 O( A7 o5 A( t+ A' q$ V6 n5 \' f6 \5 [# {
proc MOM_before_each_add_var {} {}
9 @2 t# L# j* T9 U" L proc MOM_before_each_event {} {}
: A. l# |: [. x6 h2 F/ X! o. ^3 y$ L% @- r6 W4 v
# set cam_debug_dir [MOM_ask_env_var UGII_CAM_DEBUG_DIR]
' W! t* Q7 _% h! L! k2 e! D# source ${cam_debug_dir}mom_review.tcl( `- t: F, k7 Y k b, @
U h4 x( ]6 w
MOM_set_debug_mode OFF
( W4 W/ g, Q/ P( }6 m+ U
2 w5 K7 j3 k: C: F: N* g/ l( t, m, U+ `( c5 _4 g4 O' }
#### Listing File variables
% R$ r$ r2 O7 S set mom_sys_list_output "OFF"
. Z7 a, a* B$ W- C set mom_sys_header_output "OFF"
8 l5 X7 F) k" {7 k: m$ w set mom_sys_list_file_rows "40" 6 c$ W" N4 Q2 u
set mom_sys_list_file_columns "30"
5 K0 h2 S S) X/ g, k set mom_sys_warning_output "OFF"
: {8 N, b+ D0 d3 k set mom_sys_group_output "OFF"
7 O4 _" K6 [* y. g$ H set mom_sys_list_file_suffix "lpt"
" [% |& y) G3 N* j; _2 k set mom_sys_output_file_suffix "NC"
# f0 r# v, C) V$ t; c6 M# n set mom_sys_commentary_output "ON"
4 ]5 H" b# L5 R( | set mom_sys_commentary_list "x y z 4axis 5axis feed speed"5 z: E x* [' @0 E1 O9 q
2 m/ P) K! C: ] set mom_sys_control_out "(" & F+ ?* y$ M3 i
set mom_sys_control_in ")" . K& @! F0 N9 h0 T5 V
( `+ C2 |1 M4 N" i# P o; e- U0 g set mom_sys_post_initialized 18 n ~4 C$ O q/ V! S2 [) S! w8 T$ R
}
% A$ x* [# P4 c- \2 W/ k0 E7 j+ C/ N( G- y1 q Q
8 E: {7 o: ]/ |& `( l- O& e
########## SYSTEM VARIABLE DECLARATIONS ##############$ [0 f3 X9 m A! _' Y% f
set mom_sys_rapid_code "0"
7 T4 A; u0 u& M( Y; ` set mom_sys_linear_code "1"
; w9 r1 v' x2 u r set mom_sys_circle_code(CLW) "2"
/ ^/ M5 t0 m5 v3 F set mom_sys_circle_code(CCLW) "3" 2 _3 `' U" P0 ]
set mom_sys_delay_code(SECONDS) "4"
- \3 m1 d1 z4 E9 T/ R+ h0 Q set mom_sys_cutcom_code(OFF) "40" & ~) I, X6 U' G2 ?2 i, W
set mom_sys_cutcom_code(LEFT) "41"
) q$ n0 ^3 c; P' z set mom_sys_cutcom_code(RIGHT) "42" $ e9 J+ j+ s. O9 Y$ M) c% D( t
set mom_sys_unit_code(IN) "70"
0 T$ T" [' p) k$ G* _& s: Q set mom_sys_unit_code(MM) "71" 4 ]1 S5 H3 W% K% [, ~
set mom_sys_output_code(ABSOLUTE) "90" $ x! U4 ` l7 Q$ s
set mom_sys_output_code(INCREMENTAL) "91" # ^0 `8 N$ ^6 M' C* x, { t( X7 Z5 O, t
set mom_sys_reset_code "92" 8 p* ~( z" O8 h$ P# _" s
set mom_sys_program_stop_code "0" : q0 T8 A( O4 o& |% O, _
set mom_sys_optional_stop_code "1"
( \, T3 [' a$ S' `. @ set mom_sys_end_of_program_code "2"
0 t! d& E* e) ?* p set mom_sys_rewind_code "30" $ S: u' X% K( S) r$ K& \
set mom_sys_thread_wire "20"
, j6 c, f! c n% ?3 L set mom_sys_cut_wire "21"
9 Y; @9 ]* ^1 j4 I7 b set mom_sys_flushing_on "80"
- S& x5 A8 o! ~ set mom_sys_flushing_off "81"
+ H% v# G2 `. o8 H/ | set mom_sys_power_on "84" ; F3 v8 P1 w$ C1 a s3 b5 R
set mom_sys_power_off "85"
3 p/ v! L p8 R6 O set mom_sys_wire_on "82" ) t3 Q9 y# {6 E" L% n! h: u2 j
set mom_sys_wire_off "83" 3 {- i# l& I+ ^; s6 g
set mom_sys_cir_vector "Vector - Arc Start to Center"
5 I! A( ~ z' D" j' t3 Q set mom_sys_rewind_stop_code "\#"
9 j+ D9 Z3 _' D T& k) _ set mom_sys_home_pos(0) "0" 3 A! m- t; n9 D
set mom_sys_home_pos(1) "0" / u. _& L8 y; C$ H& l% m Q. r
set mom_sys_home_pos(2) "0" ' q# r' o) }; x, n" T
set mom_sys_zero "0"
/ C( R' s8 i2 ^7 Q set mom_sys_opskip_block_leader "/" 4 h6 u+ K5 q! }& g$ Y7 ?
set mom_sys_seqnum_start "10"
% I) s2 I0 [3 m- N! O+ J set mom_sys_seqnum_incr "10" 3 G+ n( ^! @4 _* x1 {# t
set mom_sys_seqnum_freq "1"
8 S9 q+ _# F0 i set mom_sys_seqnum_max "9999"+ X( t! n1 ?( M8 B+ O: F
set mom_sys_leader(N) "N"
) |# o3 O, q7 Q set mom_sys_leader(X) "X"
# [7 y5 R8 ]2 M6 l o set mom_sys_leader(Y) "Y"
$ ^) a' B( n. u( E: ? set mom_sys_leader(Z) "Z" 2 V( a7 {' U" I( ?$ M- Q
set mom_sys_leader(U) "U"
$ c/ S& U0 o% u% |( J6 I set mom_sys_leader(V) "V"
" s F3 _' _9 Y' ~8 k# t. M set mom_sys_contour_feed_mode(LINEAR) "MMPM"
$ ]7 ]& Y* Y: K }8 { set mom_sys_rapid_feed_mode(LINEAR) "MMPM"0 g- h& |! R7 g2 N3 R
set mom_sys_cycle_feed_mode "MMPM"
" z8 h+ O! a- G& T set mom_sys_feed_param(IPM,format) "Feed_IPM"
6 R& h. P% }0 u9 P1 J0 i4 Q9 p set mom_sys_feed_param(MMPM,format) "Feed_MMPM"* Y" }/ Q' i4 M. N( i
set mom_sys_feed_param(MMPR,format) "Feed_MMPR"
. z$ b. z. q$ a6 Y" o: G/ ` set mom_sys_post_description "Unigraphics NX 4.0 WireCut Poster for Sodick.\n\
: K% Q" @$ } d* y. j5 {+ E/ g Version: 2.0\n\
; G# U- _* J$ s, F% k3 O/ g Date: 2006/03/15\n\5 T# ]. J: l% f& w& u
By Deaton, Cheewah Toys Ltd., Co.\n\" x9 s. i1 X* X" _( O
Email:deaton@21cn.com\n\- i E! g9 O# _' _) v& m
Tel:0756-8277824, 13802674804\n\) m4 s$ |# v( X2 x% B
Rule and Conic are both supported."! Y0 @7 b- k" W7 x6 g
set mom_sys_ugpadvkins_used "0"
8 G0 W! e. z+ ~0 Y" ?
* P I$ h" @- ~& X4 v####### KINEMATIC VARIABLE DECLARATIONS ##############
+ o' }1 |7 C" l+ y9 b set mom_kin_arc_output_mode "FULL_CIRCLE"0 _* E3 y4 ?4 [* J
set mom_kin_arc_valid_plane "XY"
6 b& ^! }$ V+ @" q' L/ f set mom_kin_clamp_time "2.0"
' m7 b4 u" X# ~; b0 ~ set mom_kin_flush_time "2.0"
; v! }& ^6 t' m set mom_kin_linearization_flag "1"
# i( B7 @6 ~' ^- p% h4 u set mom_kin_linearization_tol "0.001"
/ U2 I/ T9 J" X- s& u( R" T% Z2 b set mom_kin_machine_resolution ".001": D& }, ^5 I# F2 D" }7 K
set mom_kin_machine_type "4_axis_wedm" U. }; p2 }9 j5 e4 P7 l
set mom_kin_max_arc_radius "99999.999"
, [0 Z! m# H7 O ]- @ y% ~ set mom_kin_max_fpm "10000"
@+ M# ]3 L' c! E8 W1 m) ] set mom_kin_min_arc_length "0.001"( k' T( t8 s8 h' h; ?% t1 t
set mom_kin_min_arc_radius "0.001"
+ m1 M- g# _. L% Z; H2 h set mom_kin_min_fpm "0.01"
1 J: Q; u% U- G1 U set mom_kin_output_unit "MM"
& F/ `3 n% E7 j+ E, [ v& D( ^ set mom_kin_post_data_unit "MM"
: v+ |6 s7 u8 y set mom_kin_rapid_feed_rate "15000"
, d3 K* N0 A7 g O6 ^: k$ | set mom_kin_tool_change_time "12.0"
3 O( [ w; M2 a$ \9 z set mom_kin_wire_tilt_output_type "COORDINATES"
: [7 B$ D1 V' T# x; D set mom_kin_x_axis_limit "1000" l; D% y2 o$ @/ {* U, j) M* ]
set mom_kin_y_axis_limit "1000"
- G" f7 r5 h! `+ J0 @8 [7 E set mom_kin_z_axis_limit "1000"# n- L6 w7 y2 D$ I$ N
7 O) M1 U" w. V" \* O+ H- t
1 @8 H R4 J/ O7 g% f, [7 _
9 R) o9 |# z. }1 b% B
& z }5 J+ J4 ]& h! ~if [llength [info commands MOM_SYS_do_template] ] {# p+ s$ J- T2 v8 i& f/ }2 u
if [llength [info commands MOM_do_template] ] {7 ?2 y% w" B( O0 T& c( U( Z( _
rename MOM_do_template ""2 j* A; G0 s: a+ T9 }' I1 j9 l
}5 u! B& {* d3 X7 p! Y2 d
rename MOM_SYS_do_template MOM_do_template
2 C+ Q* ^: R H7 t}7 E' k0 U$ I' ~: u
& ]* D$ a' J Z5 R" P
4 c" h1 T# j) z
& Y4 @9 a7 S6 d% U8 s9 [
- t( b& l- k+ z" ^
#=============================================================
* k9 f8 N' N/ P8 ^1 N. A! Zproc MOM_start_of_program { } {- j3 n5 [+ Y( b* f# }9 f
#=============================================================
z+ ]/ B. s$ G# @% \) I: k global mom_logname mom_date is_from
( H) E* o, G4 Y! j global mom_coolant_status mom_cutcom_status/ r- |! b8 W h7 W2 t4 _6 G3 J
global mom_clamp_status mom_cycle_status
- q( a; ^* d4 Y J8 r! z global mom_spindle_status mom_cutcom_plane pb_start_of_program_flag
0 C3 R9 `3 E7 b5 N6 C$ n' W global mom_cutcom_adjust_register mom_tool_adjust_register
- ]9 V* H: N( f, y global mom_tool_length_adjust_register mom_length_comp_register/ _- t) ]7 |) F7 D
global mom_flush_register mom_wire_cutcom_adjust_register; n, X5 {7 h4 d6 u8 F; q4 v
global mom_wire_cutcom_status0 `% R" b" [) L
4 o, e" A1 S7 s; S( [: n
set pb_start_of_program_flag 0" s3 f+ A: m3 ?9 u6 o
set mom_coolant_status UNDEFINED
% H' `/ u0 p1 ^) g set mom_cutcom_status UNDEFINED. W z9 `0 w$ U) X6 Q: `
set mom_clamp_status UNDEFINED1 m$ B! p* f& ?# F
set mom_cycle_status UNDEFINED( u) l/ L4 q- j; b( ~1 U" f1 S
set mom_spindle_status UNDEFINED
! f3 Q8 j" e, c) @% F/ o set mom_cutcom_plane UNDEFINED. K- C* k8 a" b0 d
set mom_wire_cutcom_status UNDEFINED! O7 B0 m* ^" ^1 A# W0 u- o
2 `7 C/ F& A/ d9 Y% I) g. y
catch {unset mom_cutcom_adjust_register}/ S5 X5 R$ L& K# z, B; S3 h/ n
catch {unset mom_tool_adjust_register}
% K0 T+ {. `: a8 q+ V# r6 | A/ }! V6 s catch {unset mom_tool_length_adjust_register}1 {3 m4 e7 T' v6 }, h# } u
catch {unset mom_length_comp_register}3 ?/ g: _8 s7 H6 ~3 c1 A* R. Q C
catch {unset mom_flush_register}
5 T5 e4 M' F/ N! m catch {unset mom_wire_cutcom_adjust_register}0 c: q) C: B8 R! I( [6 u* [& P
# Y8 G5 O/ ^/ T2 N' V& v+ v. j7 Z set is_from ""0 v+ ~- u" b! @$ n" x- l
: b6 O/ y# Z5 R% B# A0 f1 L
catch { OPEN_files } ; #open warning and listing files# M. O4 ^5 d! R6 g; n5 K. Z e5 x
LIST_FILE_HEADER ; #list header in commentary listing0 S) k. R- D( J9 W6 F" m
, [: O6 J& p: Y; X3 e6 N8 }
: b2 m3 f; X% y( K' c0 X
6 q J# }1 F: y1 x; R global mom_sys_post_initialized/ k5 U4 c! Y) n: Y$ @
if { $mom_sys_post_initialized > 1 } { return }
" K0 C6 u8 n" p2 g+ r
8 Y$ H5 I6 a% |; [! G! h" K
' l' H U" g* r7 o1 q. \#************+ L4 N+ f7 V! V
uplevel #0 {* v2 P& j# W, d9 E; O
1 A: L$ y5 h, S# H2 A
4 O; G" W& x. [* ?8 Y, E. I
#=============================================================
, Z' z; H; i% o M& @' C& f7 T) bproc MOM_sync {} {
+ ?: w) G" D8 i#=============================================================5 y& m. F b* [- B* W) ?1 K
if [llength [info commands PB_CMD_kin_handle_sync_event] ] {$ t# X* V, I2 m- t# t
PB_CMD_kin_handle_sync_event
4 F! y$ e# b# b5 o5 O }0 \+ q0 \% _ n3 ^' q
}
5 K, |. h$ Y8 ?0 X
% l# [% }4 L- L t2 T/ c, ~5 L( e* K4 G3 N, ?, F" S1 U' e
#============================================================= ^* Q. [8 f7 F& f3 J' {
proc MOM_set_csys {} {
6 G. e" v4 N" {& W% C( {#=============================================================+ E# k7 ]$ [ x0 x0 I
if [llength [info commands PB_CMD_kin_set_csys] ] {$ \% M1 X0 E; F; O/ |* p, C
PB_CMD_kin_set_csys
: n7 z9 p; P/ B }
2 ?; H, ]% z6 H/ K) J( R" b8 O ]}, f/ U- n! K$ X0 I; T
, X$ U( k8 d' O
" }% W- c( N% j/ v7 X2 K#=============================================================
- J; u, ?) a5 @3 L5 z- {proc MOM_msys {} {
! N' v m8 ^( T% P$ w0 l3 {#=============================================================( h) ]/ e5 ^9 q5 U
}+ w; Y v0 K! P9 J A2 ?
/ K8 j+ u' r# F5 p8 {! z% E) P+ P0 i* p8 d* G' ^! Q" M
#=============================================================
! _2 g8 r/ g* V' Nproc MOM_end_of_program { } {
3 S/ w. i/ T5 M' \3 a5 n#=============================================================$ s' x4 q* S# z; @
PB_CMD_end_of_file
* R9 H2 U- \3 e/ C PB_CMD_calc_machine_time
q; t$ Z( R$ g6 U& I
/ m- L% E3 U! o) D* Y H! ?#**** The following procedure lists the tool list with time in commentary data
) Z) M4 h1 Q' n; u/ H LIST_FILE_TRAILER
" ^" Q9 f$ y" `& b6 ^! M; J* O5 k% u
#**** The following procedure closes the warning and listing files
2 V$ ~' P5 P- i% Y: s- k6 f CLOSE_files
% ~1 j* u ^6 e- a}2 \% w6 [8 h5 b/ A. I8 ^+ s4 N
0 ^* e! E& ~; F# G
) u7 N, F1 M8 y" b: y incr mom_sys_post_initialized
4 O1 J, Q( i% I; ~4 R" V L) V. M$ M3 c" d
( B) n2 n; @3 S
} ;# uplevel
$ R {' {/ {- y0 h; T#***********7 W1 y3 K' {! u. j& B
; `8 h; I# A- O8 `0 X6 v0 K7 U
! s6 M, g; l3 g/ [* O% {}
/ a3 ~' s% {* Z3 ^! W7 Y
' d& c+ f4 ^6 v; F7 i% _
+ U5 x& O3 e4 c% b#=============================================================
$ X7 l, v3 w! {* R6 n* `5 cproc PB_DELAY_TIME_SET { } {+ i9 o3 a5 N" r9 O" M9 l
#=============================================================; x4 t: \' w, ?0 Q! V1 K' j
global mom_sys_delay_param mom_delay_value) m% r9 B u$ p: u* R
global mom_delay_revs mom_delay_mode delay_time# |0 b- ?( b; E) n
1 a9 ]" M7 x0 ~% S # post builder provided format for the current mode:
& g2 e, O' M5 J1 W if {[info exists mom_sys_delay_param(${mom_delay_mode},format)] != 0} {
# M, L( _9 O* a, n% B MOM_set_address_format dwell $mom_sys_delay_param(${mom_delay_mode},format)
$ N; x' q1 V) p K7 S }+ } j( ?( w+ w5 X+ G" v6 e& g
2 s; M1 v' G. k% H) n7 c0 ~/ o1 G
switch $mom_delay_mode {# P6 C$ H: k! k1 C2 R2 l; `
SECONDS {set delay_time $mom_delay_value}
7 s" S- Z) }$ b3 H1 W default {set delay_time $mom_delay_revs}
" T! O1 i+ p$ r! ~ }
0 ]/ \; e7 s0 e* F( `}3 t Q( @. C8 h' Y9 E8 U
- f: s4 p0 z9 v8 V' P
8 T D) B9 O0 Y% U1 x0 V
#=============================================================0 U+ b7 |4 W4 g+ t
proc MOM_before_motion { } {
1 ~+ V% S& n& V! x9 g#=============================================================4 q& H' \+ [/ ^1 T
global mom_motion_event mom_motion_type
5 B/ i% H1 @2 \- e. F0 R Z7 a3 s1 }. Q5 Q" j) E
FEEDRATE_SET
: Y) ^4 ]. [. E- ~; w0 |7 g+ D6 K' g8 f- ]2 l6 v7 ?: Z0 k
3 L: i) I9 S/ j. q% U" C/ A/ A: \ switch $mom_motion_type {
# q) ]! V; P* D7 U) r% u X9 \, v0 m5 a ENGAGE {PB_CMD_kin_wedm_engage_move}
$ v7 T7 Q' V5 L/ x; l9 e9 A: E( S4 I APPROACH {PB_approach_move}
% n% m0 e- ~+ o/ `! T0 c FIRSTCUT {PB_first_cut}
7 U" R4 ]* t5 E" _# D# y RETURN {PB_return_move}
' n! X7 B' V6 ^: r }0 e$ S7 i# l w& g% c4 m1 M
$ ^+ `6 ?' P) y# n9 ^
if [llength [info commands PB_CMD_kin_before_motion] ] { PB_CMD_kin_before_motion }; ?6 J* M7 _9 [- I k0 \
if [llength [info commands PB_CMD_before_motion] ] { PB_CMD_before_motion }2 O5 `6 j: z. q: ?
}
/ p1 c% T) ]$ ?$ Q* ]8 J4 V, ]: |* ]& q- @9 U
$ V3 ]' t: h% r+ |( v3 l#=============================================================
1 w# p% ]2 h8 Q: f: [0 }proc MOM_start_of_group {} {
/ n0 A: S4 p% n1 x0 W#=============================================================
9 o3 }& B. o$ o+ ^ global mom_sys_group_output mom_group_name group_level ptp_file_name
: S( n) w& y: S global mom_sequence_number mom_sequence_increment mom_sequence_frequency
( {9 i( C4 J* c; Y1 _0 S global mom_sys_ptp_output pb_start_of_program_flag" F) F. l7 _# t
W! L- [2 {' _3 g$ [: N* j
if {![hiset group_level]} {set group_level 0 ; return}. x6 y! u% y$ ]5 U
0 U+ r! N+ R/ |1 V; A if {[hiset mom_sys_group_output]} {if {$mom_sys_group_output == "OFF"} {set group_level 0 ; return}}( U0 k& F! f: a" j2 V) H% E. a
/ S+ G( U0 J2 O- l% X( L/ A
if {[hiset group_level]} {incr group_level} else {set group_level 1}
% r; M+ [, i1 g5 J- v- ]2 s# i0 w if {$group_level > 1} {return}
7 s% P2 o& Z5 f! e
- H; J2 S0 x$ u: \- M SEQNO_RESET ; #<4133654>: ~0 P# r" N; u
MOM_reset_sequence $mom_sequence_number $mom_sequence_increment $mom_sequence_frequency' H' K7 F: K: ~
( d% h5 a# Z' L5 w- p$ E2 ^7 H% x/ s
if {[info exists ptp_file_name]} {
* n" Z; o0 O% V! v' Q MOM_close_output_file $ptp_file_name ; MOM_start_of_program
9 Q& @1 \, ~% V2 q! H4 Z if {$mom_sys_ptp_output == "ON"} {MOM_open_output_file $ptp_file_name }+ c) ^+ P* X& I
} else {) J/ A5 u) ~0 D' O, b$ z
MOM_start_of_program1 M7 w2 `; c0 T4 j5 ~+ |5 ^& Z
}7 g, r) v3 U) f4 T. K: A6 x0 b
) R) h. F/ ]& y! Q! |5 r ~) f
PB_start_of_program ; set pb_start_of_program_flag 1
" m- a$ V9 ]( D9 j- B5 [- e}
% n4 | G+ G8 t! L. \& A* |0 l; \" X0 S9 l8 r* d
7 l Z- Q" Z; g" ]
#=============================================================
7 `6 {8 D0 ]4 j' {& V/ jproc MOM_machine_mode {} {
$ t# g, Y4 i" r) }7 f#=============================================================
! P+ K+ \* ~- F global pb_start_of_program_flag
' z' W! a; P- q7 z5 X# Q4 p# C; y/ c global mom_operation_name mom_sys_change_mach_operation_name$ p, Z" e# ]" `
) T6 R+ P }0 Y set mom_sys_change_mach_operation_name $mom_operation_name! ]4 |% u9 m b5 M2 W2 s
6 Y \$ T: c# o, p
if {$pb_start_of_program_flag == 0} {PB_start_of_program ; set pb_start_of_program_flag 1}
4 K+ I# E; E: G2 V) @6 W8 u- d/ V: {9 i
if [llength [info commands PB_machine_mode] ] {
- u: q1 k# B. W4 _ if [catch {PB_machine_mode} res] {6 ] c* W9 ]3 l* A) q8 ]
global mom_warning_info$ U% T ]! o) s2 W& j! a/ m( i( x; F5 a
set mom_warning_info "$res"6 N' ~2 k- [, a# S: l$ b* M
MOM_catch_warning
% w% |* M: C+ X# N% z }
; u; @: B5 {+ G% A! V/ o }
, i/ @" |0 Y: A& C}/ a9 D- s3 B$ I7 f1 V+ s. \: D
4 v- ^, c+ ], L, n- m
- G) c* @( O% i" @ ?2 u- ~3 E
#=============================================================
5 D5 t( E- A; F" z. V- pproc PB_FORCE { option args } {- x% H* `8 z! W5 F; y
#=============================================================' v2 V/ M. b$ k1 G G
set adds [join $args]
6 y7 `+ \" y" U4 @5 T( ~9 j4 x if { [info exists option] && [llength $adds] } {' M& e: o. V' U8 O6 b5 h7 C. C
lappend cmd MOM_force
+ l9 Q) F. Q( x4 g3 Q# z0 E lappend cmd $option
; F' j0 ~1 t5 m lappend cmd [join $adds]
' D- O" w. L3 c6 E eval [join $cmd]: W. K( ]% f3 _0 y4 \
}
! @7 [- }) C9 @4 n: a# `}
( a- p- V& F0 W3 v% |. m5 r* }1 M% ^+ n& t! M* S
7 X h6 W- R# }/ k#=============================================================( k) `6 k) @, F; L8 w
proc PB_SET_RAPID_MOD { mod_list blk_list ADDR NEW_MOD_LIST } {5 q4 ^9 P5 {$ _
#=============================================================
' d, W4 i1 i2 ?& J) C: | upvar $ADDR addr& z, v- o B, a3 r# f0 p" @
upvar $NEW_MOD_LIST new_mod_list
- f: k8 U% G3 R7 ^ global mom_cycle_spindle_axis traverse_axis1 traverse_axis21 r' \+ C& O6 l3 I, s! B- Z! ?) ~
& r" X( C; }2 h
6 ~4 I9 u ]2 g( O set new_mod_list + Q" u: c5 R) o
X7 x4 S& \% N2 E foreach mod $mod_list {
7 e. Q# J, v7 v switch $mod {7 |; F' x# ?( V' A
"rapid1" {
* C* v. m( }- e- r# V: e8 i set elem $addr($traverse_axis1)
, v% {+ k0 c* b. a' c' Z @ if { [lsearch $blk_list $elem] >= 0 } {
4 G- [ L, S, z s4 ?; T lappend new_mod_list $elem# ?4 V9 i- i7 K3 i* y3 e5 Q5 e
}
& D& U; R" b6 l }
4 @, W* P" z, m+ ]% D" O "rapid2" {" z2 y L; q2 X% ?' M3 J* d; ~
set elem $addr($traverse_axis2)
* T3 w4 o) {' f" X' o: q, a if { [lsearch $blk_list $elem] >= 0 } {
]8 Y! B3 u( A/ u0 S lappend new_mod_list $elem- F8 u$ c2 N, B9 o' H+ ?/ v
}" c+ S" N! m# `0 p6 I0 U
}0 F% k- \. M( k: w
"rapid3" {
2 O7 f6 R& e- @8 U/ w5 A set elem $addr($mom_cycle_spindle_axis)& _% y& |5 I/ f/ c, P: _, T
if { [lsearch $blk_list $elem] >= 0 } {. r7 O; I* A- f- G2 g* e
lappend new_mod_list $elem/ L" q+ Y' v s9 w1 q
}
1 I$ K3 }' y' J% s$ ]' D }' v+ i6 X3 W& a+ h ]2 g4 t
default {
5 o( w9 U/ B \. W set elem $mod; \, K2 w# U4 B' S5 N- F
if { [lsearch $blk_list $elem] >= 0 } {
8 }+ i3 `; `% U2 t, {, Z! \( } lappend new_mod_list $elem9 e& e4 E7 g2 @8 U; F; G
}
+ C6 j) _5 m& O# G% b$ n; h, ~ }
4 C$ g/ s7 V5 L% W' V' \! \1 A }
. a9 i8 E9 }) m/ K9 u3 R v }# A4 ~4 ^8 @9 P- F9 }7 M
}
( T) O ?6 d8 c6 z' b0 d
, D" {: i! S) _' j( H1 [) x" W3 I# K' F
########################, K5 L% @% l0 z, k
# Redefine FEEDRATE_SET$ w E: C& b- C x+ S, m' I% T
########################3 h0 q% z$ ]7 W. X) t, u9 n- q" D
if [llength [info commands ugpost_FEEDRATE_SET] ] {
$ O# K% _3 p2 B% g9 @. z3 A( ]) C rename ugpost_FEEDRATE_SET ""' |& s0 M, a$ G0 q+ t$ O# x
}1 m! ~4 ]8 B# |- J/ v9 a1 V
) C" \0 F3 V5 R J* F
if [llength [info commands FEEDRATE_SET] ] {1 k4 G" G& P+ L4 }1 X0 i
rename FEEDRATE_SET ugpost_FEEDRATE_SET5 O; S0 g; `1 { }2 n5 I2 z
} else {0 r) N) V2 ]% N
proc ugpost_FEEDRATE_SET {} {}
# Y; Y; L: w% z$ `}5 K6 q6 H7 M9 g! Y5 W0 F9 Z
% B/ j6 y9 L9 y+ M! h2 ^; S. G. j3 o$ H& F4 R8 f+ L- k. Q0 |
#=============================================================; \( R: @$ Q2 p) i# G; W
proc FEEDRATE_SET {} {
0 ?' W# C1 v7 M, n6 B/ n; L#=============================================================
. a" v4 H' x% \: ^; a5 k if [llength [info commands PB_CMD_kin_feedrate_set] ] {! \, p4 k7 G& `2 z
PB_CMD_kin_feedrate_set" L. Z1 T6 i6 m( ~7 y# v* Q
} else {
! Z5 h# q2 q* Z6 F* o. w3 E ugpost_FEEDRATE_SET: P/ j9 q1 |' F, P4 l* e
}3 n, J8 i- i/ z3 ^1 Y
}
4 i7 \) l( n( H6 r( m; p, e5 Q* N3 _% g4 k2 o
. W8 m" ]. f3 F6 g/ w#=============================================================, n& A6 ^& ~) B9 U. k
proc MOM_wire_cutcom { } {
4 L: S5 i8 x$ ?, V$ F#=============================================================
0 u+ c0 u' P" _3 @ global mom_wire_cutcom_status mom_wire_cutcom_mode
- e( ]5 W# s: H global mom_cutcom_status mom_cutcom_mode
& U$ e, I) v1 b& V3 Q0 W
4 ?0 T0 n' g+ `# v* K set mom_cutcom_status $mom_wire_cutcom_status, }2 \; _$ S/ k. C& m
set mom_cutcom_mode $mom_wire_cutcom_mode
$ a/ g: P/ C1 l/ f3 h0 }" o: X) r3 d
switch $mom_wire_cutcom_status {
: s, f8 M% M/ E3 v, S ON { MOM_cutcom_on }8 v/ ]( d: Y% ~ I p
OFF { MOM_cutcom_off }
, X- e: k* M+ N1 I }
& ^- o: |6 E, N8 C' l/ I}
3 M! A) L# b5 ~" ]+ Z, p, M$ i# Q. p+ `: Q4 r
. p5 A7 b) D" x5 X, a5 b( Q G
############## EVENT HANDLING SECTION ################7 @( ~4 N6 U* m3 {# Y
" s( b; U4 Q5 V4 ?+ X* q# U9 k2 |8 p' H/ J" M! K$ P
#=============================================================
) @8 a$ H$ b* Qproc PB_start_of_program { } {
3 P/ o- I v* j) I3 h- e H#=============================================================$ J$ H* Q; g, a
' B; {# Z; ?5 q* g: y
if [llength [info commands PB_CMD_kin_start_of_program] ] {
/ b! c* J: e8 d* T( `6 F1 g PB_CMD_kin_start_of_program; m1 n' I7 K r0 ~5 Q. ^, K, @
}
" q$ E" i" E8 F/ b9 `1 @. n# m8 h6 t3 K6 t
PB_CMD_start_of_file8 k% L1 P2 ^' ?) j
PB_CMD_start_of_program" T: [; `/ y2 @, l5 l/ H2 n- z6 M6 u* t" f
PB_CMD_start_of_conic
; n1 J \" p- u" E5 C PB_CMD_first_move
$ o8 v ~# U% G+ D2 } PB_CMD_drill0 i9 c4 l# r: X Y' V
}" [& b$ M' ~8 L/ T
$ ? \+ M- e! E6 V
* e! s" i8 t% n9 O4 A' r! _#=============================================================
8 C. Z, [! E' V+ U, Yproc MOM_start_of_path { } {# r* Z# `: j$ h, M. q7 E& F
#=============================================================
, o3 l$ k& F E6 a' G( o4 S global mom_sys_in_operation8 p1 w7 L/ i& l4 Y/ n
set mom_sys_in_operation 1
" }- J- @2 A( g6 T9 R" M. y0 o9 H7 S! t' y t2 |7 O4 o! I
global first_linear_move ; set first_linear_move 0$ S; H2 y, G8 P7 U9 Z% n) e
TOOL_SET MOM_start_of_path
4 m7 P2 a4 s: K9 S p0 C9 N7 l
. T! I7 A% R' f: p* A if [llength [info commands PB_CMD_kin_start_of_path] ] {
. F, u" J% h2 ~4 X) A PB_CMD_kin_start_of_path1 v& [0 b; b/ s! k
}* u9 U& v, P7 I# e* ? Y
, U5 C* D3 K' M
PB_CMD_start_of_program" o9 R4 E6 x( S' i% C4 Q
}6 M1 M+ A! ]0 M
5 T" b, i. g/ Y) A( P
! L# y1 _% D9 J8 Q* x1 b$ y
#=============================================================
9 q- } s; e% W& ~- _# X( tproc MOM_from_move { } {
# C! L' X) c! ]( c#=============================================================
3 z) Q1 X* _+ a; `8 b/ \ global mom_feed_rate mom_feed_rate_per_rev mom_motion_type mom_kin_max_fpm
1 t! {; o0 w2 m+ y0 k$ |' ]0 }2 p/ q COOLANT_SET ; CUTCOM_SET ; SPINDLE_SET ; RAPID_SET
, N9 l! ~9 j4 ?6 o' T ~9 m# E}
, Q$ c' H! U& g+ B
j$ q1 y$ y+ X( d- }' _6 W! [" L3 c. @* |: S2 e' J. I
#=============================================================) F& A" v( W3 C1 v
proc PB_approach_move { } {
, l& x j( \$ i/ D$ o#=============================================================& g: f0 C7 N5 K" ?5 n$ n ^0 D" e
}
9 _) @# Q) ^4 N- {+ [* I; w- Q- _5 `5 A
( l/ g! b3 |2 A. t* D3 ~) s3 y
0 d( r2 I9 Z- g. A$ r B6 o' [#=============================================================5 T( V7 h8 R2 O
proc MOM_start_of_pass { } {
; t, d8 ?% z: a) c+ m* E#=============================================================, t" _, a6 F! C0 g e6 N( T
global mom_sys_start_of_pass
6 N# w4 H% p( l2 } set mom_sys_start_of_pass 1
7 T# h( T/ b9 b5 W2 V PB_CMD_start_of_pass
' f: j7 a3 U3 m}& J# P- K) v( C( R) A& Q
( k/ u- H0 G& C" T5 w
2 n% }, I1 `/ a8 B( c#=============================================================; }3 b1 U4 g2 G: `5 k1 o& Z1 B
proc PB_cutcom_move { } {) r# ]8 R4 s' R8 a) r1 X
#=============================================================
/ e: n6 Z8 U) r3 Y: A. @}: X: J0 O0 v, C- t
% m4 x. ~& T5 u9 g( g0 R2 q
' S& p" h5 \. ?" R#=============================================================# K3 |# a. O6 L# W& H$ l* F
proc PB_lead_in_move { } {
( ?% E0 ]' m4 O7 n z; a#=============================================================
5 C* X) E" m# y* R" o8 O; r}1 a% m3 L V- Q; G- O8 H8 e+ ]
+ ~: K/ ~( g6 q* }3 {; ?5 Q/ k. [8 l
#=============================================================
8 r. Z# {1 b: A" ^0 n. A6 k6 Eproc PB_lead_out_move { } {0 O& I4 ~1 R0 `$ a/ x
#=============================================================- i# F; m- l/ M, v8 D
}
9 W5 O! d- x9 v% B4 @! I5 J' x* C3 R" O+ o* g0 _
* L( L* o0 f% B) y# Y
#=============================================================: h! z4 u( S" J8 r4 E; M7 d/ A
proc MOM_end_of_pass { } {, Q. K6 W4 c) ?- i# j& z+ M) D9 h1 ^
#=============================================================% ^* G& }) Z6 n3 F- Q% {# V
PB_lead_out_move
, [; c( z2 A5 T% G PB_CMD_cutcom_off
* H0 V s( r+ @& t% B}
# K0 p, Y& U/ U: t
! b4 W+ R8 M$ j+ x4 ? x+ K
4 |0 _: m' d* W8 I+ I* |# i0 B#=============================================================
/ Z8 v+ a' M1 s" rproc MOM_gohome_move { } {4 Q o0 i; d% [- U- c
#=============================================================
" e$ B! w. ~3 r1 E( ^ MOM_rapid_move
/ }& |! ]8 N- t& j) P6 Z5 O) b}: ?8 r) G9 v' A
$ ]# d) q& l0 n2 x$ u3 J! B3 a6 H
* r4 O" Q4 x8 r3 c; N! C#=============================================================6 J( p) E" @, j- E
proc MOM_end_of_path { } {- {, [ C+ c }) x) t
#=============================================================8 f4 Y+ x: K& a
) g4 L6 y, b6 E1 Y" q. B. c$ ?* s
if [llength [info commands PB_CMD_kin_end_of_path] ] {, H2 b. U) r7 m3 r
PB_CMD_kin_end_of_path* A, s6 X8 ^" R6 y0 e' C6 }0 L7 b
}
. V, Z, M' i4 x' Y' s( e6 V1 J, c$ k' D2 j) \2 Z: P
global mom_sys_in_operation
; O. f8 e& c5 k4 g. l. n8 b' M- K1 i; A set mom_sys_in_operation 0 R& |, p E3 b: W8 d6 ?: o- Z& q
}
/ r0 D# I" S5 [6 ~ ]" u7 C# O
) d) I1 b+ T1 g. l& y
#=============================================================
% S; o4 L& i0 t7 G& b. vproc MOM_thread_wire { } {
/ s5 m1 R0 ^8 q$ O#=============================================================
. U; [# _( V- I [! F0 U: C2 \}' g4 F- z+ ?, I+ f& d
! ~$ o' v& o. V0 }- J4 V
- B6 \: M& s2 t: {#=============================================================, n6 x* o' V9 q6 l
proc MOM_cut_wire { } {
& t2 S5 p# d5 z#=============================================================
H" z. d6 E8 U}# K) ?# {! L- |, \, E# i' w- Z
& b3 u: d, x2 v! {
8 M+ P3 l! A6 |$ D
#=============================================================
9 M0 k' q* u2 `# xproc MOM_wire_guides { } {8 f9 b% b8 f! o& f! q
#=============================================================* x% i, C8 M' T; C7 E
PB_CMD_work_coordinate
$ E S' E3 _% ~" Z* L}% `% A. H5 @' [% m) c
' p8 Z, @* w, B3 r) a
: m) f9 G% r0 `' ?4 s- s#=============================================================( f5 j6 g5 a& l: ^+ [6 I
proc MOM_set_mode { } {
+ b2 Y5 D) p$ B! e3 z' m5 s#=============================================================
9 R- r. U! e: K. w3 I2 A Z8 Y}
" E, }, M; h* O" E, `4 K, {
7 ~$ ]+ ^6 k- z
% q* d, `* t7 C4 n6 k! x#=============================================================' k+ z- X9 Z* Y$ B: I8 R" g
proc MOM_cutcom_on { } {
7 Z( n6 i. m0 M! p; a* p! I#=============================================================
; U1 U: s0 w9 s p/ g CUTCOM_SET# E; o( ?/ Q! G, d% J! R5 |
PB_CMD_cutcom_on2 V7 R( v3 h3 h2 ?
}( J, E! w) q( p( j/ h" Y" }
, c& v1 ]7 |! _, z- T( `# l! k# h- S" o7 N/ s) {0 I/ ~% Q5 }
#=============================================================
% O3 \: L, Q {% y/ Aproc MOM_cutcom_off { } {
! V9 l' l/ A) r6 J0 T7 D& m/ \#=============================================================5 {$ b7 J' ?2 t
CUTCOM_SET
; q& a- }" ?+ ^. h6 b6 { PB_CMD_cutcom_preoff
0 p& V: @! {5 k5 K/ |5 p" `- E}
4 t0 m: m4 B" [$ e1 P# P$ D/ l
) `1 \9 {8 `. J/ K% P1 B. e# k#=============================================================
: G5 \& F# K% q. |5 Rproc MOM_feedrates { } {
& g" l3 z7 M+ g2 @; I$ _ a' ]#=============================================================
, H, ]/ D5 c$ i}
2 z7 d4 i% g/ `, K4 s8 U4 L c5 b( B3 d
4 @" h& ^+ @ M8 ]( g; H5 S
#=============================================================, K X. X5 q% ^$ z3 z
proc MOM_delay { } {6 V" C8 f2 y7 _3 g. U( {5 D
#=============================================================
) k. l# E& Y. k* Y" d PB_DELAY_TIME_SET
: P1 Y/ y, d# F* S3 ^/ W$ f MOM_do_template delay4 T7 ~ g* Q8 B4 _5 P( S8 N' X
}
& {9 b5 v. b: r6 N8 Z' D+ L8 b/ n6 x6 R- {6 y
' A2 _ x; \" p8 w w; X
#=============================================================
: C. j+ x9 b, O0 w$ W9 aproc MOM_auxfun { } {
- M' x8 K: k \# R% n( C$ C$ K#=============================================================
* c. V( L; Z. A# K- O ^9 t1 z}
. T9 W& j0 K1 F3 @7 c% p; V/ D6 g2 t7 c' k/ m4 T7 a
k r# j, C6 P7 J/ P4 `
#=============================================================
3 H7 u- p0 M. S! }, bproc MOM_prefun { } {7 v) C- N+ f* ?& `
#=============================================================
$ `" x1 l$ N4 s* Y0 o* I}
8 h; C- Z! @6 ]3 O/ W( q1 {, d. ~( V A8 v8 K0 o9 u. r
8 _8 ]1 C# k2 h+ f+ A/ g9 A#=============================================================# ^/ e$ f: j# W% `3 L8 S
proc MOM_stop { } {7 r5 L8 N, T" G* z
#=============================================================/ d f: K- G# p, i M) X
MOM_force Once M" R# N4 l- }. l$ f' z2 Q: G: |( m
MOM_do_template stop
- C3 J+ O. Y1 [( ?( U" u}
! [& h6 L9 x% {8 @" `! @( L4 y7 c9 L2 ^; `
" a. x5 z+ _3 \ }: o* Z {& ^+ Y9 L
#=============================================================
5 n7 `( k0 _4 F2 }9 f5 ]$ N/ T! Iproc MOM_opstop { } {
, a9 R: y% L% d#=============================================================. p+ @( U u( L- U6 N8 X5 L
MOM_do_template opstop
% K7 [. t$ z" K8 D# I; f4 G- P6 j}
3 L! K, R0 X* N) \
3 b) v9 Y( i& r4 U2 C$ r; q: g2 @( S9 o% `; d" i
#=============================================================
) u6 u9 J) F4 t$ A# k, yproc MOM_linear_move { } {
2 ~% G0 i* L; M& Y7 b( p8 @9 ~( J#=============================================================% A+ c& {% V' O: E# `0 M8 ?5 `
global feed_mode mom_feed_rate mom_kin_rapid_feed_rate" }2 y6 F5 h4 c; }& S
6 X- z; h8 Y9 `: c' Y if { $feed_mode == "IPM" || $feed_mode == "MMPM" } {) V( W9 J' q: m0 D9 ?" V+ }
if { [EQ_is_ge $mom_feed_rate $mom_kin_rapid_feed_rate] } {+ o8 O8 L$ @( A [3 c
MOM_rapid_move' O9 }; L" D1 }
return( f- ?$ V; j* w
}8 E+ J1 M) U/ \- g) E
}
5 g. @1 }5 Y/ M1 {2 g
1 X/ ]9 O3 i4 B PB_CMD_linear5 h3 `2 c/ `& j6 Z" N
}
1 j! ]. e5 ^8 Y1 Y/ v3 m& d. A6 J" o& O5 t) M
: h; M3 M0 b% a. M; [#=============================================================
# P' A2 m- s# V- R/ y9 j* nproc MOM_circular_move { } {
# F% \; _( a4 k8 M: ^/ f#=============================================================0 ^. K1 @/ Q1 z0 ~. [$ r$ Y
PB_CMD_circular
J$ s+ m5 \) _5 Z}
' h2 T$ b0 M2 q' M) C! W- a+ Y9 ^( I6 e+ k3 i% m) ~, D5 w
5 u& u* C6 |3 H
#=============================================================/ x" c; ~; n9 d4 i5 m! o
proc MOM_rapid_move { } {3 W" _2 Q2 N8 W# J9 g- g
#=============================================================4 |& k, g1 ~8 Y5 O
global rapid_spindle_inhibit rapid_traverse_inhibit% J2 v# D" l6 k, g8 t
global spindle_first is_from6 \3 `2 S% N$ S8 F
global mom_cycle_spindle_axis traverse_axis1 traverse_axis2
9 D5 B- W0 ^6 m4 G0 n. ` global mom_motion_event
* F6 F- S N7 R/ l1 q
0 y2 `. t7 A/ a; u set aa(0) X ; set aa(1) Y ; set aa(2) Z* V# r6 B' U0 C* D
RAPID_SET* g& H! F$ z" v7 @1 ^6 `) O
MOM_do_template rapid_move$ w5 u) _+ z" q( v
}
5 F) W0 R, P# _: U: Q$ [( C$ M8 c3 h! ^- v6 w1 D
' @8 l, {% {9 z. m! n#=============================================================
2 a/ m& n* ]1 Z$ ^5 oproc MOM_cycle_parameters { } {
! s) z3 N0 ~6 Z/ U# Y! L, h- P#=============================================================) b( |1 u, ^' ~% T, ?
}
% d N& A: ^) E }4 f- D9 e9 j% ~$ }6 c6 C' h
% l2 n* {/ }. y& N# H
#=============================================================$ ^/ G8 T3 `1 r( L6 ?
proc MOM_sequence_number { } {
( [: S) C( n2 ]' G! h/ }#=============================================================
. F1 a, H1 L3 {( Z; `& p/ }1 c* E SEQNO_SET
& K3 M% S0 p/ z) q% @* W( A; s}
5 ?# `$ y6 B8 I, l- _8 R" S Y' o9 e: P' N4 ~5 f
% w" V$ P* W+ h. B' b# Y/ |
#=============================================================3 k: f: ~; _- W! d- G5 j, u2 o
proc PB_CMD_before_motion { } {
5 u3 D$ p# }+ y2 k#=============================================================3 x: h$ Y% x! A* |2 r
global mom_motion_type* \" ~$ p" ^6 e3 Q
global mom_current_motion
. ^: `# M$ g3 h+ W) A6 y8 ?global mom_motion_distance
: U" m. A8 {: S* Gglobal momPathLength
; b# H5 k! ?% ^
! F( f% ~ k% l+ TMOM_reload_variable mom_motion_type3 @3 v7 ~( v+ |* f; }
MOM_reload_variable mom_current_motion9 ~ K7 W1 q0 q$ b
- v" R5 y8 e7 y$ Gif { ($mom_current_motion == "first_move") && ($mom_motion_type == "RAPID") } {6 q( H# @; u. ~- c2 Y2 P; Q+ h0 ?
## Set location point befor First Move:
( p/ x; i J& L MOM_output_literal "/G05". ]; h4 W6 [. X1 h9 w& q
MOM_output_literal "/G06"1 o6 F: M: ~4 s
MOM_output_literal "/G08"* P9 _$ p% P! r8 h4 d2 {5 E7 C
MOM_do_template rapid_move3 ]2 V, j9 @( i* P3 z4 W8 n- G0 i6 ?
MOM_do_template location_start_point3 ^+ a. O3 e5 U
return, ~$ E* b5 H2 s- J7 J
} elseif { $mom_motion_type == "RAPID" } {, j! a: D+ R; \% v4 l$ Q0 h
## When rapid move, insert and append pause activation:
+ c: x$ W+ M4 W: L MOM_output_text " "
* P$ ?% V8 r1 F MOM_output_literal "M00"
1 `# G6 t; X/ F+ P MOM_do_template rapid_move( u4 ~; A/ T* v ]3 S
MOM_output_literal "M00"
- t, m% v1 r( e1 [* H MOM_output_text " "' F3 c0 G% t' a: q9 }$ ?0 P9 U
return' ^* B6 e( k. ^4 K
} elseif { $mom_motion_type == "CUT" } {7 c0 w: T7 x! x2 s0 o
set momPathLength [expr $momPathLength + $mom_motion_distance]' N- S# M3 ~+ e/ S1 m7 \8 b7 Y9 i0 a9 k
}+ R# p$ K9 g. B) \
}
& y' X' g6 c9 U; I; a L3 h1 }: _$ w
7 D% Y' a1 i. {3 L) e; T& y
#=============================================================2 X# ^- D+ M" `$ ^) a
proc PB_CMD_calc_file_size { } {
* o b# N O# w* P#=============================================================
9 p0 l4 m. {' d) xglobal ptp_file_name
7 b3 k# c: ]7 |* u0 g3 s, w6 G) l
MOM_close_output_file $ptp_file_name
, N" p3 p/ a: nset ptp_size [file size $ptp_file_name]6 h# \) u1 p Y# I. O) ~$ Q
MOM_open_output_file $ptp_file_name: ?3 n$ T7 A5 f' i: b! g: v
) O o4 G* p- B. W% Z: o+ _0 U9 ^
MOM_output_literal "( NC file size = $ptp_size bytes )"' ]$ y+ ]5 d) D0 A# h* h/ g
}; `. L: ?3 q" L" a( z2 L! K
$ M' s8 T' c, ?
2 B; T9 m8 _2 ^* B/ u4 Y#=============================================================
4 P6 `7 p: r+ L @* Aproc PB_CMD_calc_machine_time { } {7 v3 @7 X/ Z& s# n! I* N
#=============================================================% Q* q7 n! s9 o) M! K; W' T2 a& L( [
global momPathLength4 T: c% d- B5 _* k: L$ N$ N/ z6 c
global mom_wire_guides_lower_plane) \1 X! y: i. i# S4 L
global mom_wire_guides_upper_plane& e% a8 O- A7 [2 u, o8 h2 V
global mom_feed_rate0 ~; | b6 m6 T
global mom_wire_feed_rate! C; f1 m6 D/ N. x0 t# Q4 }
* j2 i+ V2 @" z( R, O* K! rglobal mom_kin_machine_type l$ O8 k3 c9 P7 z- v4 l6 `, _
global mom_machine_mode
% {8 _: X5 Y8 A/ o3 Y3 h3 _) {8 d
, f' I& t# o# r( F1 O2 ?. j. jif {$mom_machine_mode == "WIRE" } {1 O. U7 _% P% K `7 n
MOM_output_literal "( Toolpath Length = [format "%6.2f" $momPathLength] mm )"0 X; t4 Z" @4 L9 J4 t" l
set momMachineTime [expr $momPathLength * ($mom_wire_guides_upper_plane - $mom_wire_guides_lower_plane) / $mom_wire_feed_rate ]" q6 R' X1 J7 n6 V# f/ C4 A
MOM_output_literal "( Machine Time = [format "%4.0f" $momMachineTime] min. )"6 F. w! y& f5 O" f* b) a' B
/ X% K; e% g% e8 Z9 [4 ~1 F" Z" N PB_CMD_calc_file_size
+ M. i4 X8 M+ Y* f& N}
# Q' h9 {+ a4 W5 ^5 t7 l7 x$ s9 f}- i+ h/ r" T+ D
5 @1 ^8 }7 l3 k3 {& ? s, J/ W& V$ R. a8 z, p6 E
#=============================================================/ I2 J3 p6 ^- H: W) h/ o
proc PB_CMD_circular { } {
5 M) c: m4 e1 e9 x) y7 E; m#=============================================================
' q, o+ A. d* o2 Y# xglobal mom_tape_status% J% F$ ~. G Q1 d/ a
if { ($mom_tape_status == "ANGLE") || ($mom_tape_status == "NONE") } {
; B' h) _- l! `9 M6 V* P+ m7 o: K w MOM_force Once G_motion X Y I J
; F) a5 l; c# u5 o3 d, {# [9 P/ B MOM_do_template circular_move3 R; ]' Z) a% u
} elseif { $mom_tape_status == "CONIC" } {2 {: z1 x, K5 T
MOM_force Once G_motion X Y I J& ^1 r) [/ B. T: \. [
MOM_do_template circular_move_conic6 z- A/ N+ m# b: K) F+ a' L
} else {- i. q) u1 N4 G. T* \- q2 T
MOM_force Once G_motion X Y I J Text G_motion_upper X_upper Y_upper I_upper J_upper @) v1 O- ?/ U: D1 d' C
MOM_do_template circular_move_complex/ `0 K7 _$ c6 U4 s' e0 |! o4 Y$ ]3 V
}* q* T7 k( S) M. ?, Y
}- N) ]! J, s7 o
6 t8 t/ N5 a: ?; E
; T: g) I7 P& X# L#=============================================================
3 B3 L& |4 b! {* Q9 Hproc PB_CMD_cutcom_off { } {% L1 K' a: _$ e. o9 M0 q
#=============================================================/ G. g4 n( I* l
global mom_wire_guides_lower_plane
* [' L% N$ G9 f- q& rglobal mom_wire_guides_upper_plane/ z: z& K4 ?9 ]3 i* W* \- Z
global mom_tape_status6 j+ h+ |4 F: u
global mom_sys_cutcom_code(OFF)
$ { Y' M5 \- l. nglobal momComplex. A, n" D( R1 ]! o, |. Q4 b" K
3 Q7 S; V d: b7 d: `) z7 W- ]! {
if { $mom_tape_status == "CONIC" } {
, m) {8 ]6 x3 A s0 n, C MOM_output_literal "G75"* V4 O8 r, Q V# o* M3 W
}0 D" V0 Q3 y- K, N/ B
$ y8 A2 w/ `( b- K+ U5 ?! fif { $mom_tape_status == "COMPLEX" } {; j/ |$ e% R. v1 W/ p( N* t3 ]
if [info exists momComplex] { unset momComplex }
U5 b' \' ?6 }) |( B4 x. K} else {. I5 q# A. c) m @2 B2 R- j+ W( h
if { $mom_tape_status == "ANGLE" } {
. r$ O. r' P. d- h5 Z1 O MOM_output_literal "G40"
5 x A* A) W6 l9 M+ C MOM_output_literal "G50"% b3 E0 P, Z* C
} else {
) W" ^ A1 E. I+ G MOM_output_literal "G40"- l a. o) B& |
}6 B$ _& T5 r3 c6 g
}; x, \) |1 U9 O$ {. f% k1 B9 a
}
$ w) }8 c! K6 |* K. H8 R4 ~# Z" s
' E: a8 Z, U( K4 ^0 L: p2 I' J' M7 g; n/ H
#=============================================================
$ B( w# l% _7 p2 e2 W) mproc PB_CMD_cutcom_on { } {0 E8 q; Y6 Q4 D! E5 ]6 V2 R' y3 b( Z
#=============================================================9 U2 S% |; L$ O" J @* q! g
global mom_wire_guides_lower_plane4 j7 F) x5 @. U6 _
global mom_wire_guides_upper_plane1 O2 U# S" o( r: l1 I
global mom_tape_status- N( ~" F: x# k3 M7 N
global mom_sys_cutcom_code8 }& U: B( g. ], l
global momComplex
2 Q2 i1 ~) ^; Bglobal momConic' b ~5 d5 ~' K
global mom_wire_angle_command
6 Z8 Y1 W8 M3 B! {; I% I/ q8 a- c" |4 o6 v
global mom_sys_cutcom_code(LEFT)
3 m+ w' `- u* q' W6 p: Sglobal mom_sys_cutcom_code(RIGHT); m# n) o$ O+ Z2 ]- T
global mom_sys_cutcom_code(OFF)- s R% P1 S( d/ y8 c$ M
global mom_wire_cutcom_mode
- K. x. X5 b. a: Vglobal mom_wire_cutcom_status+ h2 i1 N2 s7 ]% J: h' c, K" x5 ]- ^
global mom_wire_cutcom_adjust_register2 k( J5 t J& Q& d
global mom_wire_cutcom_user_register, A: L1 {6 q% i1 @: m1 B9 @- L
; e$ o! M7 o1 \* n- F( O! \2 V
MOM_reload_variable mom_wire_cutcom_user_register
8 F! k) Y& G% b7 [5 aMOM_reload_variable mom_wire_angle_command
/ _1 d( p6 R. s; l. p. D! VMOM_reload_variable mom_wire_cutcom_adjust_register
# U' K$ \; W% |# b6 s% cMOM_reload_variable mom_tape_status
' P K7 _3 q% Q2 ^8 ^5 `- p3 S- C: {
if { $mom_wire_cutcom_user_register != $mom_wire_cutcom_adjust_register } {& }- R7 o# Z0 z' J. ]; E4 v9 O6 x. Y
set mom_wire_cutcom_adjust_register $mom_wire_cutcom_user_register( d5 p% \7 ?! {) j5 e7 j7 y
}
3 t- W, }5 y3 n2 q. Y) s/ C: K6 }6 `
if { $mom_tape_status == "COMPLEX" } {
6 R/ m6 W @! {% y% v4 x MOM_do_template cutcom_on_complex
. j+ K+ X9 p4 S2 Y0 x$ F! H set momComplex 1& U" R% v9 m8 ^2 e7 w3 p* [ t
} else {
- ]( s9 g" `* Y: j) v5 e if { $mom_tape_status == "ANGLE" } {
7 U" o7 d. C6 Q if { ![info exist mom_wire_angle_command]} { set mom_wire_angle_command "G551 A0" }
) H3 T8 H5 ^) \/ g6 ]3 @: r MOM_output_literal $mom_wire_angle_command! @- O( `: U3 n! v/ N
}
' ^) R5 f( h' J' @8 x" d4 p if { $mom_tape_status == "CONIC" } {
/ O8 }1 m# J0 q2 q f set momConic 1" w! ]$ n$ c# ?+ ]5 n* A* z. ?
}/ O: r9 t* b D. M4 H2 q
MOM_do_template cutcom_on* v0 @. s* l2 O4 X, z) _" J
}8 d- ~3 G* v+ Z
}
% k& R: `3 M3 `3 Z% Y# ^! d) I# Z$ Q9 I1 c: x
5 K4 ]7 x& l. g% H#=============================================================
; l: \; Z I" r! n1 o+ X' Bproc PB_CMD_cutcom_preoff { } {
' M% J, X/ m8 O5 ~. f1 D( X#=============================================================3 y: V7 c5 ~ a; `! S
global mom_wire_guides_lower_plane$ p$ a( S. }' k0 d$ o
global mom_wire_guides_upper_plane" V4 S) S) C1 r* w' T# f
global mom_tape_status8 R. M O1 N3 J* h* _+ Z2 G
global mom_sys_cutcom_code(OFF)1 |' Y# i7 f4 ?6 c/ F }
6 C) w* X5 F/ Q/ bMOM_output_literal "M00", l: R! _4 A: c( h! V
if { $mom_tape_status == "ANGLE" } { MOM_output_literal "A0" }
7 W- ^7 r( F* g) q% \if { $mom_tape_status != "COMPLEX" } { MOM_output_literal "D000" }% g( ]! i* V1 ^/ g' h
}/ x& B! S S& a0 I' M
: `9 H3 e1 p% P9 M
" c- V W b7 }2 ]0 j/ t#=============================================================
; P; z9 j$ S$ }5 r( k$ t; Eproc PB_CMD_drill { } {
" m0 Y9 K/ `/ ]' \2 u3 X. t#=============================================================! M' y7 z# z! N- B" N. }3 [3 {
uplevel #0 {- y$ i% I: d& ?9 d, F
% D# K% t: B0 [% `) y& F3 p
set mom_kin_wire_tilt_output_type "COORDINATES"
' f- D1 B2 R3 | #MOM_reload_kinematics
% z0 o. z' D( ]
' e4 S. L5 L& _' \; H4 E! Z3 l proc MOM_drill_move {} {
7 t$ \6 x9 f% [. p& e# l global mom_pos) a, M5 c4 _8 |/ J. R
3 Q p% v! Q# Q MOM_output_text " "
; `1 G) m7 Q$ j( q5 Y6 Z U e MOM_do_template rapid_move
+ D4 s$ W& J$ B& o* ` MOM_output_literal "M00"
. G) J) W2 n9 H: E9 D! M/ @! ] MOM_output_literal "M98 P8888"
f a) u% f9 u, ~: a }1 n2 l' C$ \, I/ C0 \
$ p. \, P/ g% {" u& ?
}. J/ U! Y- K1 r, n
}# k+ [9 ~0 F& y, N# e4 b
: I+ s: o+ o) W0 D8 G# z! X3 ?
3 s. ?5 J2 Q7 i/ }9 a3 q" l2 i% n#=============================================================
. N7 B# \2 i: g# N5 jproc PB_CMD_end_of_file { } {
4 I( M8 r) J6 f4 s#=============================================================; G. U0 S: I6 B7 I7 T% P' B8 }
MOM_output_text " "
6 L- O& I3 b8 w' D. S$ }MOM_output_literal "G40 G50 G75"
# p9 x8 }: F7 I9 i- d5 uMOM_output_literal "G90 G09"7 A( U+ z2 s+ M& w% `0 D f" U
MOM_output_literal "T81") u( \8 H' v4 V7 A ]2 l! Y
MOM_output_literal "T97"' e' v1 y# p' ~7 c) z! y! s
MOM_output_literal "M00"' G4 \2 c( h P& ~9 m7 _
MOM_output_literal "M02". x7 u1 {* F" \! K' N$ J
MOM_output_literal "%"/ b. Q' m6 N2 ^3 t; K, [
MOM_output_text " "; y$ ]' X9 Q4 V$ F2 B- ^! Q+ g
}
: S- N. y9 Q1 P' h" o" w% p- l, ^& K( E# S/ r
% R5 F8 }+ Q1 h' p# |" U#=============================================================# a! ]. m, `7 g, v/ F, f0 `9 O
proc PB_CMD_first_move { } {
/ ^" w B9 w' p ^2 P5 W+ X k; Y#=============================================================
' {3 B. I9 g) puplevel #0 {
6 C' _" n5 u0 S2 R4 i proc MOM_first_move { } {
8 G9 _! S8 z `9 P# F MOM_output_text " "; ]- e- ^) p, Z/ @7 h: {' |9 W
MOM_abort_event7 h! W l; k: s, v) ]
return: A/ \ J( N& a w7 M& f
}4 _- Y+ |) ~# T
}: Q; F# b) y: n8 V2 U: Q% ~1 k; u, L; W
}7 |' ?1 X2 v8 h2 f* y$ I# s7 A$ A# u
: x0 w2 @ [1 h$ g" @& }7 i5 o* \! u3 b) G0 a0 _
#=============================================================4 x) k3 ~ w7 H" V: F4 ^8 `# U! f
proc PB_CMD_kin_before_motion { } {
8 i, ~ q! d: w! C: T% u#=============================================================
6 S" c! P% j+ i4 s0 I* q3 h}
; m$ Z: l% I) @9 b1 h9 Z# s& T0 [5 J5 t- f/ L; r/ I" _
0 S) C |) O1 @; r7 W#=============================================================. l. A6 f* F+ c
proc PB_CMD_kin_feedrate_set { } {
" g# @7 s# K& V0 j#=============================================================' h* s- _9 R4 u3 G& B& B! q
# This procedure supercedes the functionalites provided by the
# J/ W5 S J1 Y8 q% P# m* [ P# FEEDRATE_SET in ugpost_base.tcl. Post Builder automatically/ o0 A4 Z: F X
# generates proper call sequences to this procedure in the t7 s, C6 R {" v* @& x8 j
# Event handlers.6 m L7 l- o6 a) ^6 ~
#
+ y/ Q8 y5 x5 {( o# This procedure must be used in conjunction with ugpost_base.tcl.
% e/ g b/ e4 Q3 m% {; |! _#1 n, w X8 I0 L0 Q# W+ J
global feed com_feed_rate
/ M' H% v( a6 X4 e global mom_feed_rate_output_mode super_feed_mode feed_mode
5 T2 a: I) A( d+ p, d global mom_cycle_feed_rate_mode mom_cycle_feed_rate5 D, A. R' q9 _; y& X- A
global mom_cycle_feed_rate_per_rev
' f; C0 X9 Q& V1 J8 w9 F2 o9 O global mom_motion_type
0 R* A% N0 n1 K$ t, N4 ?; w global mom_warning_info! F G; `' {- M7 H. c( O
global Feed_IPM Feed_IPR Feed_MMPM Feed_MMPR Feed_INV
" E/ q7 c" X/ q1 ]3 } global mom_sys_feed_param
! o* A u0 h& E$ O3 `! C1 F global mom_sys_cycle_feed_mode
A$ ~1 W9 y3 M0 m) m! c& b: n% f: P) I* j3 `- D2 w$ u
1 {2 _: a7 S% ?& ?5 v1 d: p set super_feed_mode $mom_feed_rate_output_mode- ?& U7 D, n6 g5 p
. s2 n, t; l5 n: v) k2 Y4 S8 ` set f_pm [ASK_FEEDRATE_FPM] ; set f_pr [ASK_FEEDRATE_FPR]
* C# ]% D( s+ @) [% V5 g* }2 d
: j/ }7 ?* i0 R5 r! } switch $mom_motion_type {
2 b2 m$ Z" A" z% Y c& d* e4 W0 J% ?- F
CYCLE {( f" i; t2 W4 |; F9 t: x5 A
if [info exists mom_sys_cycle_feed_mode] {
- G3 w0 V3 S2 }0 w, f2 ^ if { $mom_sys_cycle_feed_mode != "Auto" } {4 _% g9 P. c4 o/ q$ R
set mom_cycle_feed_rate_mode $mom_sys_cycle_feed_mode# b% ~) L9 m0 j h
}
$ x$ R: a) ~6 C& V, N8 H }) n4 D( B8 S4 x) T& k, [
if {[hiset mom_cycle_feed_rate_mode]} { set super_feed_mode $mom_cycle_feed_rate_mode }
4 N4 C5 R- b/ T X6 } if {[hiset mom_cycle_feed_rate]} { set f_pm $mom_cycle_feed_rate }! W' @' y% k+ I0 E! j2 s4 K
if {[hiset mom_cycle_feed_rate_per_rev]} { set f_pr $mom_cycle_feed_rate_per_rev }7 {- F* m5 s3 m) j& c3 }8 ]
}
; J/ k4 M7 e* ]
/ q" V6 H+ e8 Z0 F! v8 W6 ]! E/ g FROM -
' `" T" B) `3 A RETRACT -6 H& D, V6 T, ^: _
RETURN -4 L4 h h: A' V6 u O
LIFT -4 Z# u4 B9 w$ l2 B3 F$ ]% g
TRAVERSAL -* o6 a1 N" J; {% h% [
GOHOME -
- H, K* h5 D; b0 [: h GOHOME_DEFAULT -2 X% E1 a$ i O+ ~3 H
RAPID {
& Q* c0 b: ^" Y: p0 U5 H SUPER_FEED_MODE_SET RAPID* Y" K6 K8 a& v ~9 T
}; q0 N0 k. H6 a, ~. f8 H
# N R U: `$ w6 Z
default {3 A/ a6 D2 w8 J4 z$ e
if {[EQ_is_zero $f_pm] && [EQ_is_zero $f_pr]} {2 C9 A' t) i p6 k8 o! Q3 p: k, V
SUPER_FEED_MODE_SET RAPID
$ V l$ A0 _# ? } else {
* t$ d% X1 M" O: R4 Z1 ~: x SUPER_FEED_MODE_SET CONTOUR
/ g5 s" @& F- O( P$ c3 r }
3 J3 ~" \6 V+ M5 | L; u9 o9 P* v# ] }
. R& v8 t Y% w) z4 Y/ f1 s }
# A# i7 U' E3 [+ L: d) a& _0 c+ j3 r1 Z2 g }7 e5 n
6 T. b1 S$ s9 y
set feed_mode $super_feed_mode
8 b, Q' i4 @& V" K2 u8 J6 y8 r. \5 T# c3 n% \! {% t5 f3 l
3 [, Y3 t2 D e# | ?9 ?. G
# Adjust feedrate format per Post output unit again.
/ r: \& V7 }) W1 x1 K global mom_kin_output_unit
. f) U$ v. d: X5 O2 I if { $mom_kin_output_unit == "IN" } {4 H0 V9 D, K6 `
switch $feed_mode {
, J; w' J* a2 q! i- g MMPM {
) e! S2 ^: ?! o6 A. E i, H set feed_mode "IPM"0 x' Q- j/ T$ G" `& y
CATCH_WARNING "Feedrate mode MMPM changed to IPM"
* J: r2 m$ d: L; z- M: P }
. x3 m+ [5 Q4 C$ S" f MMPR {/ T `* g8 B; ~( o
set feed_mode "IPR". b$ b' B. f5 T! n; X
CATCH_WARNING "Feedrate mode MMPR changed to IPR"! _& {# Y/ G# L0 R) H4 d0 z
}
( l4 F& i& h4 P" k2 T+ a- @, A }
2 T- S4 Z- o- V8 |" }3 J m, I/ [ } else {& c8 g& t/ Z! N$ s
switch $feed_mode {
$ W$ J( ^" \( Z$ }, K7 n IPM {
' f, Q8 }. `, m set feed_mode "MMPM"
5 _2 g* Y; V: j) {/ V* } CATCH_WARNING "Feedrate mode IPM changed to MMPM"9 J9 F, U3 p/ O5 f
}
4 H( U) q# j! _, m8 E Z0 B IPR {
* v3 @2 @" Z8 Z5 Y% R set feed_mode "MMPR"' n+ P/ N6 r7 @( L+ R
CATCH_WARNING "Feedrate mode IPR changed to MMPR" G! X7 s7 f7 Q# h) ]* V
}9 Q' ^6 i) W9 Y
}+ C Q0 S) G l6 c
}
1 W$ ]& p4 h9 a0 ?
5 z# c- y* C! _/ L* g
# c5 {9 M2 e7 t B2 F9 Z switch $feed_mode {* v" o- {5 N; N0 b, N: t+ x
IPM -
; D. R/ d. j- V Z4 |, m* \( Y0 b MMPM { set feed $f_pm }
6 \- x S$ e6 R3 a5 O5 i3 a" r IPR -8 w" ?% W9 ]8 i! v( g% Z
MMPR { set feed $f_pr }; i- `9 Q$ `; }3 {
DPM { set feed [PB_CMD_FEEDRATE_DPM] }
% n5 ~8 l) O; l; B9 W' D! _% l A FRN -0 B" `) `* q" O( L& H% g* [, ]3 i
INVERSE { set feed [PB_CMD_FEEDRATE_NUMBER] }6 W5 g0 k, }2 m- y. W
default { set mom_warning_info "INVALID FEED RATE MODE" ; MOM_catch_warning ; return }* Q; {6 h/ n' ]' ?! y
}+ w5 R" n% K2 T' K) l
' [5 N/ M6 j& j. @! _* r/ D% D, r! X2 L
# Post Builder provided format for the current mode:9 ^$ m4 }3 E1 f% Z3 {
if [info exists mom_sys_feed_param(${feed_mode},format)] {
; S) N+ n6 e9 s* @ MOM_set_address_format F $mom_sys_feed_param(${feed_mode},format)1 s, a$ D/ @& f& q+ J9 _
} else {& w! q+ v' f* {% J4 D& @- C
switch $feed_mode {
, G) y3 ^% c p5 a IPM -
( U( V0 h+ q6 n1 W MMPM -, B$ m3 k n. j3 N4 R2 H
IPR -
. W3 D/ L6 ?# n4 ~ MMPR -- W$ S, X- Y, c* i
DPM -
* @* P0 |; S% l0 z FRN { MOM_set_address_format F Feed_${feed_mode} }8 w* }8 T, x$ I4 R3 s6 ~
INVERSE { MOM_set_address_format F Feed_INV }3 k- w( e+ U$ h/ ?
}
5 C9 F" J/ `* i, d& L7 _) c* |3 J }
. S3 \! [4 ?) K# Q) T5 D4 @* a+ g4 e; A2 K( n* B, N' {4 c( u
# Commentary output* V+ t4 A7 m) g1 N
set com_feed_rate $f_pm
, D3 j& {5 V( W5 n/ k! C7 a ]* v
! s: q' g& D9 x8 {# Execute user's commnad, if any.
( q7 j ]* r" {3 S if [llength [info commands "PB_CMD_FEEDRATE_SET"]] {9 P! L5 O1 z* w y" d3 g! s+ Q
PB_CMD_FEEDRATE_SET* P! h# Y6 s1 m& q8 v
}* w( z v* S) t$ _6 ], m0 D+ m
}+ a2 } G5 ^0 f6 |, @
D: \5 D. @, _0 C+ a! `0 |# I) N7 y7 ~1 G. |1 e
#=============================================================0 O0 a9 ]9 I9 N0 z% H$ q
proc PB_CMD_kin_init_mill_turn { } {7 V& v9 @+ Z- v
#=============================================================( [" X4 ^5 M6 B4 ]5 x% \0 s' T
}
1 ^' B, g( E9 t! C" w) D) P$ O5 s6 t
" ?, i9 @; |/ l/ r/ k& q/ S#=============================================================* r- G6 p6 M5 X; O; G/ y
proc PB_CMD_kin_init_mill_xzc { } {
. G* }! u, z! G; k# ^#=============================================================0 }- o* D: ^1 `# u( K
}3 |# E! O# n6 V, H+ p
# T4 i7 q" k7 m
4 i6 W- a+ N3 d- z, f2 Q a
#=============================================================. r* V! e% N& z' T; `- |2 a# ]
proc PB_CMD_kin_init_rotary { } {
) U+ V9 {- C( d6 _6 |0 ^#============================================================= m0 X8 B9 j: p7 c1 C
}
# B9 d$ S( @. B- Z+ K. k) N1 Q) D! }' t0 F7 M! d
5 n& p0 v0 }3 Y" T' \* t9 @#=============================================================
* |7 S: v% e" j* Cproc PB_CMD_kin_linearize_motion { } {1 b5 o6 L: B7 `- O
#=============================================================: D6 D* x6 N5 ?5 f% R0 N8 `4 k& }
}" K1 f, [. ]- R! M* n3 u
% @6 @' |* r# g d$ h
/ V+ N: X$ g) M% L" D. m#=============================================================
: M C% E! z! H+ G0 Fproc PB_CMD_kin_mill_turn_initialize { } {
2 w9 z3 V3 l: ?1 ]. k: ~#=============================================================
$ L+ b+ X% I$ k}, G& L0 T. Q* b% Y% Z
: B7 Q$ h, l( j
1 X! v' J5 K3 }$ y. \
#=============================================================) n. {/ F e5 W$ l- z( p
proc PB_CMD_kin_mill_xzc_init { } {
* I; b' z4 h* f2 j5 G#=============================================================1 w3 K x& o( N3 F7 Q. ?
}
; Y. a+ G7 y9 X' j3 D3 A" T2 X1 s* i, \
& Q+ U- K6 {8 e" a- v+ }+ e( j! t#=============================================================
; l9 H8 y' {( J# ~" E# g7 }+ Lproc PB_CMD_kin_set_csys { } {
& m( `; _; |- v" V( @6 O; i2 y#=============================================================$ ^. o4 K9 m2 d
if [llength [info commands PB_CMD_set_csys] ] {& i v- ~( Q" O: _6 u+ H
PB_CMD_set_csys( e1 f, H& S( R: ]/ }
}$ n, q4 x% s" X4 f" G
}
, z$ z& ?# g9 l' E
, g* _9 X& C, S/ N1 _
7 b8 a q- t9 K8 `2 V#=============================================================
) O* J! D. r% l& k5 Pproc PB_CMD_kin_start_of_path { } {
7 ?6 z" d1 s! c2 W. t#=============================================================
/ i/ h: x8 @$ u6 o7 j9 k% [# Y## k1 V/ g( t& P' l' \) \
# This procedure is executed at the start of every operation.- t. f% `, L( S& h3 W
# It will check to see if a new head (post) was loaded and 0 }& ~3 @/ b+ t
# will then initialize any functionality specific to that post.; C/ X/ q4 @" H, q: g- L5 X9 @
#
6 `3 M& t" A4 X2 @# It will also restore the initial Start of Program or End' U* k" ]: D4 s7 `. S; g& b
# of program event procedures.
& [7 `6 W' K \# _#5 \ A( r0 J- n! m5 V
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING.
9 [2 Q. i) m% O; ]2 ]8 U# DO NOT CALL THIS PROCEDURE FROM ANY OTHER CUSTOM COMMAND.
4 r, f7 @- `4 O+ H3 @## q5 ?' ]8 W) d! P: G- q
global mom_sys_head_change_init_program
5 M$ e& ?0 m: j+ @. E5 D+ u! |5 [/ H `0 [6 i- l. }
if [info exists mom_sys_head_change_init_program] {4 l, T7 W# ^( P8 m8 _3 o
* ^9 z/ v; h7 P+ q# @
PB_CMD_kin_start_of_program
* N2 u4 |$ g& K- e6 I4 ~6 L$ w unset mom_sys_head_change_init_program
: H* Q, p, l1 M
/ v$ Q7 [; s$ u, T% l% ?- E3 E # Restore master start & end of program handlers+ j1 L9 v1 {3 @( A! y7 X3 b
if [llength [info commands "MOM_start_of_program_save"]] {
, j3 Q7 b2 o0 }# K if [llength [info commands "MOM_start_of_program"]] {, A8 p4 x5 W/ b$ Z
rename MOM_start_of_program ""
1 O* b+ }* G% T- p3 L }
- I+ Z. M3 w% o rename MOM_start_of_program_save MOM_start_of_program
. u4 f, y+ q5 Z5 u }
; V( N/ m- }& ?3 p. M/ ~: { if [llength [info commands "MOM_end_of_program_save"]] {
1 H9 w. ^4 U. b9 B3 G if [llength [info commands "MOM_end_of_program"]] {) ^0 J* _6 e* T2 I! W
rename MOM_end_of_program """ b8 J; F, }' [( _3 {/ g( N/ Y
}
( i; w" p" ~$ m& R rename MOM_end_of_program_save MOM_end_of_program 0 K; B4 X0 r* ~) r8 }
}
* k& H; @5 R- |, q$ W K& `- r! ]: a$ y0 K( h. ]' W
# Restore master head change event handler
( E. L v4 I3 I1 g if [llength [info commands "MOM_head_save"]] {
4 E$ `7 R! ^: B6 L4 L/ q2 D if [llength [info commands "MOM_head"]] {
. s1 v8 C9 Z+ N/ U- H. r rename MOM_head ""
& @! r p6 I" w# C" B( }) y }5 ?) U$ m! N9 m$ _" j
rename MOM_head_save MOM_head
8 q2 N" u3 O) e+ {# r: H1 m }
$ Q U$ ~1 w& \6 p& s6 ~) R8 H }
4 |7 W8 b7 |9 E' J& m}
J" e8 v- r' ?( |! a6 u+ M7 G s; H7 Y: \* ]
/ f/ } p. Q9 o7 N3 D* i
#=============================================================3 M# a8 w7 p9 p6 H+ d
proc PB_CMD_kin_start_of_program { } {6 ?" X5 U4 }/ v" i# N; K
#=============================================================
8 e1 ^+ G! I) V7 J2 s+ u$ i#. J1 T3 r4 N6 ^5 v$ K" L) @- F
# This procedure will execute the following custom commands for
3 @1 Z9 ~1 P5 G9 W# initialization. They will be executed once at the start of
/ R9 ^: T3 H& Y+ `2 D# program and again each time they are loaded as a linked post.
& }2 _1 u' p& R( x2 v1 n# After execution they will be deleted so that they are not
; B7 L, U6 F9 n- g# S# present when a different post is loaded. You may add a call
# z# V2 G2 ?4 {) q4 p: a# to a procedure that you want executed when a linked post is r' R' k* K( u) C
# loaded.
( T9 C: C6 l1 u5 H9 a/ @# L6 Z#! W+ J% L- m# E( s3 }, q1 `
# Note that when a linked post is called in, the Start of Program
- O( [- |4 W" I# event marker is not executed again, only this procedure.1 i5 U. K; S- m. [6 E; x6 a
#% S! e4 n5 S' v, x, r0 F
# DO NOT REMOVE ANY LINES FROM THIS PROCEDURE UNLESS YOU KNOW$ s- j3 M! P. m' _: O
# WHAT YOU ARE DOING. DO NOT CALL THIS PROCEDURE FROM ANY
% F7 J; A( y3 C# OTHER CUSTOM COMMAND.5 x R+ H' T/ G6 D' `
#9 O K/ h7 }5 |' d- W" e5 U
$ Q" @& V+ o0 G* b1 Z
global mom_kin_machine_type8 r. X. x5 B0 i3 H' I4 r
, F2 G- k+ ` ]" F+ [
set command_list
( L, U6 D( n9 o- k) Z& j I# D& m0 n! }
if [info exists mom_kin_machine_type] {
0 r% n0 P- p* l5 [ if { ![string match "*3_axis_mill*" $mom_kin_machine_type] && ![string match "*lathe*" $mom_kin_machine_type] } {
# d/ h5 s( Y0 d) s" S( e9 J# H( K5 v- b- h3 Y6 R
lappend command_list PB_CMD_kin_init_rotary
5 _/ r2 c' p) Z& @2 G& H }& o& x' k" q% ]' C6 V$ l/ a4 z
}2 D4 S& o. U4 j1 c
; }( T$ V6 J i lappend command_list PB_CMD_init_auto_retract
* b, C% X3 a& c" \ lappend command_list PB_CMD_initialize_parallel_zw_mode
D8 C3 B* R" Y; @& z' x1 w i O9 _ lappend command_list PB_CMD_init_parallel_zw_mode- d0 u- y$ ~$ ]/ ]5 i+ y
lappend command_list PB_CMD_initialize_tool_list
" C( L, b9 B# [" V lappend command_list PB_CMD_init_tool_list7 F, h4 a0 B( V F6 R% Q# q
lappend command_list PB_CMD_init_tape_break$ K4 h# A& [" h
lappend command_list PB_CMD_initialize_spindle_axis
- B0 @3 C9 X* e1 P& r lappend command_list PB_CMD_init_spindle_axis
4 }0 L& Y- f' r: t1 z0 D, G# q lappend command_list PB_CMD_initialize_helix6 `/ H1 ^$ w" a8 a4 ?6 f/ \6 d' u% N
lappend command_list PB_CMD_init_helix3 i! Z( z) {3 ^& I L4 |
lappend command_list PB_CMD_pq_cutcom_initialize
6 j2 U8 `; Q( v" C* P- g lappend command_list PB_CMD_init_pq_cutcom5 h6 u& w! p# w5 n* q& u8 J) x2 k( `
3 p; B. a1 ^6 \( V7 `$ v- X
if [info exists mom_kin_machine_type] {& @8 w6 z4 t' w6 f8 P' t
if { [string match "*3_axis_mill_turn*" $mom_kin_machine_type] } {
% U/ S7 u# n7 u3 W/ P) q
3 S& ?" V2 v% t* L f; M$ } lappend command_list PB_CMD_kin_init_mill_xzc% A# n* z7 {. R t
lappend command_list PB_CMD_kin_mill_xzc_init
' D0 t3 F( o w. V' E3 ^" r lappend command_list PB_CMD_kin_init_mill_turn; U |/ d- L& Z; v% P
lappend command_list PB_CMD_kin_mill_turn_initialize
2 d1 |' \1 @& t. e; X( d }: {( n! l9 f2 G4 W$ E6 p
}
6 n2 Y8 E% x6 y& ^+ j; {2 l6 E; A. }3 X5 p3 M
foreach cmd $command_list {, m3 D. D& n( [6 D3 ~: x
9 m' x/ f4 \0 }% w" P8 o
if [llength [info commands "$cmd"]] {1 n- w) {8 `" o3 d$ h; M
# Skip execution of commands that exist in v2 mill-turn posts.
4 \# Q; g3 v' t* {8 V switch $cmd {$ C0 O! T" _, a3 i$ e( A
"PB_CMD_kin_mill_xzc_init" -
1 y( w% Y. S# ~+ L4 z2 A6 U' w "PB_CMD_kin_mill_turn_initialize" {}$ y4 x9 X8 o0 `, \) e. X' l& `0 e
default { $cmd }, @0 d0 S& @/ _9 _2 ? }
}! E* L! u, X* r0 f+ w
rename $cmd "") G7 {- \) I7 o& u2 v; o
proc $cmd { args } {} 5 {! \$ Y' ~2 A$ c3 K$ t; R! H! N2 u
}
S3 K$ c) Q2 [! M }
- X- C7 s8 {! V$ _* {}
$ `4 N7 D4 `& p+ z# K6 F% B9 Q/ r
- t8 K1 @+ f$ [7 F. Y6 J& @
( j! |+ w% G$ O0 i5 D#=============================================================3 d7 L; j' R+ T6 X! l
proc PB_CMD_kin_wedm_engage_move { } {
. k0 e4 h! R' X. P9 U: q#=============================================================% D( E& U# F2 u9 Q" D7 J8 e, v
#
4 M2 w3 M0 t" P2 |$ H5 }# This procedure is called automatically in MOM_before_motion
+ `! k9 b$ s- n9 a0 b2 y2 {' A1 {# to handle the Engage move for Wire EDM operations.; E6 K7 z2 d4 m" p
#4 {2 i/ i+ ^4 o( w
global mom_sys_start_of_pass
7 Z6 s" O# c2 H& g+ x' t, w7 ~3 M4 Z. `9 @+ D* e0 Y
if { [info exists mom_sys_start_of_pass] && $mom_sys_start_of_pass } {6 p9 W7 c0 j$ Q* I8 u* |+ O
global mom_lead_in_cutcom_distance% T( D' T$ D7 \ ~6 y& w
global mom_lead_in_method
! c9 n9 B8 J. k6 _( Z global mom_lead_in_cutcom_angle
7 e& Z2 |) ?- ^4 d) T! N if { $mom_lead_in_cutcom_distance == 0 || ($mom_lead_in_cutcom_angle == 0 && $mom_lead_in_method == 1) || $mom_lead_in_method == 0} { $ b6 f2 H! d/ j( p S7 E
PB_lead_in_move7 j: r/ E. b/ X# x2 ]
} else { Y+ A! w3 b7 x% H2 i
PB_cutcom_move; w! T0 v& q5 M, u
}
! c9 K, C5 l1 f/ p: U unset mom_sys_start_of_pass
- j m7 Y! g$ ~- [8 K$ N" `9 z } else {
/ \' N" x8 d1 Z PB_lead_in_move% ~. {' x$ L8 Y/ z
}) W" |- @2 {; C3 e
}
5 K% y8 K9 r' b9 G& g+ @ w+ w3 G. ?) A* @
& o* c; L' S: j: e+ T#=============================================================0 V" A* l z: `+ S' _
proc PB_CMD_linear { } {9 L7 A9 |; d* A- x4 v P
#=============================================================8 j0 c6 h8 R- F' m
global feed_mode mom_feed_rate
$ s0 k: d4 R2 c/ f3 q+ ^global mom_kin_rapid_feed_rate
! V7 \: i, ~6 E& m' m* Eglobal mom_tape_status. @ B) S; V& i, j" S
global suppress_output
% V2 Z7 y2 |) V V6 B; `( U7 E4 f5 |$ mglobal mom_motion_type
! P9 r" m2 R4 |, Cglobal mom_current_motion X2 ]- K* i% M1 U9 }9 p
global mom_pos
/ w3 R' @ s4 W& hglobal momComplex
- }( m. \+ y7 H# Zglobal momConic0 h3 q4 `# G& h7 a9 V" }
+ b; n$ j. v( k0 |" G4 |2 O+ y
if { $feed_mode == "IPM" || $feed_mode == "MMPM" } {
( ?) d5 }) f% U& h0 D& s' }3 ~1 B if { [EQ_is_ge $mom_feed_rate $mom_kin_rapid_feed_rate] } {
( n9 G( s# g% x( b# v MOM_rapid_move' o( |8 |. O1 F6 h: h
return0 M+ ?7 r# N% E. M' G, g
}
# j0 ?+ z2 x; _' {4 s# v}
, ^* J( t8 I: q5 `8 j3 \& }& Q% J2 c) Y. e3 u0 n
if { $mom_tape_status == "ANGLE" } {
' u0 {1 r8 M7 c: S MOM_force Once G_motion X Y 6 N" h9 y2 t" ]0 f: ^ w, |% Z
MOM_do_template linear_move9 j Q# j; v4 Q4 o6 X1 X$ i
return: F' |+ z8 w9 e
} elseif { $mom_tape_status == "CONIC" } {" q7 \. r$ k8 W0 `/ K/ S" ]
MOM_force Once G_motion X Y
$ I3 G4 J& U/ P if { $mom_motion_type != "CUT" } {# f- L1 `0 c7 v# C8 X
set mom_pos(3) 0
0 V/ P" T- P& I' m4 z set mom_pos(4) 0+ R: h$ S! z. A" y# I
} : b1 E+ C) Z2 C! p# [' \" H
MOM_do_template linear_move_conic6 X/ d2 E" l: X7 ~" o
return$ Z, o4 Y* {5 o8 x: c Z, R
} elseif { $mom_tape_status == "COMPLEX" } {
6 X0 |5 C* Z* q) u if [info exists suppress_output] {MOM_abort_event}5 d* z8 r* q! o
if ![info exists momComplex] {& @: `7 d, `/ K I
MOM_force Once G_motion X Y
* N$ n: q ^9 d' {8 O. n& n if { $mom_motion_type == "RETRACT" } {
. h* C9 R( N6 `$ Z set mom_pos(3) 0
$ T( G- M; i6 {$ I) Z set mom_pos(4) 0
: a0 }) K5 X. ?, v% O! j MOM_do_template linear_move_complex* ?' ^, c L% T# Y* Q1 } X
MOM_output_literal "G140"
1 b. U3 S% @" w1 F$ s } else { P, `8 V+ A4 ?* {' I
MOM_do_template linear_move5 I8 h3 }" X8 a, A$ h4 \
}
! V8 C+ Q7 J z' a8 s1 P: S2 v } else {
# @, X" E- o3 t0 ` MOM_force Once G_motion X Y Text G_motion_upper X_upper Y_upper
4 E9 R7 P5 {2 y; h+ j MOM_do_template linear_move_complex
7 o. ^" y" `7 ?4 i6 Q6 p }. s. C( E2 |0 H { D8 N
return1 T; y/ I9 B" n0 A0 v6 c
} elseif { $mom_tape_status == "NONE" } {) P1 r' \2 {! u" J. ] y
MOM_force Once G_motion X Y
' q) |8 q/ V$ c3 T- \ MOM_do_template linear_move! t5 C0 C6 o& y+ v
return
/ k5 a5 [8 ~0 o$ G, a}; @ F2 ?& [2 u" u; G# a G8 y4 X
}
6 f3 D- P9 l; r2 ^6 E0 g+ r3 G+ g8 y4 v2 W
( k7 R- k: B2 a7 B) R: j#=============================================================, [: a# q$ ^ Z7 G7 j
proc PB_CMD_output_tape_per_operation { } {
3 d3 d. C4 d; R- V#=============================================================
% l4 h t6 M z" q" o#
, h4 n' d) c$ ?8 {5 {0 T# This procedure can be used to output an N/C tape with each operation.
( j6 b- G# _' h* c( ^5 Z# Place this custom command at the VERY begining of the Start of Operation
- D9 u# w" \9 g, n7 _. ~ V7 y; g# event marker.
8 p; Y3 o2 ]. Z0 R/ ~+ Q$ }$ F#: o2 P+ Y8 K9 a8 L% ]0 e
# This proc will also delete the initial program tape and rename it to 8 |4 E' V3 t' X5 D2 Z% s- U4 S
# {operation_name}{sequence number}{extension}.
# m5 o- G9 n0 `1 M1 c" q# Any N/C code output with the Program Start sequence will be lost.
* F' D7 B9 d5 H& B#
L9 e# x" I% }% O global ptp_file_name
- X9 `* g( q) J4 o3 m7 g' ]& Q global mom_output_file_directory
/ C }* H0 S, [ global mom_operation_name4 K7 u8 |# u: z$ ]
global mom_output_file_basename8 u. c9 r. t! }9 Q
global mom_sys_output_file_suffix
6 V3 D. V, i; a+ }3 c! m* y' k# s6 R
& a. [ c* U; p7 {#% S% H( Z9 o X
# Remove next two lines of code if you don't want the original nc tape
% ^" h* q3 B3 ?* o) f; e2 N9 @# with the start of program info to be deleted.. Y5 F. ~) l; d/ j& g) o- C
#1 e! \8 Z; r- t% _+ c+ G! A6 n: ?
set fn ${mom_output_file_directory}${mom_output_file_basename}.${mom_sys_output_file_suffix}% r7 ^& A! k& _% `
if [file exists $fn] {MOM_remove_file $fn}
. j. N7 T, U' P. I. w7 a" ^
: a; ?5 v- G# W8 H/ A8 z" j MOM_close_output_file $ptp_file_name4 q& C: z# m k% l$ T& r( }
9 n8 Q8 K0 U4 T k5 ~3 v3 L8 G set ptp_file_name "${mom_output_file_directory}${mom_operation_name}.${mom_sys_output_file_suffix}", P- J/ H4 p2 Q- B m
MOM_remove_file $ptp_file_name
" [6 d# p d9 ]0 F" v6 { MOM_open_output_file $ptp_file_name" B8 L K7 [7 L8 y
}
) j/ a! [2 w& U" |+ Q) N+ P/ s
% _. d5 N& v: \ Q) B$ h% _
8 ^/ X( L0 U6 N! t' A6 V) Q9 y#=============================================================* x/ _$ V" b2 s" F1 U
proc PB_CMD_pause { } {$ R' S; k1 ?9 P' a
#=============================================================
! F3 r9 S; U$ l2 _4 A# This command enables you to pause the UG/Post processing.( B+ }* E- c' L) @, E
#2 T% p; F0 U1 O$ P( R' P7 O7 `
PAUSE9 J+ Y5 }6 J( q
}8 r9 E. q+ g/ g. f8 M0 |
/ A Z* G% {+ G! D
4 ?. g' e# c, O& a4 u$ Y1 C0 v$ {
#=============================================================
: B6 W$ a! b8 J6 J0 G: d+ r& Gproc PB_CMD_start_of_conic { } {
& e! U- W) j- `: R: g7 t! I) V4 `#=============================================================
% O( |5 p; Y" F/ uuplevel #0 {# ]( P9 Y. m5 J6 G" M2 W
set mom_kin_wire_tilt_output_type "COORDINATES"
* X6 n' x/ w+ Q6 }/ ~. _3 s) b! I7 H1 j" R6 u E8 t
MOM_reload_kinematics* W. R* v s; o/ ]
6 w! X8 t2 f. \ R
proc MOM_start_of_conic {} {
* n P* Z9 A( z9 d global mom_upper_arc_direction
, h1 ]7 h: L2 r' _% C T" l/ P/ X global mom_arc_direction1 U5 `3 b: }+ v7 t" o1 R
global suppress_output
4 n6 E' G2 E' F+ g global mom_prev_pos
. y/ m& c$ F; `7 P5 v global mom_conic_motion_type
0 F' U1 z/ ~ Y/ q$ f. y global mom_tape_status
* x; b5 W1 L( E5 N- x- G. X7 z: H; ? i5 _7 Z7 u k
set suppress_output 19 d, M9 s) G3 ~' f% q
if ![info exist mom_upper_arc_direction] {set mom_upper_arc_direction CLW}8 j/ B t3 c9 I
- D( u% M$ {2 E+ c
if { $mom_conic_motion_type == "LINEAR" } {% n# m* z( K' Q5 q$ A$ s
#if { $mom_tape_status != "COMPLEX" } { 6 ~1 I( _3 ~4 j( P8 O, r# k
PB_CMD_linear
, `& X6 |/ S: p) ]# E' t# M- f #} else {4 H& [1 N- c* v, ^" A8 p
# if [info exists suppress_output] {MOM_abort_event}- z l: U( Z' g/ k" R! U. Z
# MOM_do_template linear_move_complex
7 U) @' j7 x3 J4 d) |; s #}
& J7 W+ V' u" ~! V } else { 8 o) M$ I9 u3 H
PB_CMD_circular( O' S$ t! i# I# d1 |( Z3 `
# MOM_do_template circular_move_complex8 m* ?' f! w" q8 Q% D( g
}
2 g4 ~2 Q0 [0 S1 E; k }& ~/ H) O8 x3 d. l. b C3 }' M
3 M; a1 U0 ]- D' X& b( e+ S
proc MOM_end_of_conic {} {
2 O* D9 a4 S, _ global suppress_output) d, Q/ I8 r# Y' j2 ?
if [info exists suppress_output] { unset suppress_output }$ r9 G4 J; S7 [6 ~
}" v+ A& o0 F- Y+ ]( Y
}
9 x& _1 u$ C5 ~3 \' t ^}
% S' R$ S# @+ j7 h+ U, @! N' C& L. ?( O) q
$ B" [: n) q7 V* i3 l! L#=============================================================
8 G7 f7 d& m- \& X) jproc PB_CMD_start_of_file { } {0 {! u" z! i9 A9 h+ T9 s) \# @
#=============================================================
) y) E! @: E; _# K% Iglobal mom_ug_version
# {8 P( h5 n( A7 \9 ]7 a- q8 wglobal mom_event_handler_file_name
( F8 C6 m% [6 ~% c; n) t! Jglobal mom_path_name# [3 q! X/ X9 i* w, U, X! P+ Z
global mom_part_name# L. I4 ]9 G' E$ R
global mom_output_file_basename: p1 Z* }" u4 N% |- P
global mom_output_file_directory
1 B' Z$ }. t3 [/ p, u9 Sglobal mom_output_file_suffix* }( o- c4 z; Q. b! J5 L1 \2 M
global mom_logname7 B; G5 u/ O. f6 r9 v
global mom_date
. P& x8 c4 c" ?3 [global mom_machine_mode
8 c! v: j; N( uglobal mom_power_value
: Z3 Q/ ]0 M2 Zglobal mom_auxfun+ ]; v/ E1 \* F/ l% W
global mom_wire_guides_lower_plane: c, W+ v, P) O o0 E( j) n+ U, i
global mom_wire_guides_upper_plane
) N6 G+ y* O/ I% `9 g5 \2 E$ H4 Jglobal momPathLength0 D4 }1 g' y+ ~' h' g" [
global momPoster
+ ^ _" d8 f: d; ~+ J2 U* yglobal mom_cut_type- i/ n; U6 g; f
global momWorkstation; ^+ e- g3 ?- G0 g4 r) M2 Z
global momLogonDomain/ \6 t! P/ |. T8 M1 R
global momPathNext8 g5 T( Y) u8 [0 q5 }
global mom_kin_machine_type/ U; D" S( g1 k. m: Z; b6 n
global momComplex
: m0 Y# T1 j+ q
) v+ J4 ?0 {: [0 F' x: ~6 ~+ iMOM_set_seq_off* ]+ j# m$ B1 X- N+ d
/ ]+ A' k- W. C2 @" S2 Kset momPathNext 100! ]0 ~) y3 P. v" @' ~4 p" {
MOM_output_literal "( Unigraphics WirePost for Cheewah, Ver 1.1 )"
) F/ h8 I6 U, V9 _7 w& xMOM_output_literal "( Design by Deaton, 2005/09/19. )"
* z* h, {, g4 @, J/ w9 UMOM_output_literal "( Email: deaton@21cn.com, Tel: 13923361400 )"2 g7 s, A# I& P
set momPoster "CMDEATON" _6 w" G, M$ b
set momWorkstation [MOM_ask_env_var ComputerName]
2 J d7 K c* C0 Y4 D$ U( Zset momLogonDomain [MOM_ask_env_var UserDomain]
' o$ X" C% j9 S$ D8 g3 AMOM_output_literal "(================================================================)"( k* g( e+ S( [1 ?# o1 e/ Z
MOM_output_text "( Activate Version: $mom_ug_version )" x h) l }( V9 K( u$ c3 f% v
MOM_output_text "( PostFile: $mom_event_handler_file_name )"5 s& {$ {0 P! L, t3 I6 ?# { q n
MOM_output_literal "(================================================================)"
$ y2 }/ } e4 `9 S1 b; CMOM_output_text " "
8 F) }8 C9 \# iMOM_output_text "( Current Part File: $mom_part_name )"
( t$ e4 _# @5 b. p+ OMOM_output_text "( Toolpath: $mom_path_name )"
' A1 j, k; ]+ @8 [; j5 IMOM_output_text "( NC Output Directory: $mom_output_file_directory )"( L8 g3 s7 ~! z
MOM_output_text "( NC Filename: $mom_output_file_basename.$mom_output_file_suffix )"* f7 e7 J" H3 O3 F/ y; I5 R# K" j! G2 p
MOM_output_text "( DNC Machinical: $mom_machine_mode )"
& G4 H9 Z7 L; ]7 o# iMOM_output_text "( DNC Machine Tool: $mom_kin_machine_type )"
) G( n2 Q; C" E( r6 |' c h1 P) k) u9 X. g- d% u
if [info exists mom_cut_type] {! ~3 X/ E: ]7 E) U0 o" V
switch $mom_cut_type {! \3 ^. Q, s0 A6 X. J
0 { MOM_output_text "( Toolpath method: External Trim )" }* Z, B0 }& I* K! {
1 { MOM_output_text "( Toolpath method: Internal Trim )" }# l$ R! A) a! O2 H
3 { MOM_output_text "( Toolpath method: Open Profile )" }
0 x# q. c% d" J: t3 J* S, h- h& }; e% A }
6 k* i6 J; x+ R2 M# j `7 K}
2 |% s, k% J T# X1 B5 _- t
: E5 a2 r) \4 |( y2 GMOM_output_literal "(================================================================)"! _. Z! v0 I6 y
MOM_output_text " "3 @* E+ S4 w& H$ M8 K1 U b7 G
MOM_output_text "( CAM Workstation: $momWorkstation )"
$ q6 L- e: ?9 p4 U8 q/ u( Y1 c8 `- }MOM_output_text "( NC Programmer: $mom_logname )"* `0 `& q2 Z' N, U8 W6 d3 h1 k& l: H
MOM_output_text "( Logon Domain: $momLogonDomain )"
' D2 e5 _* ^+ o3 z Q. \. N# m I# YMOM_output_text "( Post Date: $mom_date )"/ ~! [5 s8 o( R. K
MOM_output_literal "(================================================================)"
4 f: {& j) z, y" e# FMOM_output_text " "
5 p( k+ f9 q: f6 R/ f3 d; a7 n4 Y
3 b- @. Q8 D6 G% @, I9 R# o5 jMOM_output_literal "(NO = ON OFF IP HP MA SV V SF C WT WS WP WC)"
6 C$ @2 D* M d: v/ A# zMOM_output_literal "C001 = 005 010 017 001 14 05 02 0004 00 000 000 000 000"
- }+ Z s ]3 A2 zMOM_output_literal "C991 = 004 015 017 001 17 06 02 0005 00 000 000 000 000"
# A% T# j; [) i4 {. F6 tMOM_output_literal "C992 = 000 019 017 001 19 05 03 0006 00 000 000 000 000": I. y9 W, O. S; b$ t2 a5 u
MOM_output_literal "C993 = 003 016 017 001 17 03 03 0005 00 000 000 000 000"5 p: n5 r0 ^" O8 H
MOM_output_literal "C997 = 005 010 016 003 12 08 01 2004 00 000 000 000 000"! u3 |- [; O8 R! X% C- ~0 a
MOM_output_literal "C998 = 002 002 015 000 00 04 00 2004 02 000 000 000 000"
( L8 f( r) ?' a* t/ s, x4 O# jMOM_output_literal "C999 = 005 012 016 003 12 05 01 2004 02 000 000 000 000"
7 l! ?+ E+ e- d( aMOM_output_literal "(================================================================)"
1 k3 k. O* D$ D& V; |) q. HMOM_output_text " "
& z; X, _5 j3 y* ]& U5 Z, D4 b
( w `: \3 r7 k: vset momPathLength 0$ ~( B6 G8 j; P8 {" K! {- C5 `
( p/ V6 Q% q ^ ]* X& ~, `9 u0 w
MOM_output_literal "G40 G50 G09 G75"
% ]8 J9 T3 z8 p, H# R& _& IMOM_output_literal "G90 G11 G21"
S3 U, R3 w8 l5 vMOM_output_literal "G958"1 f5 { s% b) e7 L8 r; m
MOM_output_literal "G04 X+2500"" k) F4 F+ J& l) r" R; R$ o) ]
MOM_output_literal "G92 X0 Y0"# L! I9 h5 Y; _, E6 C
MOM_output_literal "G54"
, b8 J7 r% \0 w6 _1 o L$ ?( z1 g% dMOM_output_literal "C890"* m! `* s0 j7 y: L' }: D6 Y& L, v: c
MOM_output_literal "(================================================================)"
; y+ d" P2 S# g5 u" ^5 w3 sMOM_output_text " "
! k, P A" C9 Q" L# W! Q9 L}6 R$ F- Z% ?- Y% Y9 |1 ~. ]9 w7 z6 N
) r& n" X8 g S7 ]
( u/ Y$ B- p2 q! w' W" J
#=============================================================" ^8 N* j4 W7 w% t* R. e
proc PB_CMD_start_of_pass { } {/ I$ N( L& ~( K. a4 x2 E
#=============================================================
9 C) w' p6 }' x. a& l/ b& kglobal mom_wire_guides_lower_gap% K: d& ]2 b! [* K0 R$ x
global mom_wire_guides_upper_gap
1 `4 k5 j7 P- @global mom_wire_guides_lower_plane: \% |7 I- u" i2 W9 o
global mom_wire_guides_upper_plane
6 N# F4 ]# h" A8 R9 k% N7 rglobal momPathNext" t" x, w7 O/ \/ X# P
global mom_tape_status7 c8 w! J- K$ U/ q
global mom_wire_angle_text. E! e) H8 R+ C/ w' a5 @( a" q; g
global mom_flush_pressure
( B2 U" ~- z8 [, I+ kglobal mom_power_value
4 w5 Q& y2 c8 i4 jglobal momWorkstation
2 T% L0 K- G3 ?% {# K; X. _+ G% lglobal momLogonDomain t' I: R+ h! d2 @3 K
global momPoster. p6 l7 V5 [3 c9 ^$ Z. p8 j
global mom_sys_cutcom_code(LEFT) g5 |5 [4 I: o9 s
global mom_sys_cutcom_code(RIGHT)% V' k( w, j: |# I; E5 c0 Y
global mom_sys_cutcom_code(OFF). o% \2 t! A0 y# R- ^
global mom_kin_arc_output_mode
8 m7 X0 s) x3 K' P }5 Oglobal mom_kin_wire_tilt_output_type
+ N5 s2 x+ \& v9 Z$ ^' xglobal mom_wire_cutcom_adjust_register1 H' ?- |& \5 ^7 s8 _/ k
global mom_wire_cutcom_user_register
+ f% V! {' l7 h8 v3 x0 A
" d# Y+ m# V9 o/ x8 Dif { $momWorkstation != $momPoster } {5 J5 ~. {+ I0 K; {* i, s
MOM_abort "Error occurred. No workgroup can be access, Postprocessing has been aborted"* Z" d; L+ R. W
}
' Z$ }# }# o% t2 E4 vif { $momLogonDomain != $momPoster } {
. {/ v8 [% U; j/ N4 O3 R; a$ z MOM_abort "Error occurred. Post server isn't supported, Postprocessing has been aborted"
3 `/ Z) w. E( n! a}5 h% [8 i6 R, U
if { ($momWorkstation != $momPoster) | ($momLogonDomain != $momPoster) } {0 p( V8 ], y+ n! @3 @2 R4 G1 k! |
MOM_abort "Error occurred. Postprocessing has been aborted"
, w% U! [1 k6 S4 z+ |( J}1 J0 ^* D; b# e- I( j5 L% w# E
# G! c; i5 W( a( |8 x7 |, t
MOM_reload_variable mom_wire_guides_lower_plane
9 ^0 c1 J# e0 Y# d" BMOM_reload_variable mom_wire_guides_upper_plane
}$ T# c/ b6 O" J- }" HMOM_reload_variable mom_wire_guides_lower_gap
, r+ {" Y1 [7 N, aMOM_reload_variable mom_wire_guides_upper_gap
; ?0 W" a0 y) ]/ f! W; eMOM_reload_variable mom_tape_status# d: e% G! E' g6 ~3 W2 B0 {
MOM_reload_variable mom_wire_angle_text9 \ G* |, [. d4 L
MOM_reload_variable mom_flush_pressure
2 E" H* o9 n) l1 _ P' o2 aMOM_reload_variable mom_power_value }- R" H- Z* w" t3 u
MOM_reload_variable mom_wire_cutcom_user_register
' w' E q2 K; S0 e6 c0 [
) J3 w( k- v# a! O* P5 b7 ~MOM_output_text " "
. q6 V( I8 E' G. o: x9 ^
6 } M' X8 a) v% e& A7 tif { [info exist mom_tape_status] } { w$ }6 o9 q |* e1 G
switch $mom_tape_status {5 S* J, g8 Z ~. i; |4 `
"NONE" { - V+ ~/ _/ z2 b& W' [2 v
set mom_kin_wire_tilt_output_type "COORDINATES"
1 J6 x# Q$ Z" w+ V9 Y set mom_kin_arc_output_mode "FULL_CIRCLE"
- Y( H+ N+ L' m0 L }) O. ]$ W4 J& n+ F/ m: G
"ANGLE" {+ L+ ^" ~, x# u; e5 R- A7 R
set mom_kin_wire_tilt_output_type "ANGLES" " ^: G" P& h6 O" A B4 l
set momPathNext [expr $mom_wire_guides_upper_plane - $mom_wire_guides_upper_gap]$ u3 ?: o B! z: v$ K r/ p1 q# l
set mom_kin_arc_output_mode "FULL_CIRCLE"
7 _8 Z ~. `9 G# ~1 J: ` MOM_do_template tpset
. H# Y) w% N* |" \, {5 m MOM_do_template tnset& w% B% ~0 P: m0 K- _) A- Z
MOM_output_text " "- R: p) Q- J, p1 @4 c/ R
}2 Q3 g; V3 v7 \% F% ?& a( X
"CONIC" {$ I' u* ^0 O" ?! Q" n
set mom_kin_wire_tilt_output_type "COORDINATES"
+ Q& b5 s; X' ^ set mom_kin_arc_output_mode "LINEAR"- [) @: E: @" E' u
# set mom_kin_arc_output_mode "FULL_CIRCLE"6 Y. z8 q; V6 t& F' ], u7 ?
set momPathNext $mom_wire_guides_upper_plane
4 s5 K1 e4 p% T MOM_do_template tpset0 k6 P3 M* m& a3 q- t2 M5 J
MOM_do_template tnset) ^! b6 y$ G' n0 Q$ Y( m
MOM_do_template tuset7 s- M) F$ f& j4 a1 }& P v) t
MOM_output_text " "* x- S& e! Y4 V H
}
) }/ X9 N5 m; K' |4 X "COMPLEX" {
. [# y0 q; A" \9 N7 J set mom_kin_wire_tilt_output_type "COORDINATES"0 L# q1 m/ C8 } m' x
set mom_kin_arc_output_mode "FULL_CIRCLE"
% i5 k2 `: h8 Y0 f( I2 J) m set momPathNext $mom_wire_guides_upper_plane
3 o* P) A2 {. V& f4 m% ~' e+ A MOM_do_template tpset8 B4 |; b* z% U3 X. `
MOM_do_template tnset+ B+ T8 m' p6 j' ~1 F
MOM_output_text " "
- N- \- j/ r7 e3 o7 f1 c set mom_sys_cutcom_code(LEFT) 141
9 z4 C0 i+ e& g set mom_sys_cutcom_code(RIGHT) 142# y+ g K; R0 e' u% \$ H9 q3 b
set mom_sys_cutcom_code(OFF) 140
, C$ K9 Z1 }& b* u7 t* h }
9 F" j1 D& Q4 B0 K! T6 f }
' i3 u6 g: A; I! X0 _8 \} n1 E6 o S& F+ l6 C3 z# Y
1 g" [1 @6 J2 m/ J, A3 E: U
if { [info exist mom_flush_pressure] } {
. }& k5 W/ O. U% X" j: { if { $mom_flush_pressure == "LOW" } {
. |9 e' v7 h8 g3 P5 D ## Flush off / i% n5 t/ o i" \: s
MOM_output_literal "T89"
! [7 s+ W% l9 a1 N MOM_output_literal "M00"
& _: x# w, @* L3 ~# _% G MOM_output_literal "T85"# m. G* A/ |! A/ w2 m1 ~9 ^) g
} elseif { $mom_flush_pressure == "MEDIUM" } {
, \, z- P$ y) M" t ## Flush Low with tank
4 O: |# X) m8 Y- q- t- C MOM_output_literal "T94"
2 p/ @* }# E9 [( { {2 q MOM_output_literal "T96"
% @* H d& C1 A' i& Y& a MOM_output_literal "M00"
3 l. \% b7 g3 b5 o/ H MOM_output_literal "T85"' x' r! \1 ]/ Z; o! c5 t
} elseif { $mom_flush_pressure == "HIGH" } {; s. _' F; T. `
## Flush Low with tank- H/ m* w$ c7 Q v
MOM_output_literal "T94"7 w# z% h1 [: r# w
MOM_output_literal "T96"
) {" u5 O& B. |+ A) O) ^ MOM_output_literal "M00"
& p- k1 h* y% Z! v3 c0 w0 n MOM_output_literal "T84"
$ ]$ e. w+ E2 A6 ?1 y }
; ^% H; y2 Y6 `4 e# M! F t) a5 i}" T+ H2 ?- _" ` p
/ p' Z% S! r( b# O0 f
MOM_output_text " "9 |5 J3 l4 j* w
MOM_do_template condition
. ^/ g9 P2 p! a$ {' Z. X2 H4 m# {- X
if { [info exist mom_tape_status ]} {$ [0 r/ a& \' l! r& A5 L* K9 e2 L
if { $mom_tape_status == "CONIC" } {* U5 Q. J+ M/ w5 e
MOM_output_literal "G74"9 q6 a1 x- c3 Y, g8 z" l
} elseif { $mom_tape_status == "ANGLE" } { j; e2 _* x2 m$ I0 h
MOM_output_literal "G51 A0"
4 _# \. F: s1 E/ ^ }
6 [+ l/ e1 M+ q* u4 J if { $mom_tape_status != "COMPLEX" } { MOM_output_literal "G41 D000" }& `8 D3 ~( a6 ?' j" ]7 H5 D1 D
}
9 K% \5 K: L/ e; P% `1 C}0 R8 G0 A) G/ p2 R8 O
+ W5 s6 Q$ Z8 |+ |
/ \ i4 m, j5 ~ M4 l, Q#=============================================================
, S" S* E. u/ m; ~; _8 nproc PB_CMD_start_of_program { } {; Y( U4 s, D! V
#=============================================================; j8 g+ R% M' |1 l
global momWorkstation% o/ u! U! c" H( u$ v4 s
global momLogonDomain% M/ h7 U3 W5 Y+ J
global momPoster9 _' q/ U& V8 t' A# K
global mom_wire_guides_lower_plane
# c! a' {$ U5 ^# W+ R0 J+ i: nglobal mom_wire_guides_upper_plane2 g! T- Q t+ Y5 |, k2 r* M$ z
# d. ^9 L r1 k. \9 K$ b* V
if { $momWorkstation != $momPoster } {& P+ `* R/ m) ^
MOM_abort "Error occurred. No workgroup can be access, Postprocessing has been aborted"
" s: x) F- v0 }. R' G* \}
/ f) p9 j8 ^/ Q! v! m V/ f# y5 G( q- ]! r
if { $momLogonDomain != $momPoster } {/ N9 U- B( \8 _4 b1 l+ ?
MOM_abort "Error occurred. Post server isn't supported, Postprocessing has been aborted") `3 F, I$ [4 v% s4 X# I1 Z
}
7 a1 |( N3 |2 `/ o& `! d
+ N4 ]1 u& Q& ~#PB_CMD_start_of_conic) ?7 v5 X, I- i- `) |1 X
* `6 e* F) ?3 G- D
if { ($momWorkstation != $momPoster) | ($momLogonDomain != $momPoster) } {
" n5 _7 n | c4 k9 Z* A MOM_abort "Error occurred. Postprocessing has been aborted"- I# B! f% s( }
}& y9 w6 L" Q' ^$ n
}+ M. b' m6 x, b2 `% {
9 l0 C! c( t9 ~0 J6 v a P
3 _% Q* h0 o- R8 r, H# x% l+ R#=============================================================
8 h2 W' T0 i( kproc PB_CMD_suppress_output { } {
\- p: n2 T& A! X#=============================================================/ I/ f2 V% s1 P8 j
- ?' f: a4 d+ M1 c& `/ C" _
global suppress_output3 y$ w5 U" k! a
6 e- {! T( o! l4 |! N+ i4 R
if [info exists suppress_output] {MOM_abort_event}
* d1 t/ K4 E+ M% M$ q9 u}
$ u" Z) c% s* t/ i7 `0 P# l" B3 k
3 t0 I; [$ l2 o/ A9 ^. V" A* x. f) g( ]
#=============================================================8 j, w5 m$ k2 w9 O
proc PB_CMD_work_coordinate { } {. ~ A: y% S7 y, D. C& `# a% R5 u; O
#============================================================= g c; k/ Q1 I
global mom_work_coordinate_number4 E! u. Z# z; k
+ t- b# w- v9 D# m8 A
MOM_reload_variable mom_work_coordinate_number+ B1 g' a3 M& d2 V0 w7 `
MOM_output_literal "G90 G$mom_work_coordinate_number"
5 P+ X- O9 X8 d9 w% g}
0 h: M ~8 ^ P
6 _* l+ k( J5 `6 g* ^2 X9 C- q) j; d+ X- \
#=============================================================" Q0 e/ y& R. r# m
proc PAUSE { args } {
) w* D* @; }7 o- ~+ j" U( Y#=============================================================
+ P5 ]' e3 z4 @! f. m8 s global env
; e) ]4 G0 P; C$ K7 h8 @$ D; I. o! [1 o. _2 @2 A* i2 }% _
if { [info exists env(PB_SUPPRESS_UGPOST_DEBUG)] && $env(PB_SUPPRESS_UGPOST_DEBUG) == 1 } {
. f+ G! A# A0 y k1 nreturn
6 C# Z8 {: b9 b5 u3 Q7 P2 q }% w$ }; R# v+ t- _' A. q$ u
% c' v/ g7 Y! o1 [4 X* o$ y
/ |# e3 M! ?( F+ l2 B set cam_aux_dir [MOM_ask_env_var UGII_CAM_AUXILIARY_DIR]
, Q& `+ \! [/ ^) E+ \' x6 G) p
' l* E+ y- l1 b5 F( w5 \ global tcl_platform! a! d' o0 x9 r% c0 `) i
% M$ f" m2 P% R% s if [string match "*windows*" $tcl_platform(platform)] {# s# M2 u' L! \9 W5 @
set ug_wish "ugwish.exe"
" I( f% Q" O8 | } else {
; i. F+ m. u7 B set ug_wish ugwish
* }/ o/ e5 S Y, `% Y8 E }
4 I* H+ T7 g3 j$ z3 i( P9 [: V7 E; |( j! F* S, h
if { [file exists ${cam_aux_dir}$ug_wish] && [file exists ${cam_aux_dir}mom_pause.tcl] } {
8 i/ V3 k) C/ b. q: S+ i% e S8 }# s* G( q- n0 l
set title ""5 J6 d! M4 q% Y0 b# ?7 i& Q
set msg "". P: O" ~3 n" f: C, o+ @
: y2 \4 [& S1 N1 r4 N
if { [llength $args] == 1 } {
8 I$ o1 T8 v) p1 e set msg [lindex $args 0]7 ?/ G# c& u) o7 o; _0 R4 W0 A
}& A5 b' v6 n! c: _
; v5 v$ P7 B9 m- t) a if { [llength $args] > 1 } {
8 r& [# y& H0 i: i6 i set title [lindex $args 0]7 M- y+ W* |( p s
set msg [lindex $args 1]
2 F3 }: U% k0 O ^. N/ H }5 F* a# F3 m! W0 [$ W2 p
' q' Q* C0 E+ M3 A
exec ${cam_aux_dir}$ug_wish ${cam_aux_dir}mom_pause.tcl $title $msg
- ?+ X% r( S. e8 H }
, h( n* d+ E N( r5 @}, _- W/ B0 _& C1 r9 e
# U5 h6 n" `2 G# p- t
4 {+ T0 u' l- R5 ]6 M& l! ~9 q
#=============================================================
1 h. Y, V; ~" ]& P7 @proc EQ_is_zero { s } {
# G+ H! q: x6 ?* c1 h% h#=============================================================
5 I+ s$ C8 Q4 w0 m global mom_system_tolerance
7 g# C3 f7 d, A
3 M- u. `. j8 q% w( P* O if [info exists mom_system_tolerance] {( d% a" N* R. s( l
if { [expr abs($s)] <= $mom_system_tolerance } { return 1 } else { return 0 }0 D1 [. K$ U& F2 {$ _0 q, M* l
} else {
* x. D8 D+ h; \6 I+ I7 b, X return 0
0 f! x3 @. M5 Q1 ~9 L }
+ M0 h$ c. s% h( M}7 @$ Q/ l0 G8 R- H8 b: I
+ D0 q3 B+ |% r3 [9 X5 s* C# {) P1 z* o8 v& A
#=============================================================
, S* {$ y, ]4 R+ |+ W! R' a6 n2 B/ v8 Eproc CATCH_WARNING { msg } {2 _" b) x' h4 g+ e( h: T) @% K8 h: Q
#=============================================================2 n. n2 R. X- ? M" t
global mom_warning_info
" D( G( Z; C0 W1 h$ {6 w0 D global mom_motion_event* W/ |0 b* `# t* I& l
global mom_event_number
1 ?& b; r; u6 |/ X) H$ a3 [
# Y5 X' s R/ Y, F- q5 _ set level [info level]1 m/ ~- N' ~% \% ]/ m$ J, n
set call_stack "": C _+ y q3 {) {2 G# u' X
for {set i 1} {$i < $level} {incr i} {4 g, i, x7 N ?
set call_stack "$call_stack\[ [lindex [info level $i] 0] \]"' `/ @9 d3 t ^5 Z3 `
}
7 m0 T. `* ?. e, Y set mom_warning_info "$msg ($mom_motion_event $mom_event_number) $call_stack"
9 p" D5 O5 G/ { MOM_catch_warning6 H6 M0 J& t% i. |1 v. F( O
}7 G7 l, ]) ~3 j1 p6 \
; z' m& p; t9 O
2 x T* Q8 @: B8 R2 y# k2 g) ?% e#=============================================================7 Z2 @( \- U0 z: h
proc WORKPLANE_SET { } {6 N \6 H9 L' t1 p
#=============================================================
) R/ G) ^3 `: S) `" j: D global mom_cycle_spindle_axis& H( j8 k. @0 D: N" T, B! |9 o
global mom_sys_spindle_axis
7 A# k! L0 o$ x global traverse_axis1 traverse_axis2# E y. _8 U( K
& ^: I+ m+ V: c5 C6 G
if { ![info exists mom_sys_spindle_axis] } {/ ]$ W! O1 }0 y! w# u1 a: N
set mom_sys_spindle_axis(0) 0.0
& _, I7 o4 G d6 L+ Z# y set mom_sys_spindle_axis(1) 0.0! i0 N- t/ g9 x. d7 Z: R
set mom_sys_spindle_axis(2) 1.0
. I. I1 r: B9 ~/ z }
/ |0 q4 d* F) _, ^( _. G6 o% k7 T% N1 \) d
if { ![info exists mom_cycle_spindle_axis] } {( h4 w( ~: {* B
set x $mom_sys_spindle_axis(0)! y2 l/ ?7 z. K" ~9 L: v4 `+ p
set y $mom_sys_spindle_axis(1)
6 a9 C3 X Q1 k* R1 M$ y set z $mom_sys_spindle_axis(2)
9 D& ^: f: s: y/ U- y- b) j& G. c5 I9 |( Q8 W- T, N: o7 k7 r/ X
if { [EQ_is_zero $y] && [EQ_is_zero $z] } { p6 Z$ f( Y) L( X; F$ _% _
set mom_cycle_spindle_axis 0
7 T* h# _6 B/ l% b9 G- ~ } elseif { [EQ_is_zero $x] && [EQ_is_zero $z] } {
& d7 y' k0 }) ~* ^% R: X set mom_cycle_spindle_axis 1
& `8 h- ~2 i3 _ } else {8 f4 a3 h! c5 I4 p* |
set mom_cycle_spindle_axis 2
4 f$ R! o7 T3 R$ V }' |" {! G, ~2 R! B- V
}; C) L" ^# n; `. Q0 x) ?* A
: v% v+ f; \/ L2 W& s if { $mom_cycle_spindle_axis == 2 } {
0 D. ?* t" E4 V, }+ p L set traverse_axis1 0 ; set traverse_axis2 1
2 W+ w) l, b8 v! { m4 u: T } elseif { $mom_cycle_spindle_axis == 0 } {
/ k" w- T" u# H9 Q1 l' K6 l set traverse_axis1 1 ; set traverse_axis2 2. R# g$ r; ~1 G8 a" o4 S5 F7 n
} elseif { $mom_cycle_spindle_axis == 1 } {0 p4 w' ?7 |: `- \6 r' N1 }
set traverse_axis1 0 ; set traverse_axis2 2
- ]! L9 d) x+ f4 J, b: q2 e- f+ S }% X7 t( d5 ~0 D. Q
}0 B+ V: o7 ^+ u/ L# z: }/ d
: [5 T& `- M; o* s* {# u+ l, n: ]- C2 e* P
#=============================================================( n8 W; C8 c" r) ~- u& R
proc EQ_is_equal { s t } {. T* F, d' U c# c5 |9 `& W
#=============================================================$ s: q* T. K1 N3 Y" I% `
global mom_system_tolerance% G4 t$ A7 o1 k# h, G% u* J
g2 U8 s7 t( m" W2 o* G if [info exists mom_system_tolerance] {) E9 M. U( t8 i: C; U
if { [expr abs($s - $t)] <= $mom_system_tolerance } { return 1 } else { return 0 }
) f, J. X% K9 g& ~ } else {
+ ]- y* n- M v7 ]: [( X return 03 P, y' R- v( y0 S) ^8 d
}: g8 C+ U |) w9 F6 \2 w
}
- m9 Z5 W5 G% u9 n$ ^4 A+ p, Z2 \/ z* j$ j i; L
& H7 Y5 M5 V$ Z
( U2 I3 J+ t7 p( U' ^; h o+ _% o( p' v( G. \
K4 K6 F6 P; ]& u) u
4 f6 b# f) A/ M& h+ r+ z9 K#============================================================= e1 p5 y. L& e/ u
proc TRACE { } {
# e0 h; j9 T" w! h: r* Q6 A#=============================================================' T; L! S" i4 P- M
set start_idx 1
( g4 ~% v* @6 E! r% ~- b: s E" Y; K: m& M# S
set str """ r+ @. k; h, l, u
set level [info level]
$ Y, N7 a( [" F3 c+ i' H2 x C for {set i $start_idx} {$i < $level} {incr i} {; M6 Q9 t; w: a3 F
set str "${str}[lindex [info level $i] 0]\n"+ @# x$ M i* H, y5 D* ]! i
}) K l' z, E5 e3 \
7 j3 s: L! i( R) \: i- Z2 g
return $str
' Z" k2 V9 \4 X1 s( {}* R' Y0 j; Y3 ]) ]: m
- W& m' r6 s* \7 U: ^2 I7 _% w
6 L# A* J4 h1 ?4 M& B fif [info exists mom_sys_start_of_program_flag] {- p2 r5 _! D0 \# K
if [llength [info commands PB_CMD_kin_start_of_program] ] {4 R) r8 t( X: _, D2 M# j
PB_CMD_kin_start_of_program
2 o9 V6 o. G. f/ M J" ]# S }
: g9 a" ^. X* x! v} else {8 X& m! B1 V5 \+ {1 Q3 n
set mom_sys_head_change_init_program 14 H4 U0 M. ^8 w+ |6 T6 A: x
set mom_sys_start_of_program_flag 1
. f( M0 K( U& y9 l}
|
|