variables # "M#3"

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

variables # "M#3"

Postby Robertspark » Thu Jan 10, 2019 5:35 pm

Just wondering {I've tried it and it doesn't work with UCCNC}

Is it possible to call a variable with say
M#3
M#5


where I could assign any number to #3 and #5 and it would be associated with the M-code

You may ask "why do you want to do this?"

Say I want to plasma cut something, I would assign #3=3 and #5=5 so the gode file would become M3 to fire the torch and M5 to stop the torch.

Say I want to engrave that same code with a plate marker..... I could assign #3=7 and #5=9, now my code would become M7 to turn the engraver on and M9 to turn the engraver off.

Or if I now wanted to use the same code again for lets say a router, I could assign something like #3=300 and #5=500 which becomes M300 and M500 which would include for the Z axis motion


Lets say I was using some "generic" letter gcode such as this which I could scale with G51 X Y and use universally {or that was the thought}

Code: Select all
(D LETTER)
G91 G0 X0.1129 Y0.118
M#3
G91 G1 Y1.782 F#505
X0.633
G2 J-0.891 Y-1.782
G1 X-0.633
M#5
G91 G0 X-0.1129 Y-0.118
G91 G0 X2.0000
M99


Is there a reason why M#3 could not be done to share variables?



note: before someone says that if you cut a "D" with that gcode and plasma you'd get dropout {the center will fall out}..... yes I know but you could mark it out with marking mode and a plasma cutter though....
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: variables # "M#3"

Postby Robertspark » Thu Jan 10, 2019 7:41 pm

kind of answered my own question via another solution....

Just call any other macro say M300 for ON and M301 for off and then use a switch statement in there to call the correct code for the various marking / cutting / routing / engraving operations.
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm


Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: No registered users and 4 guests