![]() | |
| 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
| |||
| |||
Dear All! I am new to g-code programming but not blind I this matter, because I know uncountable languages to make programs (c,php,tp etc.). My question is that, has anybody a good free documentation about making g-code functions (subrutins, labels, do...while or for...next)? I don't know the way in g-code to make a cycle, and increase a variable between each cycle-s for a predefined value. For example, if I want to cut 10mm plastic in 20 cycle, and I want to decrease the Z axe -0.05mm between each cycle (something pseudo like I want): ????????????? [label: SHAPE] Here is the g-code for the shape, included the variable (ZPOS) for Z pos [end label] ZPOS = 0 FOR X=1 TO X=20 ZPOS = ZPOS -0.05 SHAPE NEXT X ????????????? Take a look on this, thanks, Alex |
|
#2
| |||
| |||
| Start by getting manuals. Art has a Hungarian version of his manual that you may find useful. http://www.machsupport.com/documentation.php Have a look at G10 and G52 Just be careful as not all interpreters handle all commands. Paul |
|
#3
| |||
| |||
| Here is a crude example of the specifications of G-code: http://www.cmcsystems.com/techtips_gcodes.html But i wouldnt suggest making G-code by hand because it quickly grow in size and the room for erros is nonexisting because you easily can destroy your machine if there is a sigle error in the file. I make my G-code in RhinoCAM from 3D models of stuff i have made in SolidWorks or Ironcad. The G-code files is usually between 15 KB and 80 MB. I would for sure not want to risk my equipment by making it by hand. I rather make a program that write it if i didnt have any suitable software. |
|
#4
| |||
| |||
(Macros) If you know the old BASIC computer language, you can make your own G-code subroutine using variables. You will need your controller’s programming manual to see what variables and commands are available. If then, dowhile, goto, GT, LT, local variables, system variables the list goes on and on and on. You will need to prove the sub on the machine; yes you can hurt a machine if the code is wrong. Something’s never change such as “garbage in garbage out”. But, on the other side of things a well written, thought out macro for a family of parts or functions on a machine, can save untold amounts of time in programming, and machine operations. Macros can also help the operators interface with the machine, helping them be a better machinist. There are many advantages to macro programming, and macros can have disadvantages. It all depends and what you want to do, and the tools you have available to program with. If you have a big family of parts, where changes could happen across the board in the family a well wrote macro can smoke any cam system. But that macro depending on the family could take over a month to create and prove out. One of the reasons a macro COULD be faster is: On a family of parts; engineering changes a radius on all parts. You have 500 parts in the family, which means 500 programs to look at. Or change one macro. A good source of info is Mike Lynch at CNC concepts he has a web site. Search for it. |
|
#5
| |||
| |||
|
| Sponsored Links |
|
#6
| |||
| |||
| Ol geezer has it right - your machine tool programming manual should have information in it regarding macro programming, if your machine tool supports it. It will also tell you which specific variables control the different functions of the machine. Many older machine tools don't support macro programming, or the option wasn't turned on. Once upon a time, I ran two machines with FANUC 18i controllers, one accepted macro programs, and the other one didn't. However, most newer controllers / machines will allow you to program them. Macro programming is fairly simplistic compared to the more robust languages (C, php, etc), but is very similar to BASIC, as was mentioned earlier. I am no expert at macro programming, but the way I would write up your little example is: (SHAPE) (HERE IS THE G-CODE FOR THE SHAPE) (VARIABLE #501 IS THE DEPTH PER PASS) (VARIABLE #502 IS THE MAXIMUM DEPTH) (VARIABLE #503 IS THE START DEPTH) #501=.02 #502=-1. #503=0 WHILE [#503 GT #502] DO1 #503=#503-#501 IF [#503 LE #502] GOTO20 N10 G01 Z[#501] F10. GOTO30 N20 #503=#502 GOTO10 N30 G01 X... Y... (SHAPE SECTION) END1 In this program, it will step down .020 at a time (#501) and run the defined shape, until it gets to the predefined depth (#502). It is important to end the shape by bringing the machine back to where you started before you end the loop (END1). You can nest other loops in, and I'm pretty sure you can call subprograms as well (M98). There is A LOT of things you can do with macros, especially when combined with subprograms, and it is a powerful programming tool. Unfortunately, most of the machinists and operators I know don't even know these things exist, let alone be able to understand them or edit them. When I write programs for the shop utilizing macros, my guys get angry and frustrated with me, so I usually reserve them for when I'm going to run the job myself (very rarely). I feel it would be better if they took a little time to learn this stuff, but for some reason, they just don't want to put forth the effort. Too bad :-(. |
|
#7
| |||
| |||
|
kidding about what??? s_volenszki, There is a few different ways that you can set this up to keep picking away at a part. I will just do something like moving across the top of a part starting at 0 and moving 5” in the X. It will keep going deeper on each pass based on the variables you set up. #1=0(Z-START) #2=1.(FINAL DEPTH) #3=.05(PICK SIZE) G0X0Y0Z#1 WHILE[#1LT#2]DO1 #1=#1+#3 IF[#1GE#2]THEN#1=#2 G0Z-#1 G1X5.F50 G0Z.1 X0 END1 M30 This can also be done by using IF and GOTO statements. Good luck, Stevo |
|
#8
| |||
| |||
| Phyrexii, Sorry I didn't see you post. I started typing earlier and then got pulled away and didn't bother to refresh. I have a lot of guys that dont' like the macros. I also have quite a few that do. My last place was 100% macros on our lathes and machining centers. The way that I have been getting through to some of the guys here is to prove out a macro for bolt circle drillng as an example then lock it in the higher program numbers. I gave them a list that says A=# of holes, B=angle to start, C=final depth ect. They didn't like it at first because they didn't understand the macro. I explained to them they did not need to understand the macro. They only needed to know what A,B,C was. Once they knew it wont' mess up they started taking the time to watch the code and learn. We never locked are macros at my last place because everyone knew them in and out. I still lock them here but they are picking them up pretty quick. I actually get yelled at by them when they dont' have a macro for a part .Stevo |
|
#10
| |||
| |||
| This is exactly what I was looking for! I thought that this will be complicated, but this isn't! I have program to make g-code form vector files or cad solids, but I want to understand what to do and why! Thanks for every comment, I start to discover the making of g-code macros! Alex |
| Sponsored Links |
|
#11
| |||
| |||
DEAR ALEX WHY ARE YOU WORRIED G CODE? WE HAVE A SOFTWARE MADE BY CADEM(BANGLORE) IN INDIA WHICH MAKES YOUR PROGRAM ON WINDOWS XP COMPUTER & YOU CAN DOWNLOAD THE PROGRAM TO MACHINE THROUGH RS232 PORT OR BY USB PORT OR WIRELSS. WITH THIS SOFTWARE YOU CAN RUN SIMULATION ON YOUR PC. IF INTERESTED PL.EMAIL ON THE FOLLOWING ADDRESS THANKING YOU WITH BEST REGARDS PRADEEP R. KHARE prkhare@hotmail.com
|
|
#12
| |||
| |||
Dear Pradee! As I wrote I am new in g-code and also new in cnc machining. A few days ago I have finished my first hobbc CNC mill and now I want to know the main g-code rules. Based on the posts, what I have got, I wrote a little text file phrasing and replacing routin in php, and now I load a plt file generated from CorelDraw, I input the tool diamaeter, the cutting depth, the cutting speed, and any other compenzation values, and It is outputs the necessary g-code. Now it is, what I wanted, anyway if I will start to do cnc machining for business, I will contact you or any other software maker. Till than I take a look on http://www.cadem.com! Thank you for your attention, Alex. |
![]() |
| 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 |
| Newbie - To build or not to build Router/Plasma Table | dfranks | CNC Plasma and Waterjet Machines | 10 | 04-07-2011 11:16 PM |
| New Large Table Build in Houston, TX (Build Log) | anitel | Plasma, EDM and other similar machine Project Log | 12 | 12-30-2008 02:45 AM |
| M Code in Canned Cycle Question | banausicjosh | Fanuc | 2 | 08-27-2008 03:03 PM |
| 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 09:21 PM |