On Saturday, February 18, 2012 04:38:19 PM Tomaz T. did opine: > hi all, > I am writing subrutine for automatic tool length measuring, as I have to > change tool manually on my 5 axis ... > > for now I came this far: > > o<tool_probe>sub > > #1002 = #5223 (store G54 Z offset) > > G49 (cancel existing offset if it is any) > > G30 (to probe location) > > G91 (incremental mode) > > G38.2 Z-150 F300 (probe fast) > > G0 Z5 > > G38.2 Z-10 F80 (probe slow) > > #1003 = #5063 (store probe resault) > > #1000 = -[#1001 - [#1003]-[#5223]] (calcutaing tool length ~ #1001 is > previous probed distance without tool) > > #5223 = [#1002-[#1000]] (correction in G54 Z offset) > > G10 L1 P1 W[#1000] (Updating tool table) > > G90 (absolute mode) > > G30 (to safe distance) > > T1 G43 (selecting tool) > > G1 W0 F500 (zeroing W axis for kinematics) > > o<tool_probe>endsub > > > So, with this I get correct tool length in my tool table, but problem I > still have is that when subrutine ends, and for example next line in > code is just going to Z0, machine goes higher for the distance of > measured tool length (G54 Z variable number is correct Z offset > according to new tool length), and if I enter in MDI manually G0 Z0, > then it goes to correct Z height, which is on same location as before > calling subrutine and without any tool compensation. > > For test purpose I was calling subrutine with: > > G0 x0y0z0 > > o<tool_probe>CALL > > G0 x0 y0 Z0 > > M30 > What am I missing or doing wrong?
I hit send too quick, kmail has then too close together. Here is bedautoz.ngc ============ o<bedautoz> sub ( a bottom side only routine to auto compensate tool length ) ( offsets, Copyright Feb, 2012 by Gene Heskett ) ( this code is licensed by the same license as LinuxCNC, ) ( formerly N.I.S.T. and Electronic Machine Control ) ( This program executes the moves to the tool changing position ) ( well above workpiece so you have room to work ) ( This subroutine to be called immediately after the ) ( M06 T# is found in the gcode ) ( Try to put machine in known state. ) ( Since this is a bottom side function, it will use G56 for X comp,) ( the corresponding top side will use G55 for X comp ) ( which it will setup from tholefinder.ngc ) G20 G90 S2600 ( set spindle speed since pcb-gcode does not ) M05 ( stop spindle ) G49 G54 ( cancel any old tool length offsets & use default co-ords ) G01 F10 Z3.00 ( get it out of the way ) G00 X0.3000 Y0.10000 (set to safe spot on your board from where originally HOME'd) ( set height of expected contact ) #1 = -3.00 (below known height of board, assumes machine ) ( is ZHOME'd at about engraving bit contact at start of job) #2 = 0.0015 (trim engraving cut depth HERE! -0.0010 will ) ( raise it one thou, +0.001 will lower it one thou etc ) ( Now probe fast for contact, stopping at #1 with error ) ( if no contact found, broken drill, broken Z drive belt? ) (debug, now sort of fast probe to z=#1 is next ) G38.2 F2 Z#1 ( sets #5063 to contact height ) (move away a tiny bit relative and do slow probe for final value) G01 F1 z[#5063 +0.010 ] G38.2 f.1 z#1 ( which will again stop on contact ) (debug, now setting TLO to z=[#2 + #5063]) G43.1 Z[#2 + #5063] ( install z tool length offset) G00 Z0.4 ( make clearance for long move ) (debug, should move to X0Y0Z.2 after 5 sec pause) G56 G01 F6.2 X0 Y0 Z0.2000 (clear board, slow so it can be stopped if wrong) (debug, waiting 1 secs to see if at RFront corner of board with pattern offset to right this time ) G04 P1 (stop long enough to see if in right place) ( job done, return to caller ) M03 (restart spindle) G04 P1.5 o<bedautoz> endsub ===================== I won't claim that any of this is 100% optimized, but it is working. Feel free to improve it. I can load the .bot.etch file after running the top.etch file, and the old uncleared backtrace in axis from the top run is very well registered in the display, and holes bored half way thru the board, meet in the middle if the board fits the pallet well. Cheers, Gene -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) My web page: <http://coyoteden.dyndns-free.com:85/gene> Windows 98: Not Plug & Play, but Bug & Pay! ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
