Hello Guest it is March 28, 2024, 05:14:08 AM

Author Topic: Auto tool length with manual tool change  (Read 14577 times)

0 Members and 1 Guest are viewing this topic.

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Auto tool length with manual tool change
« Reply #10 on: April 05, 2016, 09:39:05 PM »
DoSpinStop()
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Auto tool length with manual tool change
« Reply #11 on: April 05, 2016, 09:44:15 PM »
That's what I had and it said script error and that line# it worked before but not tonight exact line... I just wrote it on here without the capitals sorry got frustrated with it tonight... Been a long day... Had to drive 2.5 hours one way to see a doctor for 15 minutes be told everything's good to drive home...  I'm currently recovering for surgery on both feet... That's why I now have the taig mill and sherline lathe both setup inside the main part of the house I'm calling my office... Lol wife is pushing me to stay off my feet as much as I can.

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Auto tool length with manual tool change
« Reply #12 on: April 05, 2016, 10:35:12 PM »
No, you had DoStopSpin.
It's DoSpinStop
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Auto tool length with manual tool change
« Reply #13 on: April 05, 2016, 10:38:31 PM »
wow now I feel stupid... like I said it's been a long day... but I toke that line out and still had problems.
Re: Auto tool length with manual tool change
« Reply #14 on: April 06, 2016, 11:08:28 PM »
ok spending a little time on this tonight and Go figure if you use the DoSpinStop() that code line works great... Thanks again. I think I just spent to much time on it and everything was looking correct even when it was stupid mistakes like that. Thanks again Ger21 for your help on this.

Ok so for today I did make it into 2 different macros one for m6start and one for m6end. Now I started my using the edit macro button and placing the m6start macro in the auto tool zero location making it easy to test. and all I did for it was have it go to the G59p200 x0yoz0  location that worked great...

my m06start macro looks like

Quote
DoSpinStop()
Code "G59P200 X0 Y0 Z0" ' This sets the spindle so you can change the tool
While IsMoving() 'Pauses the code read while machine moves
Wend

Just to get the spindle to a good place to change the tool which is also above the tool setter.

Then I started on the m6end and it looks like the fallowing.
Quote
' This area does not need adjusting
Currentfeed = GetOemDRO(818) ' Gets the current feed rate for return after tool change
CurrentAbsInc = GetOemLed(48) ' Gets current G90/G91 to return it later
CurrentGMode = GetOemDRO(819) ' Gets current G00/G01 to return it later
CurrentTool = GetOeMDRO(824) ' Gets current tool number

' Adjust below to the machine.
' use G59P199 X0 Y0 Z0 at the point where the spindle is just about to trigger the tool setter
' use G59P200 X0 Y0 Z0 at the point you want the Z to travel down from

ZMove = 4.0 'Max allowable Z travel before spindle contacts tool length setter

DoSpinStop()
Code "G59P200 X0 Y0 Z0" ' This sets the spindle so you can change the tool
While IsMoving() 'Pauses the code read while machine moves
Wend

If GetOemLed(825) = 0 Then 'This checks the tool probe before moving forward
Code "G59P200 X0 Y0 Z0"
DoOemButton(1010)
Code "G90 G31 z-" & zmove &"F4" 'Feed rate here for how fast you want z to go down
While IsMoving()
Wend
ZprobePos = GetVar(2002)
Code "G00 Z" &ZprobePos 'place tool at the exact where the tool touched the tool setter
While IsMoving()
Wend
Code "G59P199"
Call SetOemDro(109)'sets the current tool Offset
Sleep 200  'allows time for update
Code "G59P200 X0 Y0 Z0"
While IsMoving()
Wend
Code "This tool's Length is now set"
Code "F" &CurrentFeed
Else
Code "Tool SEtter Error"
End If
If CurrentAbsInc = 0 Then
Code "G91"   
End If
If CurrentGMode = 0 Then
Code "G00"
End If

Still testing because I noticed I had a G00 where I ment G90 seams I missed a lot of little things like that.

