User defined variables for custom macro

Animated GIF

HA! It’s not that it’s all secret, we’re just still working on it.

For your purposes most of the things you asked for are built in there already. For other stuff that’s more “under the hood” for ATC there’s a huge settings file that folks like your self can much more easily manipulate rather than chasing down parameters like you’re currently doing

I updated to Router Version 5.40 u26 and noticed the MTC script now has a defined tool change position — exactly what I’ve been wanting. Right now it defaults to X0, Y0, but I’d like to change it to something like X24, Y8.

I found the defines file that lists the tool change position variables, but I can’t figure out how to actually set them to a value. I think the reference parameters are #1930 and #1931 (going off memory, so I could be wrong on those), but I’m not sure where to go to actually set them — or if that’s even the right way to do it.

Any pointers on the process would be great.

Go into the ATC app and set it there. It’s the ATC SETUP icon on the main screen

thank you!

You’re welcome!

This thread reminds me of a question that I’ve had that is asked up at the top of this thread.

CNC12 doesn’t allow creating unique variables, so you have to be very careful when using the variable space so as not to stomp on something that another macro uses, or vice-versa. I have already had this misfortune a couple times, and I haven’t tried anything complicated yet.

So the question is, what is the best way to get the most comprehensive list of variables used by their number as well the DEFINES that have been assigned to them?

yes it does, mostly.

You can do this

DEFINE 35

Anytime you put anywhere it’s substituted for 35

You can also get creative and do things like this:

DEFINE G53 Z0 X0 Y0

Now when you simply do this on a line:

those commands are executed.

Define commands are straight text replacements, so they’re very versatile and can be used anywhere.

You can have macros that have lists of defines if you want (we do this all the time in our ATC scripts)

To see a list, well that’s not straightforward. In our ATC macros we have four main lists: One master DEFINEs file, one for imperial, one for metric and one for the ATC app.

The big limitation of them is that they are really nothing more than straight text replacements, and they run BEFORE anything else in each macro, so you can’t do this:

IF EQ 1 THEN DEFINE 55

That won’t work.

This is why I like to keep my defines in separate macros so you could do something like this:

IF #100 EQ 1 THEN “G65 SuperLaserDefines.mac” ELSE “g65 regular laser defines.mac”

(This is the approach we take for imperial vs metric, we just load a file with a set of defines for each unit)

CNC12, in the manual defines the parameters you can use as a user.

These are 150-159, 700-799 although be warned we (avid) have used most of those

There’s a higher range here :

We have used some of those, but probably nothing even close to the 30k range, and they’re cleared on exit, so again you could just make a settings file that loads these.

I know this is an old thread, but I recently got my ATC system up and running and I was poking around under the hood, and I found a file in the profile folder, “\cncr\AvidATC\Build Scripts\variable-usage.md” The purpose of this file is for the Avid developers to maintain a log of all of the variables and where they are used. Unfortunately, it is not in sync with reality. For example, it says the following for variable #100:

#100

Alias: DEFINE <MTCFLAG> #100 (toolchangesetup.mac)

File Purpose
toolchangesetup.mac MTC flag: 1 = user pushed MTC button, 0 = not
ATCutils/ATCdiag.mac Test timer (set to 10); used for dialog timeouts throughout diagnostics
ATCutils/ATCutilsUI.mac User input: “What tool is in the spindle right now?”
ATCutils/IOchecker/IO_Override_detector.mac Stores #9916 (Inputs 1-16 inversion state) for I/O report
ATCutils/IOchecker/reset_forced_states.mac Stores #9916 (Inputs 1-16 forced state); displayed after reset
SafeZone.mac Target center X coordinate for safe-zone arc calculations
VarExporter.mac Temp variable for current variable number in export loop

But if you go to the macro in the first entry, toolchangesetup.mac, you will see that this used to be the case, but was causing a bug and it was changed to use #29004 instead.

#29004 does not even show in the variable-usage.md file.

So, I wrote a python script that iterated through all of the macro files and finds all of the User variables in the range of 100-199, and 29000-2999 and generates a new .md file named “gen-variable-usage.md” that documents all of the user variables and all of the locations where they are used.

The example .md file created and the Python file are attached below.

I hope someone finds this useful. :grinning_face: Avid developers might be interested in it as well as it could simplify keeping their variable documentation in sync.

gen-variable-usage.md (89.4 KB)
gen-variable-usage.py.attachment (5.7 KB)

Nice! I have something like this on my end that updates a spreadsheet. That doc is a little out of date.

If you can, try and stick to DEFINEs as you can have tons of those and they can be whatever you want. That way you can not step on our stuff, or our stuff can’t step on your stuff :slight_smile: