Hi everyone, I am looking for advise on how to go about programming some files to make them easy to change at the machine. My parts typically have 1-4 holes in them and a slot (this is extremely simplified, but will serve well for the example). Each piece is usually custom so I end up having to make a separate file for, 1 hole and a slot, 3 holes and a slot, 2 holes and no slot, etc... This gets tedious when you have 30+ similar parts that all need multiple configurations. I could program a file for exery permutation, but would love to have a single file capable of making any configuration of that part.
Essentially, I would like to be able to have a provision to individually enable/disable hole 1, hole 2, 3, 4 and the slot. I was originally planning on using GOTO or IF/THEN statements in the G Code, but then found out Mach3 cant do that.
I was thinking I could set variables at the start of the code that I can edit to be 1 or 0 (on/off). Then write a macro that calls a variable, checks if true or false and enables/disables block delete to turn off the next bit of code. I would run the macro before each hole or slot.
Here is a basic eaxmple of that:
#120=1 (hole 1 toggle)
#121=0 (hole 2 toggle)
#122=1 (slot toggle)
(Cut Profile)
... gcode...
... more gcode...
(DRILL HOLE 1)
#200=#120 (set blockskip toggle for next subprogram call)
M26 (call blockskip macro)
/ G0 X1.5 Y2. (move to hole location)
/ G1 Z0.
/ G2 I-.25
/ G1 Z1.
(DRILL HOLE 2)
#200=#121 (set blockskip toggle for next subprogram call)
M26 (call blockskip macro)
/ G0 X1.5 Y3. (move to hole location)
/ G1 Z0.
/ G2 I-.25
/ G1 Z1.
(CUT SLOT)
#200=#122 (set blockskip toggle for next subprogram call)
M26 (call blockskip macro)
/ G0 X.5 Y1. (move to location)
/ G98 (slot.nc)
M30
Corresponding Macro:
trigger = GetVar (200) 'block skip enable disable variable
IF [trigger = 1] then turn off blockskip <-- I know this is not the right command... have not figured it out yet.
End IF
I tested this out this morning (well not the macro, only the code by manually toggling Block Delete at M0 stops) and found out that I cant enable/disable block
skip delete in the middle of a file. It can only be toggled before you start running the code. So this method seems like it wont work like i had hoped.
Does anyone have any other ideas on how to individually toggle or skip past different portions of the code in a way that is easily modifiable from the machine? In the above example, I used holes and slots, but the portion I want to toggle could just as easily be a chamfer or a 3d contour.
Maybe I need to go a totally different route, but I am running out of ideas... Any suggestions would be greatly appreciated.Regards,
rbjem
Please note that I am not a gcode expert by any means, I know just enough to be dangerous.