looking for an elegant way to address tool pockets

More
15 Dec 2018 21:50 #122455 by Shu
Machine has an ATC with a magazine rack. Tool pockets are not all in line and do not have the same z height. I do have all positions of the pockets. What would be an elegant way to map the tool change position to the arbitrary pocket location?

My first idea was to have the pocket positions stored in a .hal file like this:
[CHANGE_POSITION_1]
X = 3391
Y = 1084  
Z = -158.7

[CHANGE_POSITION_2]
X = 3391
Y = 980
Z = -158.7

[CHANGE_POSITION_3]
X = 3057
Y = 882.6  
Z = -50.5

And write a atc_rack_change.ngc subroutine remapped to M6 like this:
; #1 is current pocket number
o100 if [EXISTS[#<_ini[change_position_#1]x>]]
  G53 g1 Z0 F30000
  G53 g0 X [#<_ini[change_position_#1]x>]
  G53 g0 Y [#<_ini[change_position_#1]y>]
(...)

Which isn't working as the #1 variable in the change_position_ variable is not parsed. Any better ideas?

I haven't tried putting the #1 in brackets. Will try that.
More
17 Dec 2018 00:47 #122497 by andypugh
How many tools?

You might have to use the unsatisfying
O100 IF [#1 EQ 1]
   G53 G0 X[#<_ini[change_position_1]X>]
   G53 G0 Y[#<_ini[change_position_1]Y>]
O100 ELSEIF [#1 EQ 2]
   G53 G0 X[#<_ini[change_position_2]X>]
   G53 G0 Y[#<_ini[change_position_2]Y>]
O100 ELSEIF....

Which probably isn't _too_ tedious with copy and paste...
The following user(s) said Thank You: Shu
More
17 Dec 2018 19:05 #122531 by Shu
Thanks, Andy. That looks like a solid solution!
Right now the machine has 7 pockets, in the end it will be 35. I might migrate to a bash script for the subroutine to compact it.
Time to create page: 0.065 seconds
Powered by Kunena Forum