Now I have always seen that VB code have capital letters and all do they truly matter for example is dospinstop() the same as DoSpinStop()?
« Last Edit: April 06, 2016, 11:12:55 PM by dracen knights »
Re: Auto tool length with manual tool change
« Reply #15 on: April 06, 2016, 11:35:45 PM »
OK well so far so good it's acting right only issue seam to be I don't have something right because it's not setting the tool length.... But"m getting closer... I found a few more places in the above code that I had to change  but I'll edit it to show the current changes.

NM already to long sense I posted it... Here is the current macro

Quote
' This area does not need adjusting
Currentfeed = GetOemDRO(818) ' Gets the current feed rate for return after tool change
CurrentAbsInc = GetOemLed(48) ' Gets current G90/G91 to return it later
CurrentGMode = GetOemDRO(819) ' Gets current G00/G01 to return it later
CurrentTool = GetOeMDRO(824) ' Gets current tool number
GetZDRO = GetOemDRO(180) 'used to set tool length from this DRO reading

' Adjust below to the machine.
' use G59P199 X0 Y0 Z0 at the point where the spindle is just about to trigger the tool setter
' use G59P200 X0 Y0 Z0 at the point you want the Z to travel down from

ZMove = 4.0 'Max allowable Z travel before spindle contacts tool length setter

DoSpinStop()
Code "G59P200 X0 Y0 Z0" ' This sets the spindle so you can change the tool
While IsMoving() 'Pauses the code read while machine moves
Wend

If GetOemLed(825) = 0 Then 'This checks the tool probe before moving forward
Code "G59P200 X0 Y0 Z0"
DoOemButton(1010)
Code "G90 G31 z-" & zmove &"F4" 'Feed rate here for how fast you want z to go down
While IsMoving()
Wend
ZprobePos = GetVar(2002)
Code "G00 Z" &ZprobePos 'place tool at the exact where the tool touched the tool setter
While IsMoving()
Wend
Code "G59P199"
SetOemDro(109,GetZDRO)'sets the current tool Offset
Sleep 200  'allows time for update
Code "G59P200 X0 Y0 Z0"
While IsMoving()
Wend
Code "(This tool's Length is now set)"
Code "F" &CurrentFeed
Else
Code "(Tool Setter Error)"
End If
If CurrentAbsInc = 0 Then
Code "G91"   
End If
If CurrentGMode = 0 Then
Code "G00"
End If    


I believe the issue that I have now is with this line. I'm not sure I'm using the right places as current tool length seams to have oemdro 42 109 and 836

GetZDRO = GetOemDRO(180) 'used to set tool length from this DRO reading
SetOemDro(109,GetZDRO)'sets the current tool Offset

Am I using the correct OemDRO for the tool length anyway?

« Last Edit: April 06, 2016, 11:43:06 PM by dracen knights »

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Auto tool length with manual tool change
« Reply #16 on: April 07, 2016, 08:02:24 AM »
Usually, you just change the Z axis DRO to set the tool length, unless you are using G43.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Auto tool length with manual tool change
« Reply #17 on: April 07, 2016, 08:54:55 AM »
I use g43. I don't want the work offset to change with each tool as that's not to correct way to do it.

For example you start with a. 1" cube and the top is z zero then you go around the a 3/4" circle center drill and drilling hole then the program calls for a tool to take the full exposed area down to a wave shape and the top most piece now .0873.. Well if you finish the part and then flip the part it's supported to match on top only to find out out the holes at .058 to shallow its much easier to simply add that amount into the wear and run the drill portion over again and that doesn't waste the material of having to make another part from stock.  It seams like most people don't use tool legth offset for some reason.  
Re: Auto tool length with manual tool change
« Reply #18 on: April 07, 2016, 10:43:36 PM »
OK I got the correct OemDRO figured out for to use for the tool legth offset Just not sure where to pull the number from yet...LOL I think what I'm looking for should be in the active work offset Z DRo reading but not sure... any ideas? I think GetOemDRO(802) should get me the number I'm looking for but not sure.
« Last Edit: April 07, 2016, 10:57:43 PM by dracen knights »
Re: Auto tool length with manual tool change
« Reply #19 on: April 08, 2016, 05:27:55 PM »
wow Just found this thread and I think it might have the last of the info I need in the macro they posted
https://www.machsupport.com/forum/index.php/topic,23124.10.html... I'll post and update to mine later tonight when/if I get time to work on it...