translating other g-code formats to ngc

More
08 Jul 2013 11:02 #36390 by Nenad
I found that people have problems converting g-codes to ngc format. Those who answer in the forums say: "change the txt to "ngc and it will work" or "it's just a text file tha linux cnc will read. It's not that simple, I tried and it just doesn't work.

I am trying to understand what linux cnc looks for in the g-code file so I won't have this problem in the future.

I was wondering what changes do I need to make to this 4-axis g-code (besides giving it "ngc" extension) to make it work with linux cnc:

%
N1 G00 G17 G90
N2 G40 G49 G80
N3 G70
N4 S5000 M3
N5 G01 X1.6307 Y0. F5.9
N6 Z0.084
N7 A0. F5.9
N8 Z-0.1969 A0.
N9 X1.6484 A-360. F7.9
N10 X1.6662 A0.
N11 X1.6839 A-360.
N12 X1.7016 A0.
N13 X1.7193 A-360.
....
....
....
N1703 Z-0.4398 A-151.
N1704 Z-0.4375 A-112.5
N1705 Z-0.4373 A-74.3
N1706 Z-0.4394 A-38.1
N1707 Z-0.4426 A0.
N1708 Z0.084 A0. F5.9
N1709 M30
%

Hope someone can explain it to me.
Thanks

Please Log in or Create an account to join the conversation.

More
08 Jul 2013 13:31 #36391 by cncbasher
you need to look and learn gcode , in the majority of cases it is all the same .. however every vendor can have there own quirks , this is where when gcode if produced , a Postprocessor
comes in , there are tutorials in the documentation section , and all over the internet , a good book to obtain is CNC Programming Handbook by Peter Smid ,
understanding each gcode is the key to good programming , either to understand what a cam program has produced , or to hand edit previous code done for another machine

Also another good tutorial gnipsel.com/linuxcnc/g-code/index.html

but to look at your example and tear it apart line by line

% is realy just a start and end marker , mostly used on older machines so not needed but does no harm
N1 etc is line numbering , linuxcnc does not use line numbers so they can go
now comes an initialisation sequence G00 G17 G90 G40 G49
specific gcodes such as G80 and G70 are profile and finishing cycle commands which may or may not be understood by linuxcnc

other commands S = Spindle F = feedrate M3 = start M30 = end program
so you should now be able to split up and understand the code better , the majority are universal across all , but others are specific to the machine it's coded for , so splitting up has shown that discounting some has left you with 2 G80 and G70 which are specific to which machine this has been produced for , so you may either delete them or change to suit

a quick look here linuxcnc.org/docs/html/gcode.html
shows that G80 and G70 are not supported ..

this is just a brief outline , there are many other parts to your learning curve , but all are not difficult to understand , once you start to break it down

gcode is mostly transferable across machines , but every manufacturer has it's own tweaks , but most code produced can be hand edited
with care and understanding , but never think that code can just be ran blind always test for the unexpected first with a dry run ,,

linuxcnc is based on Fanuc code which is mostly universal so your chances of success are greater
it's when you get into machine specifics of things as loops and finishing or threading cycle shortcuts etc you will be most vunerable to making mistakes .

Please Log in or Create an account to join the conversation.

More
08 Jul 2013 18:55 - 08 Jul 2013 18:56 #36395 by andypugh

was wondering what changes do I need to make to this 4-axis g-code (besides giving it "ngc" extension) to make it work with linux cnc

The LinuxCNC G-code is documented here: www.linuxcnc.org/docs/html/gcode.html
% ; program start, can stay
N1 G00 G17 G90 ; Line numbers (N) are ignored by LCNC. Set rapid mode XY plane absolute pos.
N2 G40 G49 G80; Turn off dia compensation, turn off tool length comp, end canned cycles
N3 G70 ; The first problem, LinuxCNC doesn't understand G70. The code might still work.
N4 S5000 M3 ; 5000 rpm, start spindle.
N5 G01 X1.6307 Y0. F5.9 ; Move to the X pos at 5.9 units/min
N6 Z0.084
N7 A0. F5.9
N8 Z-0.1969 A0.
; Lots of moves, all should work fine.
N1709 M30 ; program end.
% ; file end marker (net necessary).

So, the only command that isn't part of the LinuxCNC command set is the G70, which is probably just turning off a roughing cycle, in case one is still active.
comment out that line (brackets) or ; semicolon and it should just run. (you don't actually need to change the file extension, even)
Last edit: 08 Jul 2013 18:56 by andypugh.
The following user(s) said Thank You: Nenad

Please Log in or Create an account to join the conversation.

More
09 Jul 2013 01:28 #36413 by Nenad
Thank you very much! This is exactly the kind of answer I was looking for. I put the semicolon before N3 line and changed the txt extension to ngc. Looks like it will work fine.

Please Log in or Create an account to join the conversation.

Time to create page: 0.077 seconds
Powered by Kunena Forum