Am I do someting wrong with tool measuring?

Post anything you want to discuss with others about the software.

Am I do someting wrong with tool measuring?

Postby bhdavis » Thu Apr 03, 2025 11:13 pm

I have a 5 position ATC on my CNC. I use an M931 for the automatic tool measuring when tools are picked up, and M31 for touching down to my material.

I run about a 50% success rate when changing tools with regard to the tip of the tool being right at the previously measured material surface location.

For example if I touch down to my material with T1 and then after running the file for that bit, pick up T2 it may or may not have it's Z0 right at the material surface. When this happens I've noticed that the discrepancy is about equal to the difference between the length of the 2 bits. That is, if T1 is 1/4" longer than T2, T2 would be 1/4" above the material.

The M931 that runs at each tool pickup seems to be recording that tool length in the tool table properly. But the UCCNC internal math may or may not calculate the right position for the 2nd bit to be on the material surface at Z0......or may not apply it at all.

This has been going on for a long time and I thought I'd finally ask here if there might be something I'm missing or doing wrong.

Ask away and I'll try and provide more details as they might be requested. I will add that I have two touch down probes.....one fixed location for the tool rack and one portable to put on top of my material.

I'll post my M931 file below.

Thanks,
BH

**********************************************************
M931 file


// Set Tool Offset
// Called from M6.txt




// Get tool number
int tool = exec.Getcurrenttool();

// If current tool is invalid, abort with a warning.
if (tool < 0)
{

exec.Code("M0");
MessageBox.Show("The current tool is invalid.\n\n" +
"Your program has been stopped ( M0 ) and the Set Tool Offset function is aborted.\n\n" +
"Please set the current tool and try again.", "Select Current Tool");
return;
}

// If we don't have a tool we're done.
if (tool == 0)
{
return;
}

// If we make it here, we have a valid tool.
// Confirm proper modal states.
exec.Code("M5");
exec.Code("M9");
exec.Code("G90");

// Initialize paramters.
int saveToolTableButtonId = 780;
string SECTION = "RapidChange";
string zSafeToolSetter = exec.Readkey(SECTION, "zSafeSet", "0");
string xToolSetter = exec.Readkey(SECTION, "xSetter", "0");
string yToolSetter = exec.Readkey(SECTION, "ySetter", "0");
string zSeekStart = exec.Readkey(SECTION, "zSeek", "0");
string zSeekTarget = exec.Readkey(SECTION, "seekTarget", "0");
string seekFeedRate = exec.Readkey(SECTION, "fSeek", "0");
string setFeedRate = exec.Readkey(SECTION, "fSet", "0");
string seekRetreat = exec.Readkey(SECTION, "seekRetreat", "0");
string zSafeClearance = exec.Readkey(SECTION, "zSafeClear", "0");

double tloReference = double.Parse(exec.Readkey(SECTION, "tloRef", "0"));
double machToWorkOffset = exec.GetZmachpos() - exec.GetZpos();
double zTargetWorkPos = double.Parse(zSeekTarget) - machToWorkOffset;
string zTargetWork = zTargetWorkPos.ToString("F2");

exec.Code("G53 G0 Z" + zSafeToolSetter);
exec.Code("G53 G0 X" + xToolSetter + "Y" + yToolSetter);
exec.Code("G53 G0 Z" + zSeekStart);
exec.Code("G31 Z" + zTargetWork + " F" + seekFeedRate);
WaitForMove();
exec.Wait(200);

double retreatDistance = double.Parse(seekRetreat);
double retreatHeight = exec.GetZmachpos() + retreatDistance;
exec.Code("G53 G0 Z" + retreatHeight.ToString());
exec.Code("G31 Z" + zTargetWork + " F" + setFeedRate);
WaitForMove();
exec.Wait(200);

// double setterRef = double.Parse(exec.Readkey(SECTION, "setterRef", "0"));
// double offset = exec.GetZmachpos() - setterRef;
double offset = exec.GetZmachpos() - tloReference;
int fieldNum = GetToolOffsetFieldNumber(tool);
AS3.Setfield(offset, fieldNum);
exec.Callbutton(saveToolTableButtonId);
exec.Wait(200);
exec.Code("G43 H" + tool.ToString());

exec.Code("G53 G0 Z" + zSafeClearance);
WaitForMove();

#Events

void WaitForMove()
{
while (exec.IsMoving()) {}
}

int GetToolOffsetFieldNumber(int toolNum)
{
if (toolNum >= 1 && toolNum <= 20)
{
return 195 + toolNum;
}
else if (toolNum >= 21 && toolNum <= 96)
{
return 920 + toolNum;
}
else
{
return -1;
}

}
bhdavis
 
Posts: 162
Joined: Tue Mar 23, 2021 7:36 pm

Re: Am I do someting wrong with tool measuring?

Postby DavidR8 » Mon Apr 07, 2025 3:58 pm

I'd love to see if there's a resolution to this.
DavidR8
 
