Macro to store user input and machine position

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

Macro to store user input and machine position

Postby mjr1127@gmail.com » Sat Dec 16, 2023 5:13 am

I'm having some difficulty writing what I'd think would be a simple macro. I've tried moving the following two functions all through the example snippets I've found but without success or progress.

There are two functions from the uccnc documentation that I would like to use ( double Xposvariable = exec.GetXpos(); & double val = exec.Question("etc"); but I do not understand how/where to put these in my code for the effect.

I'd like M5000, when called, to bring up a box/value request for an input to be stored in variable #40. I'd like the macro to also store the current x-position to variable #50. And then close, that's it. Anyone have some guidance of how to do this? Thank you
mjr1127@gmail.com
 
Posts: 10
Joined: Tue Dec 05, 2023 7:22 am

Re: Macro to store user input and machine position

Postby dezsoe » Sat Dec 16, 2023 9:46 am

Here's the macro using your first 2 lines:

Code: Select all
double Xposvariable = exec.GetXpos();
double val = exec.Question("etc");

exec.Setvar(Xposvariable, 50);
exec.Setvar(val, 40);
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Macro to store user input and machine position

Postby mjr1127@gmail.com » Sat Dec 16, 2023 3:30 pm

Excellent, thank you !
mjr1127@gmail.com
 
Posts: 10
Joined: Tue Dec 05, 2023 7:22 am


Return to Macros

Who is online

Users browsing this forum: No registered users and 19 guests