Carbide Motion macros - what have I done?

I enjoyed Kevin Barnett’s recent YouTube video
https://youtu.be/QI-TZltM2HY?si=ktqCWwbHagXaaxyv that demonstrated a “secret feature you don’t know…” and felt inspired to try using CM user macros to ‘save multiple X / Y zeros’ during a milling project on the Nomad 3.

I support the Nomad at our local library, as a self-taught volunteer, and a common question I get in my Basic CNC class for library patrons is, "why can’t we push a button to move the spindle to a known point (like the lower left corner of the wasteboard) and then automatically set that X,Y coordinate as our X/Y zeros. The library reboots the computer and Nomad between every user, pulling CC Pro and CM from a deep freeze to ensure no user based edits, settings, or files are retained between CNC sessions.

I entered the Gcode command G20 X Y in the Gcode field of the user macros in CM to move the spindle to the known location of the lower left corner of the wasteboard - something I typically do in JOG before setting X and Y to zero. When I executed the macro it moved the spindle, but it also set that location as the X and the Y zero (X and Y locations show 0.0 in CM). This was a great result, what I was trying to achieve…but I thought I would have to rerun the macro for every new CNC session. To my surprise the next CNC session retained the X and Y zero settings, that is, after initializing the Nomad the X,Y coordinates in CM now read 0,0 when I move the spindle to the lower left corner.

What did I do when I used the G20 command that has now changed how CM initializes and displays X and Y?? I got what I wanted but not in the way I expected. Have I permanently altered the coordinates used by CM or their presentation? Would really appreciate any insights into this behavior. Thank you.

G20 changes the units used:

https://carbide3d.com/hub/faq/supported-gcodes/

G20 — Select Imperial units

but Carbide Motion expects metric — always set it back to G21:

G21 — Select metric units

before ending the macro.

If you executed “G20 X Y” with no values & it moved, I can only presume it moved to X0.0 Y0.0
So it didn’t reset that position, it was already at X0.0 Y0.0

If you want to save a position that will survive a previous setup or reload of software, you want to use Machine Coordinates. And since the machine envelope is about 8" x 8", your macro should look something like

G20 G53 X-8.0 Y-8.0 (G20 = Imperial G53 = Machine Coordinates and the XY position relative to the home position)
G10 L20 P1 X0.0 Y0.0 (Set the current position to X0.0 Y0.0)

2 Likes

Thanks @WillAdams and @Tod1d for the quick responses. Please be patient with me as I try to understand how a gcode command impacts temporary values and global values/settings. Since what I did has changed CM after it has initialized, showing position coordinates with the lower left corner being zero for x and y, I would be happy to leave it as it is and send an update out to our CNC users saying CM initializes with the origin (0,0) in the lower left corner.

Previously I told brand-new CNC users, after CM initialized, to JOG the spindle to the lower left corner of the wasteboard to set X and Y zeros. I came to realize, that after CM initialization, the lower left corner of the wasteboard was located at -8.963 and -8.262 and, as a result, changed my instructions to say move the spindle close to the lower left corner, but that you can fine-tune the corner location with JOG until CM reads -8.963 for x and -8.262 for y…then set zero for x and y. This was a good way to introduce new users for their first project and then share more nuanced zeroing options later.

So what I was trying to do with the macro was cut out the JOG and replace it with a Quick Action that would go to -8.963 and -8.262. What happened instead was CM now shows this location to be X=0 and Y=0 and I don’t understand why…and how it has now changed for EVERY new session. I must have changed some basic value/setting that CM never forgets (in firmware??). If this is true and I have not broken/changed some other feature I can communicate this change to our patrons.

We default to imperial measurements at startup but show users how they can change to metric. I have not executed the G21 command. I don’t have to run the macro now…because x and y zeros are set for the lower left corner of the wasteboard when initialization is complete. I have run 2 test projects since this change and everything seems to function as it has in the past, within the 8" x 8" wasteboard dimensions.

Maybe I need to learn gcode programming to understand this - we do not allow patrons to use gcode, in part because we are trying to maintain an entry level machine setup and experience for our patrons. I broke that rule when I ran the macro - I didn’t realize what I was doing would become a permanent change.

Thanks again in advance for any insight on this topic.

Post a sequence of screen grabs and text showing what you are seeing, what happens, and what is being done?

Also the Quick Action text?

Some information gets stored in the data directory, which likely doesn’t get overwritten when CM reinstalls. C:\Users<user>\AppData\Local\Carbide 3D\CarbideMotion6
I think the file is called Shapeoko.json

When you jog to the lower left corner, X0.0 Y0.0, click on the word “Position” in the display. It should change to “Machine Position” and X-8.963 Y-8.262. Click it again to get back to workpiece offset position, or just “Position”

The “home” position also gets stored on the machine in GRBL, but CM uses it’s own.
For reference, if you do learn G-code (not a bad idea), Machine position is an offset activated with G53. CM uses another offset (G54) by default.
Your current zero point will remain in effect until someone changes it.
That’s why in the macro example above I used G20 G53 X-8.963 Y-8.262 before setting the current position to X0 Y0. It will always reference the hard stop home position regardless of what happens in the software.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.