![]() | |
| 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
| |||
| |||
| Hello everyone! I am an undergraduate student who just got into a research laboratory with a professor. My task is to program our laser (which functions with G code) to make fairly simple designs, but a lot of them. I need to find a way to run a simple loop where I can designate the start point (probably absolute coordinates), allow it to run maybe 20-30 times, making a simple design (in a horizontal x direction) and then return to the start position, only an increased y amount upwards, so I may begin another row. I think I have the other parts down, I just need a way to run the loop a specified number of times without having to program the same code 100000 times and I am not very familiar with G code. Thank you all very much! |
|
#2
| |||
| |||
| https://docs.google.com/viewer?a=v&p...Z3RMN&hl=en_US This is the manual for controlling the stage. I am afraid there might be limiting factor because of what G codes it allows. Please let me know. Thank you very much. |
|
#3
| ||||
| ||||
| You need something called Nesting S/W, this takes a single part/shape and nests it efficiently on a certain material sheet size, it will also rotate parts in order to reduce waste. Al.
__________________ CNC, Mechatronics Integration and Machine Design. “Logic will get you from A to B. Imagination will take you everywhere.” Albert E. |
|
#4
| |||
| |||
1. Write the code for your simple design in Incremental 2. Main program has the call of the ROW logic Go to the Absolute position of the starts of the first component offset in X and Y by the X and Y pitch of the individual parts Lets say that the pitch of the start of each part in X and Y is 50mm and 100mm respectively, and that the start point of the first part is X0.0 Y0.0, then: G90 G00 X-50.0 Y-100.0 (G90 is Absolute Mode G code) M98 P1000 L10 where: M98 is the Sub program call command P1000 is the Sub program number L is the number of ROW repeats of your design Sub program 1000 logic follows O1000 G90 X-50.0 (Absolute start position of the first column of each row, minus the pitch of the columns) G91 G00 Y100.0 (incremental pitch of rows) M98 P2000 L50 M99 where: M98 is the Sub program call command P2000 is the Sub program number L is the number of COLUMN repeats of your design Sub program 2000 logic follows O2000 G91 G00 X50.0 (incremental pitch of columns) code for design goes here, all written in incremental moves. ........ ........ ........ ........ ........ ........ M99 3. The program works by the head of the machine starting at a position offset by the pitch of the part in X and Y in the main program. 4. A Sub Program is called from the main program to repeat a number of times equal to the number of rows to be cut. 5. Program control is transferred to the Sub called in the main program (O1000) and repeats it L times (number of Rows) 6. The first line of Sub O1000 will make no move when control is first transferred from the main program because the head has already been positioned there in the main program. 7. The second line will move incrementally in Y the pitch of the Rows and will now be in the correct Y start position for the design. 8. The NESTED program O2000 is called and repeated L times (number of columns of parts). Control stays with O2000 until it has completed L number of repeats. 9. The first line of O2000 moves incrementally in X the pitch of Columns and will be in the correct X start position of the design. 10. O2000 will repeat the process of moving X pitch of the design and then running the shape of the design L number of times. 11. Control then returns to O1000, where the head of the machine is returned to the Absolute X start position for the next Row and calls O2000 again. This process repeats until O1000 has repeated its L number of times. 12. After O1000 has repeated L number of times, control is passed back to the main program. The above logic works if the Start and End point of each design component is the same Absolute point. You will have to manipulate the Absolute coordinates and the Row/Column pitch moves if the the Start and End point of each design component is not the same Absolute point; but the general logic will work. The above is not as difficult as it may appear in written form. It results in the code for the shape of the design only being written once and its start position being changed and controlled by two Sub programs. There are other ways of achieving what you want by using User Macro techniques, or using work coordinate shifts. However, not knowing the type of control you have, the above method will work on just about any control. You will have to look in your programming manual of your machine's control to get the correct syntax for Subs and nesting Subs. Regards, Bill Last edited by angelw; 07-09-2011 at 07:53 AM. |
|
#5
| |||
| |||
| Thank you very much for the replies, I've researched the nesting/G98/99 and I think I understand it. Unfortunately we are having a more fundamental problem with controlling the stage. I am going to call the programmer tomorrow but I thought I'd ask on here first because it might be a simple problem solvable by someone with a little experience. So we are trying to operate in relative coordinates (G91) while also using linear motion (G01) instead of (G00). For some reason, even if I include the G91 code, once I also include G01, the entire code changes to absolute coordinates, even if everything is help constant and this is the only change in the entire code. Its my understanding that you can program G01 and G91 at the same time. If I do not include G01 then it will move in G00 mode with relative coordinates but the diagonal motions will come out in a hockey stick looking manner. Please advise if you have any advice. I am afraid there is something wrong with the program. |
| Sponsored Links |
|
#7
| ||||
| ||||
| Al.
__________________ CNC, Mechatronics Integration and Machine Design. “Logic will get you from A to B. Imagination will take you everywhere.” Albert E. |
|
#8
| |||
| |||
Ok, your last post is as mentioned in conflict with Standard ISO G-codes G90 and G91 is NOT related to G00, G01 If G01 takes your machine out of relative coordinate mode then there is a break of standard. Only G90 is intended to switch the controller to absolute coordinate mode. G01 is as mentioned used in linear work mode and G00 is NOT used for anything else than rapid movements WITH NO machining of any sort taking place. That i I believe, the standard. OF course anyone can create an G-code interpreter who treats the G-codes differently and they do... If that is true in your case only You can tell us. Check it up again! / Roger |
![]() |
| Tags |
| g code |
| 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 |
| Need (hopefully simple)G code Help | inventor30 | General CNC (Mill and Lathe) Control Software (NC) | 2 | 11-12-2010 05:32 AM |
| Is it possible to loop a g-code program? | sul1 | G-Code Programing | 4 | 04-03-2009 02:49 PM |
| Need help with simple G code | Step by Step | Coding | 2 | 10-24-2008 08:49 PM |
| Need Help!- Simple loop program for mazak | katsbobo | Mazak, Mitsubishi, Mazatrol | 3 | 04-07-2008 06:11 PM |
| simple start up code needed | jrick | CNCzone Club House | 0 | 02-08-2007 12:05 AM |