On 3/7/24 12:12, andy pugh wrote:
On Thu, 7 Mar 2024 at 16:44, gene heskett <ghesk...@shentel.net> wrote:

o<get_hole>

It needs to be

o<get_hole> CALL

What line Andy, call is there in line 160 of the main do/while loop,
you've got week old code i think as I've posted two versions.

That was from the version you posted 1 hour ago.

I can only work with what you provide.
See line 163 of this file. I do recall adding the call to that line, a week ago. This one should have a 10 something am date today


Cheers, Gene Heskett, CET.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
( linear_bearings.ngc, copyright 25 Feb 2024 by Maurice E Heskett, CET )
#<_measure>=1.00000000 ( zero to drill after changing fr probe to 3mm cutter )
#<_hole_spc> = 60.00000000 ( nominal space beteen holes drilled )
#<_xy_spd>      = 15
#<_z_spd>       = 25
( first find starting x y z )
G17 G21 G40 G49 G54 G80 G90 G94 ( setup to use xy arcs, metric, )
( cancel diameter comp,cancel length off set, G54 coordinates system 1, )
( cancel any canned cycles, absolute distances, feed per minute mode )
( setup contact to ground to bearing, put probe in spindle with probe wire )

( NOTE Andy Pugh says this is a valid way to address an array: #[100 + #3] )
( but he didn't mention that debug was broken, so if we want to use it )
( to a global var, we must first copy the #<_gvar> = #[basenum+#50] )
( rather cumbersome proceedure )
(pre-alloocate the bounce vars for floats)
o<init_arrays> sub
(allocate vars)
#<_zx> = 0.00000000 (for z stuffs)
#<_zy> = 0.00000000 (for z stuffs)
#<_zz> = 0.00000000 (for z stuffs)
#<_xyx> = 0.00000000 (for hole stuff)
#<_xyy> = 0.00000000 (for hole stuff)
#<_xyz> = 0.00000000 (for hole stuff)
(so first, lets see if it actually works )
#50=0 ( set index to zeroth element )
#[200+#50] =  4         ( zeroth x location for z_check )
#[210+#50] =  1.117     ( zeroth y location for z_check )
#[220+#50] =  -66 ( zeroth height to begin  z search )
#[230+#50] =  9.5 ( zeroth hole xy x location )
#[240+#50] =  1.117 (zeroth holes xy y location )
#[250+#50] =  [-1.75 + #[220+#50]] ( to see if math works)
(debug, init_arrays done)
o<init_arrays> endsub

o<get_hole> sub
( now, copy all that to global vars )
#<_zx> = #[200+#50] (z_check x)
#<_zy> = #[210+#50] (z_check y)
#<_zz> = #[220+#50] (z_check z)
#<_xyx> = #[230+#50] (hole_check x)
#<_xyy> = #[240+#50] (hole_check y)
#<_xyz> = #[250+#50] (hole_check z)
o<get_hole> endsub

o<show_args> sub
(now the acid test, did it work?)
(debug,lb 48 holenum=#50)
(debug,lb 49 zx=#<_zx> #<_zy> #<_zz>)
(debug,lb 50 xyx=#<_xyx> #<_xyy> #<_xyz>)
(debug,lb 51 #100  #101  #102) 
o<show_args> endsub 

o<store_hole> sub
( uses hole arrays 230-240-250 but update all for this hole ) 
#[230+#50] = #100 (metric x return from hole_finder)
#[240+#50] = #101 (metric y return from tholefinder)
#[250+#50] = #102 (metric z return from latest g38.2 z-70)
o<store_hole> endsub

o<next_hole> sub
#51                     =       [#50+1] ( make 51 into next member of array )
#[210+#51]      =       #101 (propagate current z_c Y)
#[220+#51]      =       #102 (propagate current z_c Z)
#[230+#51]      =       [#100 + #<_hole_spc>] (add hole_spc to x for next hole)
#[200+#51]      =       [#[200+#50] + #<_hole_spc>] (increment z c x spot too)
#[240+#51]      =       #101 ( propagate found y to next hole)
#[250+#51]      =       #102 ( propagate found z to next hole)
o<next_hole> endsub

o<z_check> sub
(debug,lb zc 72 in z check)
s1000 (set spindle rpms)
(debug,zc 74 spindle speed set 1000)
G1 F1500 z-50 (lift tp clear traveler)
G1 f1500 x#<_zx> y#<_xyy> (goto location of z check)
G1 F1500 z[#<_zz> +1] (should be a mm above rail)
M4 (start spindle, backwards)
G4 P.3 (give move time to complete)
G38.2 F15 z-70 ( locate top of rail for 1st time)
#102 = #5063 ( save real z in mm)
(debug,lb zc 82 Z=102=#102)
M5 (stop spindle)
o<z_check> endsub

o<hole_check> sub
(debug,lb hc 87)
G1 f1500 z-50  (clear traveler )
G1 f1500 x#<_xyx> y#<_xyy> (position over next hole) 
G1 f1500 z[#102 -1] (#102 has ben set, should place into hole counterbore)
o<hole_check> endsub

( call hole_finder in main loop)

o<hole_check2> sub
(debug,lb hc 94)
G1 f1500 z-50  (clear traveler )
G1 f1500 x#100 y#101 (re-position over this hole using found values) 
G1 f1500 z[#102 -4] (#102 has ben set, should place into small hole)
(ready for 2nd call to hole_finder)
o<hole_check2> endsub

o<show_hole> sub
G1 f1500 z-50
G1 f1500 x#<_xyx> y#<_xyy>
G1 f1500 z[#<_xyz> +15] (should place above hole)
M4
G4 P10 (pause for inspection)
M5
o<show_hole> endsub

o<hole_finder> sub
(no z motion now)
(debug,HF 113 s/b just into current hole)
M4 (start spindle in reverse)
G4 p.25
G38.2 F#<_xy_spd> X[#<_xyx>-10] (find left side)
G1 F1500 X#<_xyx> Y#<_xyy> (recenter)
#110=#5061 (record it)
G4 p.25
G38.2 F#<_xy_spd> X[#<_xyx>+10] (find right side)
G1 F1500 X#<_xyx> Y#<_xyy> (recenter current hole)
#111=#5061 (record it)
g4 p.25
G38.2 F#<_xy_spd> Y[#<_xyy>+10] (find back side)
G1 F1500 X#<_xyx> Y#<_xyy> (recenter current hole)
#112=#5062 (record back side)
G4 p.25
G38.2 F#<_xy_spd> Y[#<_xyy>-10] (find front side)
G1 F1500 X#<_xyx> Y#<_xyy> (recenter current hole)
#113 = #5062 (record front y)
(calc centers)
#105 = [[#110+#111]/2.000000] (#105 is now center x)
#106 = [[#112+#113]/2.000000] (#106 is now center y)
#100 = #105
#101 = #106
(debug,lb hf 136 x=#100 Y=#101)
G1 F1500 x#100 y#101 (put in center, clear)
g4 p10 (pause for inspection)
(lets see if this is accurate enough to work for a 2nd pass deeper )
o<hole_finder> endsub

o<fixx> sub
#49=[#50-1]
o15 if [#49 ge 0]
(sub found from prev hole+hole_spc)
#125 = [#100 - [#[230+#49]+#<_hole_spc>]]
(check math)
(debug,fixx 148 space error=#125)
#<_hole_spc> = [#<_hole_spc> + #125/2]
(debug,fixx 150 new spc=#<_hole_spc>)
o15 endif
o<fixx> endsub

#50=0 (to start either loop below)
o<init_arrays> call (sets first element of each)
(debug,lb 156 index=#50)

o5 if [#<_measure> gt 0]

o1 do ( do while to find holes loop )
(MAIN LOOP)
o<get_hole> call (inits for both z and xy)
o<show_args> call (shows args for this hole)
o<z_check> call (finds a fresh z)
(debug,lb main 165 z_c done 102=#102)
o<hole_check> call (positions for hole_finder)
o<hole_finder> call (precisely finds this hole)
o<hole_check2> call (positions deeper in hole to measure hole, not counterbore)
o<hole_finder> call 
(position deep in hole to check screw itself)
(debug,lb main 171 X=100=#100) (metric?)
(debug,lb main 172 Y=101=#101) (metric?)

o17 if[#50 gt 0]
o<fixx> call
o17 endif

o<store_hole> call (stores #100, #101 #102 in current arrays )
o<next_hole> call (sets vars for next hole)
#50=[#50+1] ( make array addresses follow #50 for next pass thru loop )

o1 while[#50 le 7] ( stop short )
( Enf of MAIN WHILE LOOP )
o5 endif
o6 if [#<_measure> lt 1]
o7 do
o<get_hole>
o<show_args> (see what its got)
o<show_hole> (move to it)
(put drill hole call here)
#50     = [#50 +1]
o7 while [#50 le 7]
o6 endif
M2
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to