PB_CMD_init_helix8 O1 i6 X7 `% W/ a+ d: P
: d, e# s8 s Z2 Q( _6 G9 h g& e) }2 B+ [% T0 l
uplevel #0 {
8 t. P7 ~. ` o) V* y8 u: g1 g/ `#2 W7 k8 D. p r0 D
# This procedure will be executed automatically at the start of program and' i8 ^4 C _. w$ U7 G
# anytime it is loaded as a slave post of a linked post.
6 G) E$ ?: y- a( E#6 H: i5 V4 ?% a( c+ A
# This procedure can be used to enable your post to output helix., _! `' t+ V6 m+ R, \2 Y$ n# `
# You can choose from the following options to format the circle
A2 }# g# |% q4 {; x$ }2 I# block template to output the helix parameters.
7 V. C- Z; F4 U1 Z! _#
& Z) i! _$ \; Q. s7 lset mom_sys_helix_pitch_type "rise_radian"
) Z/ Z0 j, o I8 V2 c, W#
/ f" V) O7 |, y0 e( r# The default setting for mom_sys_helix_pitch_type is "rise_radian".* h: S# g3 _" r) \0 I
# This is the most common. Other choices are:) u4 _; }/ M4 R% b0 S
#
2 ?1 m' A8 Q. \) F# "rise_radian" Measures the rise over one radian.
' _6 y2 ^7 M) d5 A. Z# "rise_revolution" Measures the rise over 360 degrees.
% l: r$ a, R+ s/ n" y# "none" Will suppress the output of pitch.
3 ], A. m, f1 |+ h# "other" Allows you to calculate the pitch* A# I6 D/ p$ U9 X: E" S
# using your own formula.. u: p5 t+ @ `+ J
#
. S9 Z/ n2 M% ^0 h8 C7 p# This custom command uses the block template circular_move to output
: H& H8 B( h+ e. O$ L# the helix block. If your post uses a block template with a different
9 d( q! V+ ?# F1 q7 t# name, you must edit the line that outputs the helix block.0 Z! ]5 b) E3 q1 ~2 T
#6 U' k: g4 ?7 R4 I/ U
# The following variable deines the output mode for helical records.+ r, w6 j* Y3 {% A1 B) @
#5 u+ B; f% v! h L& E* I* h
# FULL_CIRCLE -- This mode will output a helix record for each 360
% L9 V2 h. L) {" F9 J. E8 E) _# degrees of the helix.
- e; h! Y& S/ K0 D# QUADRANT -- This mode will output a helix record for each 90
( |5 [4 t2 t @ n, h/ U# degrees of the helix., f8 T9 C) o* q) [; V
# LINEAR -- This mode will output the entire helix as linear gotos.
2 p; a- L9 x3 u# END_POINT -- This mode will assume the control can define an entire7 S0 k' d' G6 c" I, o( ~- m, L, O# O
# helix in a single block.1 ~+ l' f$ e' r# r
set mom_kin_helical_arc_output_mode FULL_CIRCLE
; b( [. X+ l# i8 J0 ?. d/ P0 Q MOM_reload_kinematics
' T: X) o5 X# \/ g9 `0 a: e7 X4 m9 _& q) V
#=============================================================
* {7 {+ z% R4 vproc MOM_helix_move { } {6 I+ H% r. A) K
#=============================================================$ e1 Z& O# P* u/ N8 q2 o) r
global mom_pos_arc_plane5 v# }! [" v" ?1 r% O
global mom_sys_cir_vector
+ V( v% \. L' m. J) w- g1 C global mom_sys_helix_pitch_type
: C1 }8 Y* v/ k) s global mom_helix_pitch% K$ ^3 o; J3 v4 s2 Y- U. v% K$ t
global mom_prev_pos mom_pos_arc_center, `6 Y8 L0 {7 \; M: \
global PI
" {9 n1 G- E/ e" X switch $mom_pos_arc_plane {$ Y; e8 L7 w0 M" K" o7 f
XY { MOM_suppress once K ; set cir_index 2 }5 B; t9 i$ ?1 U) {( @
YZ { MOM_suppress once I ; set cir_index 0 }
! H- A8 e; {) e' t ZX { MOM_suppress once J ; set cir_index 1 }0 g* r% ^3 w& |1 [% L) z" ^
}
$ X u* F7 [6 G8 A5 e switch $mom_sys_helix_pitch_type {
* { u4 ^* X3 A. u; Y5 d none { }
5 ?# N' t* X9 K" c' y/ s. |- d rise_revolution { set pitch $mom_helix_pitch }
3 [( O A/ X" q% ?! @ rise_radian { set pitch [expr $mom_helix_pitch / ($PI * 2.0)]}( J1 _/ F8 W, e5 b. v$ T
other {# R7 i. U6 S1 A/ C D
#
4 @$ z* F% a9 C: l& n$ L# Place your custom helix pitch code here4 W4 z* Q r U' b
#
6 T1 Y" d4 Y7 i, {8 Z1 A/ C: e }( k& N" x2 s! J2 X
default { set mom_sys_helix_pitch_type "none" }
! N2 B! ?4 C1 @/ t8 ^- i5 P }7 j1 f' [& A5 ]
( n% o3 u6 b/ F MOM_force once X Y Z, A$ L# }5 F4 \0 S
if {$mom_sys_helix_pitch_type != "none"} {, @( n7 n8 q$ D9 n' v# K
MOM_force once I J ; |0 A6 w7 a$ U& _' e
if {$mom_sys_cir_vector == "Vector - Arc Center to Start"} {* g% Q7 [, X1 o/ \. F
set mom_prev_pos($cir_index) 0.0
# ?2 ^) _/ s/ s4 T0 ^3 _5 H- \ set mom_pos_arc_center($cir_index) $pitch& ~ H! i1 h% f, s7 B
} elseif {$mom_sys_cir_vector == "Vector - Arc Start to Center"} {
+ O& o4 @- J; T* c set mom_prev_pos($cir_index) $pitch, J B Q8 a, c, i$ S. g# n& _4 h
set mom_pos_arc_center($cir_index) 0.0
[! q3 g- W. L" r. b u7 U/ y } elseif {$mom_sys_cir_vector == "Unsigned Vector - Arc Center to Start"} {
+ H9 x% o k/ R6 p" Y9 o; _ set mom_prev_pos($cir_index) 0.02 d$ ^( B' }% q4 s8 b- O) F' ~
set mom_pos_arc_center($cir_index) $pitch
4 l2 H) y, t2 ^: v! b& X [ } elseif {$mom_sys_cir_vector == "Absolute Arc Center"} {6 f: j7 {$ m6 k
set mom_pos_arc_center($cir_index) $pitch
. ^. d3 B! K6 O* c8 D: l }
! k$ L7 t+ _! f" \: m }
# J0 D3 O* h Q; H) M2 E4 x
% J5 t" \0 r1 ?2 o' L# a#
7 z4 k" j% J; N% C6 Q4 f! Q# You may need to edit this line if you output more than one block) O3 }; }4 L3 }$ i6 |0 f: t
# or if you have changed the name of your circular_move block template
( Z" M+ m' W* g% [3 ` G#
0 o) Y1 j, c7 x+ J. p6 B% v2 x. a MOM_do_template circular_move
* V- |2 K$ b% J; C' P
/ \3 N, ], D2 n} ;# MOM_helix_move/ k( T/ z/ j7 m1 ]% J; {# |, A
* u% H7 d8 d1 @+ J( ~" Z} ;# uplevel |