585,687 active members*
4,355 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > G-Code Programing > Can someone help me write my first program?
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2020
    Posts
    0

    Can someone help me write my first program?

    Sorry if this is wrong place to ask this. Im am new here.

    Ive been studying gcode for a while and im about to write my first program. What I need to do is mill a half inch slot in 4 seperate places. The material is quarter inch thick. I was thinking .010 to .020 deep per pass. What I need help with is condensing the code. Is there a way to condense each pass for milling the slot or do I have to write out each pass? Also how do I condense the code for the other three slots? Since its the same pattern can I use a subprogram or subroutine to make the code shorter? How would I do this? Thanks

  2. #2
    Join Date
    Dec 2013
    Posts
    5717

    Re: Can someone help me write my first program?

    Yes, you can use nested loops See L and G91 codes. (Loop and Incremental positioning) One loop for the slot start positions, and then run the inside loop to actually cut the slot. Or use G90 to position the slot starts and then use G91 to actually cut the slot using the loop
    Jim Dawson
    Sandy, Oregon, USA

  3. #3
    Join Date
    Sep 2018
    Posts
    27

    Re: Can someone help me write my first program?

    Quote Originally Posted by Jmac2595 View Post
    Sorry if this is wrong place to ask this. Im am new here.

    Ive been studying gcode for a while and im about to write my first program. What I need to do is mill a half inch slot in 4 seperate places. The material is quarter inch thick. I was thinking .010 to .020 deep per pass. What I need help with is condensing the code. Is there a way to condense each pass for milling the slot or do I have to write out each pass? Also how do I condense the code for the other three slots? Since its the same pattern can I use a subprogram or subroutine to make the code shorter? How would I do this? Thanks
    You can Write the commands with correct incremental positions in a sub and then call it where you need, it goes like that :

    G0 X50 Y50 Z0.5 (PREPOSITIONING 1)
    M98 P1234 (CALL SLOT SUBPGM)
    G0 X100 Y50 Z0.5 (PREPOSITIONING 2)
    M98 P1234 (CALL SLOT SUBPGM)
    G0 X150 Y50 Z0.5 (PREPOSITIONING 3)
    M98 P1234 (CALL SLOT SUBPGM)

    O1234 (START SUB)
    G91 (INCREMENTAL)
    G1 Z-0.2 (GO TO FIRST PASS DEPTH)
    Y20 (TRAVERSE)
    Z-0.2 (GO TO SECOND PASS DEPTH)
    Y-20 (TRAVERSE)
    Z-0.1 (GO TO FINISH PASS DEPTH)
    Y20 (TRAVERSE)
    G90 (ABSOLUTE)
    G0 Z0.5 (GO TO RETRACTION)
    M99 (END SUB)

    More complex but more flexible, you can write a macro and call it where you need with the correct inputs parameters, goes like this in B-macro :

    G65 P1234 A-0.5 B6 I50 J50 X100 Y50 (CALL MACRO POSITION 1)
    G65 P1234 A-0.5 B6 I50 J50 X120 Y60 (CALL MACRO POSITION 2)
    G65 P1234 A-0.5 B6 I50 J50 X140 Y70 (CALL MACRO POSITION 3)

    O1234 (START MACRO)
    (#1 A PASS DEPTH)
    (#2 B NB OF PASS)
    (#4 I X TRAVERSE)
    (#5 J Y TRAVERSE)
    (#6 K Z APPROACH)
    (#24 X POS X)
    (#25 Y POS Y)

    G0 X#24 Y#25 Z#6 (PREPOSITIONING)
    G91 (INCREMENTAL)
    #10=1 (-1 OR 1 FOR GO AND BACK PASS)
    #11=#1-#6 (NEXT INCREMENTAL Z POSITION)
    #12=1 (COUNTER FOR NUMBER OF PASS)
    WHILE [#12 LE #2] DO1 (LOOP ON COUNTER)
    G1 Z#11 (GO TO PASS DEPTH)
    X[#10*#4] Y[#10*#5] (TRAVERSE)
    #10=-1*#10
    #11=#1
    #12=#12+1
    END1 (END LOOP)
    G90 (ABSOLUTE)
    G0 Z#6 (RETARCTION)
    M99 (END MACRO)

Similar Threads

  1. PMC write with NC Program
    By yaji63 in forum Fanuc
    Replies: 8
    Last Post: 03-01-2020, 05:53 PM
  2. Looking for someone to write a program
    By FitzgeraldPaint in forum PhotoVCarve and VCarve Pro
    Replies: 1
    Last Post: 03-11-2019, 01:43 PM
  3. Okuma will not write program
    By 60sMoparGuy in forum Okuma
    Replies: 4
    Last Post: 01-12-2014, 06:24 PM
  4. Write program
    By mike sr1 in forum Tormach Personal CNC Mill
    Replies: 10
    Last Post: 02-11-2012, 11:17 PM
  5. someone wanna write a program?
    By ljoe1969 in forum DIY CNC Router Table Machines
    Replies: 2
    Last Post: 06-07-2004, 01:47 AM

Tags for this Thread

Posting Permissions

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