Posts: 72
Joined: Tue Feb 15, 2022 6:45 pm

Re: Am I do someting wrong with tool measuring?

Postby ger21 » Mon Apr 07, 2025 4:21 pm

Is this getting the correct tool number? Since you are calling this from the M6 macro, I wonder if you are actually getting the current tool, or the previous tool?

Code: Select all
int tool = exec.Getcurrenttool();



Personally, I would not be doing this the way you are.

I'd would be measuring all my tools, and entering their lengths in the tool table before running any code.
Then, just change tools, and call the appropriate G43 offset. Done.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2796
Joined: Sat Sep 03, 2016 2:17 am

Re: Am I do someting wrong with tool measuring?

Postby bhdavis » Mon Apr 07, 2025 5:36 pm

Thanks Gerry.

Yes, I am getting the right tool number so that much is working.

I can't do as you suggest and pre-measure all my tools as I'm using the Rapidchange ATC tool changer. That drops off and picks up individual collets and nuts. Since the bits an move in the collet with each pick up they have to be measured every time.

This is not as convenient as an air activated ATC with collets and bits locked into the tool holders but it is also about 10% of the cost of that professional style setup.

Here's a link to the system running on my CNC.

https://www.youtube.com/watch?v=eeRWbb54e48

BH
bhdavis
 
Posts: 162
Joined: Tue Mar 23, 2021 7:36 pm

Re: Am I do someting wrong with tool measuring?

Postby ger21 » Mon Apr 07, 2025 7:44 pm

Where does the tloRef value come from?

Code: Select all
double tloReference = double.Parse(exec.Readkey(SECTION, "tloRef", "0"));



I think that any time you zero the Z axis, the tloRef value needs to change?
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2796
Joined: Sat Sep 03, 2016 2:17 am

Re: Am I do someting wrong with tool measuring?

Postby RsX » Mon Apr 07, 2025 9:19 pm

I notice a lot of compression of the toolsetting plate even when slowly probing.
Can it be an issue of poor surface/tool conductivity? Or is there a switch inside?
User avatar
RsX
 
Posts: 77
Joined: Fri Oct 25, 2024 9:22 pm

Re: Am I do someting wrong with tool measuring?

Postby DavidR8 » Mon Apr 07, 2025 9:38 pm

RsX wrote:I notice a lot of compression of the toolsetting plate even when slowly probing.
Can it be an issue of poor surface/tool conductivity? Or is there a switch inside?

I noticed the same. I can say that if I look at sideways at my tool setter it will trigger.
All joking aside, in the video the first hit on the tool setter visibly moves the top surface whereas the second hit doesn't.
This make me thinks the inconsistency may be related to the difference in sensor travel between the two hits. Why does the first hit travel so far whereas the second doesn't?
DavidR8
 
Posts: 72
Joined: Tue Feb 15, 2022 6:45 pm

Re: Am I do someting wrong with tool measuring?

Postby bhdavis » Mon Apr 07, 2025 9:49 pm

DavidR8 wrote:
RsX wrote:I notice a lot of compression of the toolsetting plate even when slowly probing.
Can it be an issue of poor surface/tool conductivity? Or is there a switch inside?

I noticed the same. I can say that if I look at sideways at my tool setter it will trigger.
All joking aside, in the video the first hit on the tool setter visibly moves the top surface whereas the second hit doesn't.
This make me thinks the inconsistency may be related to the difference in sensor travel between the two hits. Why does the first hit travel so far whereas the second doesn't?



Interesting observation. I've just figured the first plunge is moving fast enough to push the switch past the trigger point. However I will take a closer look at this.

Thanks for the heads up.
BH
bhdavis
 
Posts: 162
Joined: Tue Mar 23, 2021 7:36 pm

Re: Am I do someting wrong with tool measuring?

Postby DavidR8 » Mon Apr 07, 2025 9:51 pm

bhdavis wrote:
DavidR8 wrote:
RsX wrote:I notice a lot of compression of the toolsetting plate even when slowly probing.
Can it be an issue of poor surface/tool conductivity? Or is there a switch inside?

I noticed the same. I can say that if I look at sideways at my tool setter it will trigger.
All joking aside, in the video the first hit on the tool setter visibly moves the top surface whereas the second hit doesn't.
This make me thinks the inconsistency may be related to the difference in sensor travel between the two hits. Why does the first hit travel so far whereas the second doesn't?



Interesting observation. I've just figured the first plunge is moving fast enough to push the switch past the trigger point. However I will take a closer look at this.

Thanks for the heads up.
BH

I'd slow slow the first hit and see if that make a difference.
DavidR8
 
Posts: 72
Joined: Tue Feb 15, 2022 6:45 pm

Re: Am I do someting wrong with tool measuring?

Postby ger21 » Tue Apr 08, 2025 8:18 pm

Did you see my last post?
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2796
Joined: Sat Sep 03, 2016 2:17 am

Next

Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: Google [Bot] and 0 guests