Hello Guest it is April 25, 2019, 08:29:44 PM

Author Topic: Help with G-code  (Read 3629 times)

0 Members and 1 Guest are viewing this topic.

Help with G-code
« 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
« Last Edit: April 02, 2008, 04:00:14 AM by esawyja »

Offline Graham Waterworth

*
  • *
  •  1,851 1,851
  • West Yorkshire, England
    • View Profile
Re: Help with G-code
« Reply #1 on: April 02, 2008, 04:48:54 AM »
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.
« Last Edit: April 02, 2008, 04:53:54 AM by Graham Waterworth »
America gave us powered flight, England the steam train and Germany the car.  Who invented the first boat?
Re: Help with G-code
« Reply #2 on: April 02, 2008, 07:50:23 AM »
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
Re: Help with G-code
« Reply #3 on: April 09, 2008, 07:41:51 AM »
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?

Offline Graham Waterworth

*
  • *
  •  1,851 1,851
  • West Yorkshire, England
    • View Profile
Re: Help with G-code
« Reply #4 on: April 09, 2008, 12:42:09 PM »
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.
America gave us powered flight, England the steam train and Germany the car.  Who invented the first boat?