Some help with a tool length macro

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Some help with a tool length macro

Postby chjade84 » Tue Apr 04, 2017 2:02 am

So I've got a machine that uses non-interchangeable ER collets so I can't use tool offsets per-se. Every time a tool is inserted it has a random amount of stickout. I'm trying to write an M31 macro to make use of a tool height sensor, though.

So I guess first is theory. In a "real" machine you would zero off the part with a probe (something of known offset) to get the top of your part and each of your tools would have a pre-set offset which you would have in your Tool Offsets and would be corrected when you call your tool. The only time you'd need to run the macro would be when you changed an old tool out for a new one and want to change the offset.

I have just an ER collet so I have to use a freshly inserted tool of unknown length to find the top of the part for that operation and zero the Z axis DRO. I'll then find the top of a fixed point (like my vice) with that tool and note its offset from part zero. Now, every time I change a tool I can take that new tool, find where it contacts that fixed point and re-set my Z axis DRO to the offset I noted before; which means now the tip of the new tool should be in the same location as the tip of the previous tool. Not fun.

So, I'm trying to figure out how to make a tool change macro using this touch plate and the probe input, but without having any fixed tool reference.

My best idea so far would be to put in the first tool, zero it on the part and call the macro. Each time it is run, it would show a dialog box asking if this was the first tool on a new part and if so, use the touch plate to store a Z value for the tip of that tool. Then, when changing to a new tool, saying "no" at the dialog box would take that tool to the touch plate and when it makes contact, change the Z axis DRO to match the stored value.

I don't really see the need to involve the tool offsets since I'll never have a fixed offset for any tools and I largely ignore the tool numbers anyway because I've never had a reason to use them. I just grab the tool listed in the gcode comments and put it in the collet.

So, any ideas? I've already got the touch plate part working - it finds the plate but that's about it. Any help on the dialog box (I assume that's possible) or does anyone have any better ideas?

Thanks!
chjade84
 
Posts: 17
Joined: Wed Sep 21, 2016 4:46 pm

Re: Some help with a tool length macro

Postby ger21 » Tue Apr 04, 2017 10:44 am

My screenset already does this. I use two macros, one for the initial auto zero, to set the reference position, and a modified M6 macro, to zero the new tool after a tool change.
I can post the code later, but you'll need to heavily modify it, as it uses a lot of data from special user fields in the screenset.

It's base on the Mach3 VB macros in this thread. http://www.cnczone.com/forums/mach-wiza ... rsion.html
I think there's an older VB version of my macros in there as well.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Some help with a tool length macro

Postby chjade84 » Tue Apr 04, 2017 1:35 pm

ger21 wrote:My screenset already does this. I use two macros, one for the initial auto zero, to set the reference position, and a modified M6 macro, to zero the new tool after a tool change.
I can post the code later, but you'll need to heavily modify it, as it uses a lot of data from special user fields in the screenset.

It's base on the Mach3 VB macros in this thread. http://www.cnczone.com/forums/mach-wiza ... rsion.html
I think there's an older VB version of my macros in there as well.


That's a good idea; I didn't think of using two macros. I'd love to see the code if you get a chance to attach it, if for nothing else than just getting ideas and syntax examples.

Thanks!
chjade84
 
Posts: 17
Joined: Wed Sep 21, 2016 4:46 pm

Re: Some help with a tool length macro

Postby ger21 » Tue Apr 04, 2017 9:48 pm

Here are the macros.
Attachments
Auto_Zero.zip
(5.84 KiB) Downloaded 1034 times
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Some help with a tool length macro

Postby chjade84 » Tue Apr 04, 2017 9:49 pm

Thanks! I'll look at it tonight.
chjade84
 
Posts: 17
Joined: Wed Sep 21, 2016 4:46 pm


Return to Macros

Who is online

Users browsing this forum: No registered users and 7 guests

cron