![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| G-Code Programing Discuss G-code programing and problems here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
I have some g-code to mill 2 pockets in a box. The final fixture will have 5 of these pocket pairs with a 2.5" Y offset. That way I can mill 5 boxes at a time. Is there a way to have the g-code I already have repeat 4 more times, offseting the Y 2.5" each time? I have attached a zip file containing the g-code and the dxf showing all of the pockets. Thanks Tim |
|
#2
| |||
| |||
| There are several ways to do this but I think the simplest would be to save your existing program as a subroutine and then call it up after changing the "start" position. Your "start" position, or Y offset, can be changed in your program several ways also. You can use G10 to input the offsets, you can use G52 to shift the offsets or you can set the 5 positions with G54-G59 and call a new offset before running the subroutine. You didn't say what machine or control you are using so check your manuals for the proper way to use the G-codes and subroutines. |
|
#3
| |||
| |||
| E-stop Thanks for the reply. I am pretty new to g-code. Could give me a short snippet of code demonstrating one of the methods you suggest? I am using a gantry style cnc router like this one. http://cgi.ebay.com/ws/eBayISAPI.dll...847964271&rd=1 I use CNCZeus to control the router. Thanks Tim |
|
#4
| |||
| |||
| I'm not at all familiar with the CNCZeus control but here's the way I would do it, if your control accepts the G10 command. G10G90L2P2X0Y0 <---Sets G55 to X0 Y0 G10G90L2P3X0Y2.5 <---Sets G56 to X0 Y2.5 G10G90L2P4X0Y5.0 <---Sets G57 to X0 Y5.0 G10G90L2P5X0Y7.5 <---Sets G58 to X0 Y7.5 G10G90L2P6X0Y10. <---Sets G59 to X0 Y10.0 The G10 is a command to load or store the offsets The G90 is for Absolute input. The L2 designates a fixture offset (as opposed to tool offsets or something else) The P# designates which fixture offset. P1=G54, P2=G55, ect. Then the X and Y values are self explanitory. Then for your program you would call the G55 and run the subprogram (which is the G-code program that you already have. When the first part is done then call G56 and run the subprogram again. And repeat. % G0G40G90G17 G10G90L2P2X0Y0 G10G90L2P3X0Y2.5 G10G90L2P4X0Y5.0 G10G90L2P5X0Y7.5 G10G90L2P6X0Y10.0 G0G40G90G55 M98P1234 <<<<<M98 CALLS THE SUBROUTINE; P IS THE PROGRAM NUMBER OF THE SUB. G0G40G90G56 M98P1234 G0G40G90G57 M98P1234 G0G40G90G58 M98P1234 G0G40G90G59 M98P1234 M30 % Something like that. You'll have to check you manuals for the correct usage of offsets and subprograms but that's the basic idea behind it. Hope this helps. Last edited by E-Stop; 10-28-2004 at 06:49 AM. |
|
#7
| |||
| |||
| I am new to G-Code programming too, and I solved this problem using one of the other techniques E-Stop recommended. "Changing the Start Position" I do this a lot with my code. Maybe this would help someone, so here is an example of that: G0 X0 Y0 M98P1000 G0 X0 Y2.5 M98P1000 G0 X0 Y5 M98P1000 G0 X0 Y7.5 M98P1000 Another Possibility would be to put the Y-Offset in the subroutines first line using G91 relative coordinates. (G0 G91 Y2.5) Then you could LOOP the M98 command like this: M98P1000 L5 -- (Where L10 means loop 5 times) |
|
#8
| |||
| |||
| E-stop I tried the code you suggested, but it did not offset the X Y locations. It just repeated the subrouting in the same 0, 0 location. I have not tried Swami suggestion yet. Is there something I need to change in the sub program to get it to use the offsets? Here are the first few lines of my subroutines code: O1234 (Created 8:32:10 AM 10/27/2004 from thum-bl-5fixture-y-rev.dxf) (Post = ISO G-Code - Non Modal) (Tool 1 = .125 End) N0001 T1 M03 S30000 N0003 G00 X3.1125 Y1.3325 Z1.0000 N0005 G00 X3.1125 Y1.3325 Z1.0000 N0007 G01 X3.1125 Y1.3325 Z-0.0600 F20.00 N0009 G01 X3.3375 Y1.3325 Z-0.0600 F15.00 N0011 G01 X3.3375 Y1.7075 Z-0.0600 |
|
#9
| |||
| |||
| Sorry so long answering. I've been out and busy for awhile. Your code for the subroutine looks fine. It's what comes before the subroutine that will change the start position of your pocket. The fixture offsets need to be "loaded" into the G54-G59 fixture offsets and then one of the offsets needs to be "called" before the subroutine is run. When the subroutine is done, call another fixture offset and run the subroutine again. |
|
#10
| |||
| |||
| E-stop I have the code you suggested beform the start of my subroutine(see below). I think it my be a problem with CNCZeus not handling the offsets via code correctly. G10 G90 L2 P2 X0 Y0 (<---Sets G55 to X0 Y0) G10 G90 L2 P3 X0 Y3 (<---Sets G56 to X0 Y3) G10 G90 L2 P4 X0 Y5.5 G10 G90 L2 P5 X0 Y8 G10 G90 L2 P6 X0 Y10.5 G0 G40 G90 G55 M98 P1234 (<<<<<M98 CALLS THE SUBROUTINE P IS THE PROGRAM NUMBER OF THE SUB.) G0 G40 G90 G56 M98 P1234 G0 G40 G90 G57 M98 P1234 G0 G40 G90 G58 M98 P1234 G0 G40 G90 G59 M98 P1234 M30 O1234 (Created 8:32:10 AM 10/27/2004 from thum-bl-5fixture-y-rev.dxf) (Post = ISO G-Code - Non Modal) (Tool 1 = .125 End) N0001 T1 M03 S30000 N0003 G00 X3.1125 Y1.3325 Z1.0100 N0005 G00 X3.1125 Y1.3325 Z1.0100 N0007 G01 X3.1125 Y1.3325 Z-0.0600 F20.00 N0009 G01 X3.3375 Y1.3325 Z-0.0600 F15.00 N0011 G01 X3.3375 Y1.7075 Z-0.0600 N0013 G01 X3.1125 Y1.7075 Z-0.0600 N0015 G01 X3.1125 Y1.3325 Z-0.0600 .....other code N0045 M5 N0045 M99 |
| Sponsored Links |
|
#12
| |||
| |||
| Leave the G90. It may be redundant but it is safe. The G90 inputs an absolute value into the offset, G91 an incremental value. So if for some reason the control was in incremental mode as it reads the G10 lines, those values will be added to the values already in the offset. It is correct that the G90 is not needed to input the offsets with G10, I just always feel safer with it there. Operators have a way of making things happen that aren't supposed to so any additional safegaurds in place are a plus. tpaulson... Do you have an offset page where you can verify that the offsets have loaded correctly? I still can't see any problems with the code itself. Does your control support parametric programming? If so, you could do it with variables. It's not as easy but it works. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| looking for g code 3d from bobcadcam or simmilar for indexer lpt v5 with g code soft | troyswood | Ability Systems - LPT Indexer and G-Code | 2 | 12-24-2006 10:21 PM |
| parametric programming | Karl_T | CamSoft Products | 21 | 05-24-2005 03:58 PM |
| How to set up Tool Offset in MACH2? | High Seas | Mach Software (ArtSoft software) | 7 | 09-09-2004 01:54 PM |
| I need sample G code program | bunalmis | G-Code Programing | 1 | 08-24-2004 04:50 AM |
| Getting The Most Out of CNCzone's Posting Features | CNCadmin | CNCzone.com FAQ | 0 | 03-02-2003 12:08 AM |