M31 Tool length macro edit

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

Re: M31 Tool length macro edit

Postby spumco » Fri Feb 02, 2018 2:54 am

Yes, I agree the function is very simple, and G43 H96 works fine when I use MDI.

exec.Setcurrenttool(96);
exec.Code("G43 H96");

have been added to the M31 macro in my profile folder right after the 'double' statements and before the first 'if' statement.

However, tool offset #96 is not being applied during the macro. Screenshots taken after the probing cycle:

UCCNC M31 issue.pdf
(615.42 KiB) Downloaded 1056 times
spumco
 
Posts: 306
Joined: Mon Oct 03, 2016 10:10 pm

Re: M31 Tool length macro edit

Postby cncdrive » Fri Feb 02, 2018 7:43 am

I've tested the same now as what you wrote.
I placed the mentioned two lines of codes in the M31 macro rigth after this line:
bool dodualcycle = true; //Do probing from 2 cycles, first with Fast and second with Slow feedrates

And I ran the M31 through MDI first and after in a simple G-code file with a few linear motions before and also after the M31 code.
The result is that the code works OK, I do not see the mentioned problem.
The tool number is set properly to 96 and the offset is defined to the value in the 96th tool table length field.

What possible problems/mistakes I see which could cause the issue in your system are:

1.) You did not Apply the new tool length values with the Apply settings button. Or if you written them from macro then with the Validatefield function.
So, the values are visually written there, but they are not applied. These field values however auto-validate in UCCNC 1.2102, but not in previous versions, so you must press the Apply settings if you running previous versions.

2.) You might keep this line in the M31 macro at around the end of the macro file:
exec.Code("G44 H1"); // Load tool offset one, note the tool lenght is defined in the tools menu
If so then the macro sets the offset to tool 1. length after it set it to tool 96. value, so the final result will be 0 if tool#1 length is set to 0.
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: M31 Tool length macro edit

Postby dezsoe » Fri Feb 02, 2018 10:25 am

Point 2. will be the reason, because in the pdf you can see that tool #1 has 3.0715 offset. (Page 2/tools/#1 = page 3/offsets/tool length offset.)
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: M31 Tool length macro edit

Postby spumco » Fri Feb 02, 2018 12:29 pm

I think I've just discovered what the problem is...

I'm using Gerry's 2017 screenset and his simple auto zero button is not calling M31. It's calling a different macro (M20523) - obviously I've been messing with the wrong macro this whole time.

I'll look at the macro when I get home tonight and see what the deal is.

Thanks much
spumco
 
Posts: 306
Joined: Mon Oct 03, 2016 10:10 pm

Re: M31 Tool length macro edit

Postby spumco » Fri Feb 02, 2018 10:46 pm

Well, it seems to work better now that I'm editing the correct macro...

Thanks for you guys spending your time on this. Works like a charm now.
spumco
 
Posts: 306
Joined: Mon Oct 03, 2016 10:10 pm

Re: M31 Tool length macro edit

Postby xillianto » Mon Aug 10, 2020 9:50 pm

Hi, may i have a copy of that tool lenght macro ? I would love to store my tool lenghts, Also, does it also check tool for lenght ? So if that the tool number does not excists, it runs and measures it ?
xillianto
 
Posts: 5
Joined: Sat Nov 30, 2019 8:17 pm

Previous

Return to Macros

Who is online

Users browsing this forum: No registered users and 2 guests