Macros - write function

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

Macros - write function

Postby Robertspark » Mon Jun 19, 2017 5:34 pm

Is it possible to write a function within the macro so that the function can be reused?

If so, how, have you got a quick example as I tried modifying one of the existing example macros in the default folder and I could not get them to run.#

Thanks,
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Macros - write function

Postby cncdrive » Mon Jun 19, 2017 5:46 pm

Hi Rob,

What do you mean by "reuse"?
To have a function in a macro and call that function from the same macro?
That is possible, there is an example in the macro capability document.
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm

Re: Macros - write function

Postby Robertspark » Mon Jun 19, 2017 5:50 pm

Thanks....

So there is.... I'm loosing my mind today (not use to the hot weather....) [too hot, we moan, too cold we moan...]

Code: Select all
void MyFunction()
{
  exec.Code("G0 X10");
}


My macro must have had something else wrong with it....

"reuse" was to be able to recall the macro at other instances in the code
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm


Return to Macros

Who is online

Users browsing this forum: Bing [Bot] and 3 guests