|
#=============================================================
& x& N5 U& {5 c% }4 y5 d proc PB_CMD_Zmax_Zmin_start_of_program { } {
: v7 s0 _3 r, s2 ]2 u #=============================================================# c. ]& w s0 C3 n
#
6 A+ J. j/ K+ j0 ~( `1 g* G1 W # This custom command may be used to check for the maximum
; e& k* P" S* Q- L- K/ l # travel for each axis. A warning will be output for each
+ `4 Q' L1 U; X # GOTO that exceeds the limits. It does not check for
% [* u3 g% Y8 B( w* r # parallel axis such as Z and W. It does not account for. { c3 }: v8 F8 {4 Q
# any modifications done by the user to mom_pos before the
; w; K7 Z: x4 e3 {$ g) I # coordinates are output.
0 w0 {8 n! D2 m5 ?9 w" c9 y2 S& Y) X #; H1 k, ]4 n, ?) j5 w
#
- E! V% Z! d. I, O+ K+ `1 ~; j # Import and call this command in PB_CMD_before_motion./ W/ [ R6 X7 u' K
#
6 \" w0 t+ W7 j$ Q #
; k& _; n0 E& F1 v, C global mom_sys_max_travel
- w# [( f+ N( E5 N& [. l global mom_sys_min_travel
, I/ |0 O' L. A9 U2 E( { global mom_kin_x_axis_limit
* F4 [9 b- ~. [* ]. h% f global mom_kin_y_axis_limit3 z, Y' P) k& }% r/ C* y- N ]3 q4 i
global mom_kin_z_axis_limit. M: m3 g# U/ N; r2 C9 X( p$ I
global mom_pos
! u2 t- M9 p2 j& k4 P" A- M4 O6 E global mom_cycle_rapid_to_pos% K1 t3 y" d2 b, ?& V& [! \+ m
global mom_cycle_feed_to_pos
8 F4 W% Y. I: i/ W: W- X global mom_cycle_retract_to_pos9 V4 {: f, l5 s- G
global mom_motion_type
: n# r, m/ y5 F0 W- T3 M$ g global mom_warning_info0 |2 \. ~+ z' S1 t5 f; p
' T3 ? L! d( s, a. T
if {![info exists mom_sys_max_travel]} {& J( U" H. U& O( N0 W
0 q( P- `/ ?8 Q- b8 a2 n9 H
for {set i 0} {$i < 3} {incr i} {
. U2 }6 R; t8 b, V* z6 j8 X( w6 S% G( X) ^) [
set mom_sys_max_travel($i) $mom_pos($i)0 n, v0 I A5 H! f5 M! j" A0 {9 j
set mom_sys_min_travel($i) $mom_pos($i)
# {7 O' {+ ?& e: S }
/ N" l5 s+ r1 h+ O- j, b8 e/ d. z7 J- h; r; L2 ~5 H
} elseif { ![string compare "CYCLE" $mom_motion_type] } {) [- M* x' M$ @' A- W" }. q' ~' u# {
+ k/ m) w8 \% d6 V) m
for {set i 0} {$i < 3} {incr i} {. w: r8 w# G$ n8 p/ d% ]
. a+ N- N8 M* s% i+ [# H2 u if {$mom_cycle_rapid_to_pos($i) < $mom_sys_min_travel($i)} {
, ]: V. D0 \+ n5 V' W; T set mom_sys_min_travel($i) $mom_cycle_rapid_to_pos($i)( r' t% H% S+ d; d1 u b
}8 y6 O; k/ m% v* G0 Y& n. }2 T) X
if {$mom_cycle_rapid_to_pos($i) > $mom_sys_max_travel($i)} {+ M1 a4 J* I( z+ T* x; o. @% G7 [
set mom_sys_max_travel($i) $mom_cycle_rapid_to_pos($i)
7 b: }/ ~: F1 r5 _ }
- |0 x$ j4 u1 E. l: D if {$mom_cycle_feed_to_pos($i) < $mom_sys_min_travel($i)} {
1 _3 P l7 A# d/ D7 k set mom_sys_min_travel($i) $mom_cycle_feed_to_pos($i)0 Y- R3 F) Y. g
}
: n- O1 b) e0 M! f/ W if {$mom_cycle_feed_to_pos($i) > $mom_sys_max_travel($i)} {
6 X7 S8 b% U @1 V$ c% Y4 B set mom_sys_max_travel($i) $mom_cycle_feed_to_pos($i)
& [, z! u! ]* @! W, | }3 O/ [) L% b2 r6 l9 }
if {$mom_cycle_retract_to_pos($i) < $mom_sys_min_travel($i)} {( a0 u% y* L; |, b7 G* g
set mom_sys_min_travel($i) $mom_cycle_retract_to_pos($i)' @- w8 ?5 a$ W( q; C
}
/ \7 f) g- c% I) [0 f1 `$ s7 M- d8 \ if {$mom_cycle_retract_to_pos($i) > $mom_sys_max_travel($i)} {9 h$ m8 v4 z8 F, S% p
set mom_sys_max_travel($i) $mom_cycle_retract_to_pos($i)$ Q+ A+ U6 B& B7 [, j
}; Q2 v+ h& G [2 M. I
}
! B0 _* `& y* e' W' K% [( ]# U( F' }$ V3 m0 j% N
} else {% P. t' ]6 C7 e" H+ {1 E8 c
( K' F% W E4 L% j0 o& M+ y
for {set i 0} {$i < 3} {incr i} {
6 l) ^- A" ?! f8 ]* }) ~ if {$mom_pos($i) < $mom_sys_min_travel($i)} {* C5 [! K% t' N* r
set mom_sys_min_travel($i) $mom_pos($i)9 n7 K2 F1 p4 U- e5 m" L
}
! m+ |. n8 `/ E# F; y if {$mom_pos($i) > $mom_sys_max_travel($i)} {5 w: D. E, r) a% y
set mom_sys_max_travel($i) $mom_pos($i)
. R- h* G. [3 w: U }- J" ?: X( h* f: E6 M' G4 [0 F3 |
}
7 W( N1 `+ `" v }( G/ U: K) c( @ Y: j/ Z; k
! q, ~) D8 A% l I& Y x
if {[expr $mom_sys_max_travel(0) - $mom_sys_min_travel(0)] > $mom_kin_x_axis_limit} {6 k0 E6 X# Q, }, M
set mom_warning_info "Maximum X axis travel exceeded, did not alter output"
8 S3 \ f5 b! R+ ~+ b MOM_catch_warning
& V* V" i/ _. \* [9 H! K6 u: F& y }+ E6 b; a3 `: l8 r( O
9 u+ s H6 L. s6 _& ^2 I0 k
if {[expr $mom_sys_max_travel(1) - $mom_sys_min_travel(1)] > $mom_kin_y_axis_limit} {* o8 R# C- v+ K8 g5 p$ e8 }6 h
set mom_warning_info "Maximum Y axis travel exceeded, did not alter output"
# s) ^& ~ D2 ?/ Y. o V* a5 | MOM_catch_warning. y1 U+ a1 a9 ~" v8 r
}& |5 k8 y4 ^5 Z! C T, x8 j G
) R& g( i/ E( q' p. i6 Q if {[expr $mom_sys_max_travel(2) - $mom_sys_min_travel(2)] > $mom_kin_z_axis_limit} {
, M$ J( B+ Q6 D2 B) R) L set mom_warning_info "Maximum Z axis travel exceeded, did not alter output") e+ y) I+ m. D
MOM_catch_warning
! k# ^6 _: {' C }+ S2 D3 M. w0 O5 k3 G
}) }1 V5 J) l$ {. h8 I" g
- F& J# o1 P( Q' n1 o7 s
* c, j1 _* \% L
|
|