Macros For My Workflow

Something that you should understand. What I’ve done here is done for my workflow and my machine. If you attempt to use what I provide here, you must be responsible for making adjustments that work for your machine.

The best place to start is at the beginning, and I hope you don’t mind how verbose this story is. :smiley:

I found myself going through this repeating dance between putting in a bit, moving to the zero block, moving off-table to adjust my zero for the thickness of tape & CA glue holding my project to the wasteboard and going back to my project’s XYzero to start the cutting.

DING! That’s why macros exist! (That voice in my head said, “Why’d it take you so long?” :smiley: )

I cludged together some gcode and found something that worked … only I was never really happy with it. So, the OP on this thread gave me the incentive to rework my macros. In addition, I’ve found my workflow extending to other parts of my wasteboard using most of the other defined Workspaces - P1 - P6. I generally have fixtures for different products spaced around my machine where each one is defined within a Workspace.

I’m still not happy with the results in at least one area, but more on that later. My workflow on lots of projects is similar to the way I described it above:

  • Home the machine
  • Load my Workspace coordinates
  • Move to the desired Workspace’s XY
  • Prepare the part and the bit to use
  • Move to a fixed machine zero reference point
  • Perform the Z-Zero procedure
  • Move off-table (for bit clearance)
  • Go to Z-Zero
  • Jog the Z up by 0.010" (two tapes & CA glue)
  • Zero Z at this new position
  • Move the bit up for clamp clearance
  • Go to XY0 in my current Workspace
  • Start the job

And all of that has to be aware of what Workspace I’m using which I keep track of (most of the time), but a macro has to have a programatic way to do the same.

I did make you aware of the verbosity in this post! :smiley:

So, this ended up being three different macros for my workflow. The first one handles loading Workspace coordinates. (This one started while I was transitioning from Carbide’s CM sender. It irrationally resets some coordinates as it is closing that gave me problems until someone on this forum set me straight.)

The second macro moves the bit into the area where I do Z-zero with a block. The third macro is the one that actually makes the Z adjustment for tape and glue.

Each one of the macros will save the current Workspace address, do what it does and return to the saved address. Each macro is heavily commented, but I remove all comments when I install it into gSender. I’ll provide the text of each macro inline, but I will also attach the text files.

The next post explains some of the problems I encountered and discusses improve ments.

After that, there are 3 posts with the gcode for a macro, and the downloadable text for that macro.

If you notice a way to improve something, that won’t make me mad even a leetle bit! :smiley: Please quote something out of the post you have a response to so it will be easy to keep up with them.

2 Likes

Discussion on Problems and Improvements

Problems

modal.wcs

This line gave me fits trying to isolate what it was doing. The error messages don’t really help when there’s this kind of problem.

%LWC=modal.wcs ( save the current workspace )

The variable and source are available in the macro editing window in gSender. Its supposed to save “G54” or “G55” or etc. when I’m saving the Workspace location. It was returning null into the variable LWC.

I had to dig up some old computer programming troubleshooting skills when I was trying to pin down why I was getting an error message and not my intended result.

Have you got a clue? (Perhaps you’ve already looked ahead at some of my gcode? :smiley: )

Improvements

Burning Workspaces

One thing that I haven’t figured out yet is how to specify the fixed locations without resorting to the use of a Workspace. (I chose to create the macros this way for the expediency of getting the whole development done.) The way my workflow happens is that I have a place where I zero my project to the wasteboard (the level at the bottom of my project.) This is what is specified in my design software (Vectric Vcarve Pro) and captured when the gcode file is produced. (The Z-zero reference could easily be specified as the top of the material, but that’s a different story.)

That fixed location is the most appropriate for my P1/G54 Workspace (the default.) Since my machine has been really flat for years, that location hasn’t been a problem for other Workspaces. However, technically, I would be better off using a Z-zero location closer to the active Workspace. I know this is possible by simply deciding on an XY offset from the XY-Zero of the current Workspace, but I’ll just have to work on that gcode improvement. The change involves clamps and corner guides, but is possible. I want to maintain the macros in such a way that anyone can make adjustments for their own machine and setup.

Perhaps that’s a pipedream, but I’m seeing it as a goal. :smiley:


( MACRO INITIALIZE P1-P6 LOCATIONS )
( PURPOSE: TO SET THE LOCATION FOR EACH OF 6 WORKSPACES )
( PROCESS: SET INCH MODE )
( SAVE EACH XY POSITION FOR EACH WORKSPACE )
( ORIGINAL: CROOKEDWOODTEX 2023-08-25-1 SIENCI FORUM )


G20 ( INCH MODE )
G10 L2 P1 X-27.918 Y-28.617 ( G54 DEFAULT CUTTING)
G10 L2 P2 X-12.317 Y-15.002 ( G55 ORNAMENTAL FIXTURES )
G10 L2 P3 X-25.908 Y-20.570 ( G56 )
G10 L2 P4 X-15.917 Y-26.600 ( G57 CUTTING TO RIGHT OF P1 )
G10 L2 P5 X-27.918 Y-32.617 ( G58 OFF TABLE LOWER LEFT FOR Z-ZERO ADJUSTING )
G10 L2 P6 X-30.584 Y-25.141 ( G59 Z-ZERO BLOCK LOWER LEFT - MACHINE BED ZEROING )

MACRO INITIALIZE P1-P6 LOCATIONS.txt (616 Bytes)

