586,116 active members*
3,421 visitors online*
Register for free
Login
IndustryArena Forum > CAM Software > Uncategorised CAM Discussion > G code to repeat the same part over X a few times
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2009
    Posts
    123

    G code to repeat the same part over X a few times

    I need an example of G code that allows me to repeat the same part but shifting coordinate system over X so that I can use the same subroutine that cuts the part.

    Example of pseudo code I have in mind;

    ( -- Init --- )
    G00 G49 G40.1 G17 G80 G50 G90
    G20

    (--- Set coord system to 0,0 ---)
    G??? X0 Y0

    (--- execute part cutting ---)
    M98 P0002 L1

    (--- Set/Shift coord system to 2.7,0 ---)
    G??? X2.7 Y0

    (--- execute part cutting ---)
    M98 P0002 L1


    (--- Set/Shift coord system to 5.4,0 ---)
    G??? X5.4 Y0

    (--- execute part cutting ---)
    M98 P0002 L1


    (-- Reset coord system back to 0,0 --)
    G?? X0 Y0


    M5
    M9
    M30 (-- end of program/rewind -- )

    (-- Cutting Subroutine here --)
    O0002

    G0 ...
    G1 ...
    G0 ...
    G1 ...

    (-- Return from sub --)
    M99



    --------------------------------------------------------

    Please help me out with ??? commands. What am I missing here? G52 doesn't seem to work.

  2. #2
    Join Date
    Oct 2005
    Posts
    328
    I'm no expert in programming, so this may not be the right way, but I used a G92 to define a new work offset. I haven't mastered the use of subroutines yet. I understand what they do, but implementing them isn't part of my skillset yet.

    N100 G54 G0 X2.201 Y1.140
    N110 G1 moves...
    N120 G0 X0 Y2.517

    N190 G92 X0 Y-0.35
    N200 G54 G0 X2.201 Y1.140
    ...


    Dave

  3. #3
    There are always more than one way to do it, but to make it simple I would suggest:

    Program your subroutine in G91 ( incremental) as in:

    N002 G91 G1 X2.3 Y 0 Z-.1 F2. (Beguining of a rectangular 2.3 x 3.2 profile milling)
    N003 Y3.2
    N004 X-2.3
    N005 Y-3.2 (Back to start point)
    N006 M99 (Return)

    ( -- Init --- )
    G00 G49 G40.1 G17 G80 G50 G90
    G20

    (--- Set initial coord to 0,0 ---)
    G55 X0 Y0

    (--- execute part cutting ---)
    M98 P0002 L1

    (--- Set coord to 2.7,0 ---)
    G90 G55 X2.7 Y0
    M98 P0002 L1
    G90 G55 X5.4 Y0 ( set coord to 5.4,0 )
    M98 P0002 L1
    G90 G55 X8.1 Y0
    M98 P0002 L1
    and so on...
    And also You can use variables to set the incremental values of X and Y.
    Or program the whole thing in G91
    Mario

Similar Threads

  1. G-code step-and-repeat
    By MechanoMan in forum MetalWork Discussion
    Replies: 6
    Last Post: 05-21-2012, 12:45 AM
  2. G-Code repeat cycle
    By Me2 in forum G-Code Programing
    Replies: 4
    Last Post: 11-02-2011, 01:22 AM
  3. Repeat G-Code
    By thomasz in forum Fadal
    Replies: 10
    Last Post: 10-01-2011, 12:30 PM
  4. whole G-Code REPEAT command ??
    By LockTech in forum G-Code Programing
    Replies: 14
    Last Post: 08-08-2010, 04:21 PM
  5. Small Part Repeat work
    By millman52 in forum Employment Opportunity
    Replies: 19
    Last Post: 11-06-2009, 12:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •