Is there a character that can be placed at the beginning of a line of code that will cause that line to be ignored/skipped?
I currently have four programs to route essentially the same piece. I need different versions because, depending on the methods of joinery and manufacture, certain paths are sometimes added or omitted. If I had a way to make the machine ignore certain lines, I would only need one program to produce these four slightly different products.
From contributor C:
Yes, there should be a character that causes a line to be ignored. For instance, Biesse uses the semi colon ; character. Check your programming manual - I believe this will be different for each machine code.
1) For ISO/EIA Standard G Code CNC controls, the "/" character indicates a Block Skip command.
Not all CNC controls support block skip. On Fanuc compatible controls, this character can be placed anywhere within a line of code for specific results.
2) Another method is to modify the line so that the CNC control treats it as a man readable comment rather than a line of code to be executed.
For ISO/EIA Standard G Code CNC controls, placing characters between parentheses "()" indicates a man-readable comment. Other controls use the semi-colon ";" Consult you CNC control manual for the proper method for your control.
By eliminating a line or two you may also have to add a line or two depending on what the router is doing at the time, such as rapid moves, Z height moves, etc. The use of computer programs to generate the g code for you was to help speed things up and to help eliminate errors. Sounds to me you're taking a step backwards.
First, for each machine operation or path, create label with . (dot) instruction in front of each operation/path, for example .TOEKICK .HOLE .DADO, etc.
At the end of those operations put GOTO END and at the end of the program create label .END
Now, at the begin of the program use GOTO instruction and in the next field type the name of the operation you want to do. Example: GOTO TOEKICK.
Program execution is going to look like this: Computer reads first line and jumps to the label you specified with GOTO instruction, machine executes code until GOTO END and jumps to .END label, end of program. If you need two or three operations, just type that operation's name/label in the GOTO field instead .END. Example:
Your control might have different vocabulary, but the logic is the same, and I see where you could use this if, for example, you have long programs and it is time consuming to delete all the lines of code you don't need and copy all the programs, etc.
Find out if your controller accepts commands such as the GOTO statement and the always important IF THEN. I'd then set that same program up with 2-5 lines at the beginning that look something like this:
VARA=1 (toe kick 1=yes 0=no)
VARB=0 (shelfpin holes 1=yes 0=no)
VARC=1 (back dado 1=yes 0=no)
Once your code is written for all your cut paths/operations, you can have the machine skip what you don't want by adding IF THEN's something like:
IF VARA=0 GOTO X Line
*toe kick cut path*
(if the operator switches VARA to 1 you get a toe kick)
That's a basic explanation, but I hope you get the idea. Again, this depends if your controller will support that style of programming (I think most do).
Now your operator can edit only a few values at the start and the body of the program remains unaltered, which minimizes the risk of errors mentioned earlier.
This is also an extremely powerful tool once you learn it for things like circles, simple shapes, machining operations.
We have a tiny memory in our controller (FANUC), but we keep at all times programs like:
Guys on the bench love it because they can ask the operator to quickly cut a shape or make a cutout in 30 seconds with a few numbers. They don't have to bug the programmer (me) and wait for when I have time. Very powerful tool. You can really do some pretty sophisticated parts this way if you have the patience to write the code. Sometimes a little hard to debug at first, but once they work, it's very satisfying. Obviously more sophisticated programs don't just use 0 and 1 for yes or no, but can actually be values for length and widths, etc. You could also make the program perform a certain operation series by entering only 1 variable equal to say 1 through 4 (personally I never liked that method, but it does work).
#120=100 (DIST FROM RIGHT STOP)
#121=130 (FRONT STOP TO FIRST ROW)
#122=400 (FRONT STOP TO SECOND ROW)
#123=15 (NUMBER OF HOLES)
G17 G90 G21 G40 G80
'(OP 1 DRILL HOLES TOOL 6100000 T6 100000)
'(TOOL DIAMETER 7, HOLE DIAMETERS 7)
G91 G28 Z0
N1 (LINE BORING - TOP ROW OF DRILLS)
(USING DRILL 1)
G90 G0 G55 X-[#120+111] Y-[1489-#121] Z75.
G98 G81 Z5. R30. F2000.
IF [#130EQ#133] GOTO 5
N5 G17 G91 G28 M95
G91 G28 Z0
G28 X0 Y0
(Worthy of noting that on this FANUC controller anything in () is just an operator note and is ignored as well as lines that begin with the ' symbol.)
It gets fun when you realize you can make ten programs into one or a thousand line program into a 40 line program. We are limited to eight characters in our program names. I think I've come to the mathematical limited number of programs (and imagination).
N5 (PROGRAM#: 2081)
N10 (PROGRAMMED BY:)
N15 (CREATED ON 02/25/04 AT 14:02:46)
N20 (ROUTER SPINDLE #3 12.7 DN 38 LONG)
N25 M98 P8000 (START)
N30 G52 Z19.0
N35 M98 P8201 (Y TABLE)
N55 M98 P8104 (DRILL)
N60 G0 G90 X-713.0 Y-1114.0
N70 G1 X-713.0 Y-1114.0 Z-19.5 F5000.0
N75 G0 X-713.0 Y-1114.0 Z25.0
N80 G0 X-713.0 Y-1464.0 Z25.0
N85 G1 X-713.0 Y-1464.0 Z-19.5 F5000.0
N90 G0 X-713.0 Y-1464.0 Z25.0
G0 X-2500 Y-250
N125 (CONTOUR: 20040225.14014753)
N135 M98 P8101 (ROUTER#3)
N145 G0 X-586.57 Y-1323.96 Z25.0
N150 G1 X-586.57 Y-1323.96 Z6.0 F4500.0
You could put the GOTO in anywhere. And you could use more than one in a program.
I agree about the power of using variables. I created a passage door hinge mortising program that has variables for the size of door, size of hinge, including thickness of the leaves, and also variables for the placement of the hinges based off of the distance from the top and bottom of the door, and the number of hinges. One program, many combinations. The operator just needs to enter in the variables.
I'll give you an example. At the university we had Weeke PTP with nice boring operation that references middle position of the row of holes. If you had 7 holes, number 4 would be position you need to input. This is helpful if you want to have row of adjustable shelf holes centered between two dados or just centered on the panel so there is same distance from the lower hole to the edge and same for the opposite side.
I don't have that option for Morbidelli machines - at least I could not find one. So I have created something like this:
H DX=0 DY=0 DZ=0 C=0 T=0 R=1 *MM /"3z,ZAHDJYGINxy,185,cyc.msg"
;Created by Mirko M.
PAR pY "Y Coordinate"
PAR pZ "Boring Depth"
PAR pH "Number of Holes"
PAR pD "Diameter"
PAR pJ "Second Reference Point"
PAR pG "Steps Number"
PAR pI "First Reference Point"
PAR pN "Boring Bit Type"
PAR px "X step"
PAR py "Y step"
PAR pA "Angle"
L FIRST =pI
L SECOND =pJ
L LX =SECOND-FIRST
L HX =pH
L POLA =LX/2
L XRAZ =px
L B =((HX-1)*XRAZ)/2
L BOR =((LX/2)-B)+FIRST
BO X=BOR Y=pY Z=pZ D=pD N=pN R=HX x=px y=py G=pG V=pV L=pL
The last line of code is actual execution of code. When I run this macro all I have to do is input positions of my upper and lower reference points and how many holes I want between those.
H DX=800 DY=415 DZ=22 -AB C=0 T=0 R=1 *MM /"DEF"
MIRBOR Y=38.1 Z=10.5 H=7 I=100 J=700 x=64 y=0 D=6.35 N="P"
Row of 7 holes is going to be centered between I=100 and J=700.
Little math at the begin saves a lot of math down the road.
P.S. If some of you Xilog users want to use this, you can. You might have to modify your CYC.msg file after you compile this macro because I have added a couple of lines of code in mine.
Contributor J, you should contact AlphaCAM about getting the VBA for AlphaCAM training materials. They are a wealth of information. You can also use the AlphaCAM API help file. AlphaCAM doesn't support the legacy parametric macros any longer, so if you are going that route now, you'd be wise to reconsider. Some things will simply be impossible to do with AlphaCAM's old parametric macro language. It's only left in the product for limited legacy use.