( MACRO MOVE TO P6 RETURN TO LWC )
( PURPOSE: TO MOVE BIT TO ZERO BLOCK Z-ZERO LOCATION )
( PROCESS: SAVE CURRENT WORKSPACE )
( MOVE BIT FIXED WORKSPACE X0Y0 )
( RESTORE CURRENT WORKSPACE )
( EXIT )
( OPERATOR PERFORMS Z-ZERO OPERATION )
( ORIGINAL: CROOKEDWOODTEX 2023-08-25-1 SIENCI FORUM )

(MACRO DEVELOPMENT)
( ABSOLUTE MODE )
( SET INCH MODE )
( SET SPEED OF TRAVEL )
( SAVES WORKSPACE IN LWC)
( SAFE RETRACT )
( SETS WORKSPACE TO P6 G59 )
( GOES TO X0 Y0 IN P6 )
( SETS WORKSPACE BACK TO LWC )
( OPERATOR PERFORMS Z-ZERO OPERATION )
( NEXT OPERATION IS EITHER X0Y0 OR MACRO P5 TO ADJUST Z-ZERO )


G90 ( ABSOLUTE MODE )
G20 ( INCH MODE )
F200 ( SPEED FOR G01 )
( NO COMMENTS ALLOWED ON NEXT LINE )
%LWC=modal.wcs
G53 G01 Z-0.8 ( SAFE RETRACT )
G59 ( SETS WORKSPACE TO P6 G59 )
G01 X0 Y0 ( GOES TO X0 Y0 IN P6 )
[LWC] ( WORKSPACE BACK TO LWC )

MACRO MOVE TO P6 RETURN TO LWC.txt (888 Bytes)

( MACRO ADJUST SAVED WORKSPACE Z-ZERO BY FIXED VARIABLE )
( PURPOSE: TO ADJUST CURRENT Z-ZERO BY THE THICKNESS OF 2xBLUE TAPE + CA GLUE )
( PROCESS: SAVE CURRENT WORKSPACE )
( MOVE BIT OFF TABLE TO FIXED LOCATION WORKSPACE )
( MAKE ADJUSTMENT IN Z-ZERO)
( MOVE BACK TO CURRENT WORKSPACE X0Y0 )
( ORIGINAL: CROOKEDWOODTEX 2023-08-25-1 SIENCI FORUM )

(MACRO DEVELOPMENT)
( ABSOLUTE MODE )
( SET INCH MODE )
( SET SPEED OF TRAVEL )
( SET VARIABLE %TCA TO FIXED AMOUNT )
( SAVE CURRENT WORKSPACE IN LWC)
( SAFE RETRACT )
( SET WORKSPACE TO P5 G58 )
( GO TO X0 Y0 IN G58 WORKSPACE )
( SET WORKSPACE TO LWC WORKSPACE )
( GOTO CURRENT Z-ZERO )
( ADJUST Z-ZERO BY FIXED TAPE_GLUE THICKNESS RELATIVE MODE)
( RESET CURRENT Z-ZERO TO NEW Z-ZERO )
( ABSOLUTE MODE )
( SAFE RETRACT )
( RETURN TO CURRENT XY ZERO )


G90 ( ABSOLUTE MODE )
G20 ( INCH MODE )
F200 ( SPEED FOR G01 )
( SET VARIABLE %TCA TO FIXED AMOUNT )
( NO COMMENTS ALLOWED ON NEXT TWO LINES )
%TCA=0.010 
%LWC=modal.wcs
G53 G01 Z-0.8 ( SAFE RETRACT )
G58 ( SET WORKSPACE TO P5 G58 )
G01 X0Y0 ( GO TO X0 Y0 IN G58 WORKSPACE TO A POINT JUST OFF TABLE FOR BIT CLEARANCE)
[LWC] ( SET WORKSPACE TO LWC WORKSPACE )
G01 Z0 ( GOTO CURRENT Z-ZERO )
G91 G01 Z[TCA] ( RELATIVE MOVE FIXED TAPE_GLUE THICKNESS )
G10 L20 [LWC] Z0 ( RESET TO NEW Z-ZERO IN LWC)
G90 ( ABSOLUTE MODE )
G53 G01 Z-0.8 ( SAFE RETRACT )
G01 X0 Y0 ( RETURN TO CURRENT XY ZERO )

MACRO ADJUST LWC Z-ZERO.txt (1.4 KB)

3 Likes

@CrookedWoodTex Great work, Tex. These are so far beyond me that I can’t provide any educated comments.

One question, just FMI, do these all pre-suppose that the machine they are running on has limit switches?

The only limit switches my machine has are the ones used for homing. If one relies on limit switches, then one doesn’t quite understand the limits of one’s machine.

The key to doing these macros is to map out the coordinates of your Workspaces, and install those coordinates into the initialization macro. That just means to jog to the location and write down/transfer those coordinates. E.g. P1 = X Y; P2 = X Y; etc.

For more understanding, just read the comments and follow along in a gcode listing such as LinuxCNC.

I could go through these line-by-line if that would be instructive. My main reason for posting is to educate and take some of the ignorance out of the CNC. (BTW, the word ignorance is not a bad word.)

@CrookedWoodTex Tks, Tex. I, for one, am not offended by the term ignorance. I am ignorant about a lot of things. I don’t believe that I am stupid, though. :grinning:

I likely used the wrong term in saying “limit switches”. I don’t have switches of any kind on my LM. I asked only so that others would know if the functioning of the macros first required one to home the machine using switches.

M

So, I’m ignorant of a machine that doesn’t have a homing cycle. GSender won’t operate for me until its homed. All the homing cycle is doing is setting up the machine coordinates in Workspace G53. Well, its doing a bit more than that.

1 Like

@CrookedWoodTex Understood :grinning: My machine does not have a homing cycle as I have no switches. That was why I was posing the question - as I’m sure you understand.

1 Like