M61 T# macro fquestion

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

M61 T# macro fquestion

Postby bhdavis » Wed Jul 24, 2024 11:15 pm

On my new Rapidchange ATC tool changer I type M61 T# to change the number of a tool in the spindle if needed. It's not needed often but does come in handy occasionally.

I'd like to create a screen button for the command. However I'm not sure how to code the macro so it asks me for the tool number to use. I think I can create a pop-up box but it's been a while since I did that. Then further though I don't have a clue on how to make a tool number I insert in the pop-up box get assigned to the tool in the spindle.

Could someone point me in the right direction?

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

Re: M61 T# macro fquestion

Postby bhdavis » Fri Jul 26, 2024 11:11 am

I created a test macro M20099 with the following:

// test input box

string val = exec.TextQuestion("Enter loaded tool number.");

exec.Code("M61 T()");


I get the popup box and can enter a tool number but it does not record it on the T# data cell on screen. If I replace the () with a tool number, i.e. M61 T5, that works.

So the macro concept works but not the part where what I enter for a tool number in () gets recorded on screen.

I imagine I'm way off here on the concept of how to do this but thought I'd try a few things.

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

Re: M61 T# macro fquestion

Postby ger21 » Fri Jul 26, 2024 11:40 am

Try this:

Code: Select all
string val = exec.TextQuestion("Enter loaded tool number.");
string toolch = "M6 T" + val;

exec.Code(toolch);
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: M61 T# macro fquestion

Postby bhdavis » Fri Jul 26, 2024 12:25 pm

Thank you Gerry. Worked perfectly.

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

Re: M61 T# macro fquestion

Postby bhdavis » Fri Jul 26, 2024 6:36 pm

Drats.....forget that "works perfect" comment above. I posted that after trying it in Demo mode and before putting it on the CNC.

What you gave me was basically calling for a tool change from one bit to another. I already have that covered with my individual buttons as you'll see in the attached screen shot.

What I need is to rename a tool that is already in the spindle.

Say for example I'm doing some alignment testing on the tool rack. I might have T3 in the spindle but my open holder is T1 and I want the tool in the spindle to be renamed T1.

What I would type in the MDI is: M61 T1

That would change the tool recorded in UCCNC from T3 to T1.

Or if I had no tool in the spindle but T1 etc was recorded in UCCNC, then typing: M61 T0 would change the recorded tool to T0.

So instead of having to type M61 T# I could just push the screen button and it would ask me for the number.

Thanks Gerry,
BH
Attachments
1.2113 screen done 07.26.24.png
bhdavis
 
Posts: 141
Joined: Tue Mar 23, 2021 7:36 pm

Re: M61 T# macro fquestion

Postby bhdavis » Fri Jul 26, 2024 8:48 pm

Okay. Here is your suggested code:

string val = exec.TextQuestion("Enter loaded tool number.");
string toolch = "M6 T" + val;

exec.Code(toolch);

which executes a tool change.

******************************************************************************************************************

Here is my working M61 T# code that changes the existing recorded tool to a new T# when I type M61 T# in the MDI box:

int newTool = exec.Getnewtool();

if (newTool < 0)
{
return;
}
else
{
exec.Setcurrenttool(newTool);
}

**************************************************************************************************

I've combined the two as follows (plus numerous other ways):

string val = exec.TextQuestion("Enter loaded tool number.");

string Setcurrenttool(newTool); = "M61 T" + val;

exec.Setcurrenttool(newTool);


but am getting a code error message when entering this macro into the MDI. Obviously I'm only guessing as I don't have much background in doing this.

*****************************************************************************************************


Thoughts?

Thanks for you time,
BH
bhdavis
 
Posts: 141
Joined: Tue Mar 23, 2021 7:36 pm

Re: M61 T# macro fquestion

Postby ger21 » Sat Jul 27, 2024 7:19 pm

If I understand correctly, you just need this:
Code: Select all
string val = exec.TextQuestion("Enter loaded tool number.");

exec.Setcurrenttool(val);
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: M61 T# macro fquestion

Postby bhdavis » Sat Jul 27, 2024 8:27 pm

Thanks Gerry. I'll give it a try shortly. I just hauled home a used Minimax S45 18" bandsaw and need to unload it before playing with the CNC.

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

Re: M61 T# macro fquestion

Postby bhdavis » Sat Jul 27, 2024 10:31 pm

Gerry,

I get "script errors" when I run that last suggestion. But, yes, I think you understand what I'm trying to do.

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

Re: M61 T# macro fquestion

Postby dezsoe » Sun Jul 28, 2024 5:24 am

Here it is fixed:

Code: Select all
double val = exec.Question("Enter loaded tool number.");
exec.Setcurrenttool(Convert.ToInt32(val));
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Next

Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: No registered users and 12 guests