Programming a Macro as a canned cycle ???

If you have a question about the software please ask it here.

Re: Programming a Macro as a canned cycle ???

Postby Robertspark » Fri Aug 31, 2018 1:48 pm

Yes, you can pass the variables to the M-code via the example in the manual (page 62/87 in the current development version manual, section 4.1.2 M-codes)
(I've done it a couple of times I'm just not at my home PC for an example I'll try to load one tonight)

That G96 attempt did it:
viewtopic.php?f=20&t=822
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Programming a Macro as a canned cycle ???

Postby Robertspark » Fri Aug 31, 2018 4:16 pm

Well, you can't send parameter "F" so would need to substitute it with another letter (same with "S")

I don't see what the difference between
Code: Select all
G81 X1 Y2 Z-1 R.050 F20


and
Code: Select all
M81 X1 Y2 Z-1 R.050 Q20


would be. I'm obviously missing something really obvious
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Programming a Macro as a canned cycle ???

Postby Robertspark » Fri Aug 31, 2018 5:54 pm

Vmax549 wrote:But back to the original question?



I'm still not seeing what the problem is....

Input variables to macro

Use variables in macro

Output exec.code()

Done...

What do you want the gcode / macro to do I can do a g12/g13 macro (I think I may have already posted one some time ago as I got it from Peter Smids book
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Programming a Macro as a canned cycle ???

Postby Robertspark » Fri Aug 31, 2018 5:56 pm

viewtopic.php?f=13&t=638&p=4556&hilit=G12#p4556

AHH I didn't post it just asked if it was wanted
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: Programming a Macro as a canned cycle ???

Postby ger21 » Fri Aug 31, 2018 8:52 pm

Your M code would need to be modal...
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2663
Joined: Sat Sep 03, 2016 2:17 am

Re: Programming a Macro as a canned cycle ???

Postby cncdrive » Fri Aug 31, 2018 9:03 pm

You can make global variables in the macro and then when you passing through the variables you can test them for null and if they are null then you don't change the previous global value.
The variables will keep their values as long as your macro code is not changed, because then the UCCNC will not recompile the macro if the macro text is the same and so your variables can be handled in the macro as modal.
cncdrive
Site Admin
 
Posts: 4695
Joined: Tue Aug 12, 2014 11:17 pm


Return to Ask a question from support here

Who is online

Users browsing this forum: No registered users and 28 guests

cron