Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Flipz01 on June 18, 2009, 04:31:48 PM

Title: Tool Length Offsets
Post by: Flipz01 on June 18, 2009, 04:31:48 PM
An interesting problem.  I have a tool rack with 10 tools.  Each tool has the diameters and lengths entered in typical fashion.  I have boxes for OEMDRO (824) "Current Tool" and OEMDRO (1200) "Tool in the spindle".  I also have a box on the screen that will call a tool change if desired.

Let's say that the tool in the spindle is #6 and OEMDRO (1200) reads "6" as it should.  If I click on the "Current Tool" DRO, type in the number 2 , and hit "enter", then OEMDRO (824) will now read "2" but OEMDRO (1200) will still read "6".  But, having done this, my Z-axis position DRO has now changed to reflect the length on the new tool #2.

Now, if I Close Mach3, restart, and then home the machine, I have a problem.  Normally, I read in the OEMDRO (42) which is the current tool length, and deduct this number from 10".  This sets my Z-axis DRO properly for the tool in the spindle.  But, if the two DROs above "#1200 & #824" are different, then I'm reading the tool length for the tool in box #824 instead of #1200 - which is not right.

I've tried several things.  I've tried reading OEMDRO (1200), resetting OEMDRO (42) so it reads as a match to whatever the tool in the spindle actually is - doesn't work.  I've tried reading OEMDRO (1200), resetting OEMDRO (824) so it reads as a match to OEMDRO (1200) so that OEMDRO (42) reads the right value - doesn't work either.

What happens is, I can get the initial display to read the way it should after homing, but when the next tool is picked, it seems to offset TWICE.  It's as if the first offset is recorded someplace where it is waiting to be executed, and the control does this offset even after I've re-homed the machine.  Anybody know why?  How do I get around this?  And yes, I know this will rarely, if ever, show up, but if I did it somebody else running the machine will do it too.
Title: Re: Tool Length Offsets
Post by: Hood on June 18, 2009, 05:16:51 PM
Does your problem just boil down to the fact someone could type in OEM DRO 824 and you want it read only? Or do you need to be able to change the number in that DRO manually by clicking on it?
Hood

Ah, while I was typing you have edited and now I am confused ;D
Title: Re: Tool Length Offsets
Post by: Flipz01 on June 18, 2009, 06:33:28 PM
I just re-tried something I "thought" I did earlier.  I added lines that read:

Call SetOEMDRO (824, GetOEMDRO (1200))  'This sets the displayed tool length to match the current tool in the spindle
While Is Waiting()
Wend
Call SetDRO (2, 10 - GetOEMDRO (42))  'Our software sets the material surface at 0.00, so we plunge from 10.00" to -2.00".  We offset our tool
                                                         lengths from 10.00".  OEMDRO #42 displays current tool length. 

That reads the tool in the spindle and changes #824 to match.  OEMDRO #42 mimics #824.  Now the tool length is correct, and the original offset is right.

I have no idea why this didn't work earlier, but it seems to work now.  Tried to break it, but it seems perfectly stable!