Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: esawyja on April 02, 2008, 03:58:31 AM
-
Hi all,
I cut polystyrene cornices, but how can I modify the G code so that when it is done, it starts at the beginning of the code again and just repeat. At the moment, I would cut one cornice, then REF ALL HOME and start again, so what I want is as follow
REF ALL HOME
My G-code for the cornice
Goto REF ALL HOME
I know the G code for rewind, but my main problem is the G code for REF ALL HOME. In this way I can start a cut and just keep on doing it till I have enough, or maybe put some kind of counter in the code, so if I want to make 10 cornices, I can set the counter to stop at 10? See the machine at http://www.poly-cor.com see the CNC page
I use AutoCad to design the cornice, export TO DXF, load in DeskCNC to generate the G code and then control themachine with MACH3 (Quantum)
Please help
-
Put this on the last line of your code
This will make the machine home them stop
G28 X0 Y0 Z0 (go to axis home)
M30 (end)
Or
This will make the machine loop for ever or until you select optional stop
M1 (optional stop)
M47 (run from start)
Graham.
-
Hi Graham,
I cannot do G28 X0 Y0 Z0 (go to axis home) as I want to start cutting the next cornice from the point where I stopped as I provision for space between the cornice in the Autocad design, so I guess M1 will then work?
Thanks
Wynand
-
just a thought but you may be able to use g54 - G59 just set the datum for g55 at the same place g 54 left off this would give you 5 cornices before you have to repeat the program.
Graham would this work?
-
You could turn your main program into a sub program and then write a main program using G52 to step the parts along an axis, something like this :-
NOTE you can only have a G54 in the main program.
%
O0001 (MAIN PROGRAM)
G54 G00 G90 G43 X0 Y0 Z0 S1000 M3
M98 P0002 (RUN SUB PROGRAM)
G52 X5. (SHIFT ORIGIN BY 5.)
M98 P0002 (RUN SUB PROGRAM)
G52 X0 (CANCEL SHIFT)
G52 X10. (SHIFT ORIGIN BY 10.)
M98 P0002
etc........
M30
O0002 (SUB PROGRAM)
G00 X... Y...
(ALL YOUR EXISTING PROGRAM)
G00 X... Y...
M99
%
Graham.