Inches and/or mm

More
13 May 2014 00:27 #46844 by krlynn
Inches and/or mm was created by krlynn
First, I'm coming into this with virtually no knowledge of cnc or lathes. I picked up an unmodified EMCO Compact 5 PC lathe with a purpose to learn how to turn specialized handles that I design in Adobe Illustrator (AI). I installed linuxcnc 2.5.4 on an old P4 and successfully loaded the appropriate configuration files from here (thanks Sam!), but haven't progressed to connecting the lathe yet.

The ini file specifies "inches" for linear units. I assume that's based on the machine's lead screw dimensions.

The handle drawing I want to start out with was drawn in AI with "mm" selected. My plan is to export from AI to DXF format and then use this converter to generate G-code. Someone else actually made this work on an identical lathe, except he started out with a DWG file I provided (also by exporting from AI). I'm not sure, but assume the DWG file I made specified "mm" as units.

I have a copy of the DXF file that was extracted from my DWF file it in order to generate G-code using the Ace converter. When I run that same DXF file through the Ace converter, after converting "y"s to "z"s and removing superfluous junk, I get results that start with the 12 blocks of code pasted in below. I don't see a G20 or G21 anywhere in the file.

So some questions are:

If G-code generated on the basis of a DXF or DWG file doesn't include G20 or G21, how do I know (or how would linuxcnc know) whether the code reflects inches or mm as the intended unit of measure?

If the ini file being run in linux cnc specifies "inches" as unit, would it work to run a program whose G-code was generated based on a drawing made with mm as unit of measure? (My understanding is that the answer is yes if g21 is included in the program.)

Is it somehow possible for a handle to have been perfectly turned (i.e., right dimensions) based on a drawing scaled to mm if 1) the linux ini file file specifies inches and 2) the g-code is either silent as to unit of measure?

Hope this makes sense.

G00 Z0.1000
G00 X0.6487 Z-1.0266
G01 Z-0.2500
G01 X0.6559 Z-1.0287
G01 X0.6487 Z-1.0266
G01 X0.6559 Z-1.0287
G01 X0.6487 Z-1.0266
G01 X0.6559 Z-1.0287
G01 X0.6559 Z-1.0287
G01 X0.6627 Z-1.0313
G01 X0.6559 Z-1.0287
G01 X0.6627 Z-1.0313

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

More
13 May 2014 05:04 #46849 by emcPT
Replied by emcPT on topic Inches and/or mm


If G-code generated on the basis of a DXF or DWG file doesn't include G20 or G21, how do I know (or how would linuxcnc know) whether the code reflects inches or mm as the intended unit of measure?


It does not know, but when linuxcnc starts one of them will be the default one. If you go to MDI, you can see the active G20 or G21 code, so your program will be readed as mm or inches. It is a good idea to have G20 or G21 at the begining of your Gcode.

If the ini file being run in linux cnc specifies "inches" as unit, would it work to run a program whose G-code was generated based on a drawing made with mm as unit of measure? (My understanding is that the answer is yes if g21 is included in the program.)


The point is that it will run a gcode file made in inches or in mm. How it will interpreter it depends if you place the G20 or G21. I even think that you can have part of your code in mm and part of it in inches if you place G20 before the inch gcode part and G21 before your mm part.

Is it somehow possible for a handle to have been perfectly turned (i.e., right dimensions) based on a drawing scaled to mm if 1) the linux ini file file specifies inches and 2) the g-code is either silent as to unit of measure?

Hope this makes sense.

G00 Z0.1000
G00 X0.6487 Z-1.0266
G01 Z-0.2500
G01 X0.6559 Z-1.0287
G01 X0.6487 Z-1.0266
G01 X0.6559 Z-1.0287
G01 X0.6487 Z-1.0266
G01 X0.6559 Z-1.0287
G01 X0.6559 Z-1.0287
G01 X0.6627 Z-1.0313
G01 X0.6559 Z-1.0287
G01 X0.6627 Z-1.0313


Same as before. If the gcode does not have a G20 or 21 it will use your default units. If it have G20 it will be inches, 21 mm.
You can define your startup code so that you have G21 or G20 by default when you start linuxcnc:
www.linuxcnc.org/docs/2.4/html/config_in...BRS274NGC%5D-section
The following user(s) said Thank You: krlynn

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

More
13 May 2014 06:11 - 13 May 2014 06:37 #46850 by krlynn
Replied by krlynn on topic Inches and/or mm

It does not know, but when linuxcnc starts one of them will be the default one. If you go to MDI, you can see the active G20 or G21 code, so your program will be readed as mm or inches. It is a good idea to have G20 or G21 at the begining of your Gcode.


Thanks for the reply. Don't know what MDI is yet, but What you said is what I had come to assume: i.e., that absent a G20 or G21 instruction, the program would apply as default whatever unit of measure was specified in the ini file for the selected machine.
Last edit: 13 May 2014 06:37 by krlynn.

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

More
13 May 2014 07:40 #46861 by andypugh
Replied by andypugh on topic Inches and/or mm

What you said is what I had come to assume: i.e., that absent a G20 or G21 instruction, the program would apply as default whatever unit of measure was specified in the ini file for the selected machine.


The INI file "Units" actually just defines the units used in the INI file, I believe. I think G20/21 might even be "sticky" through restarts. (I haven't checked). It is certainly "sticky" between G-code programs. If you G-code doesn't specify then the units will be whatever the last program defined.

The following user(s) said Thank You: krlynn

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

More
13 May 2014 10:30 #46863 by skunkworks
Replied by skunkworks on topic Inches and/or mm
Hi kenneth. (this is sam)

The reason why the config is in inches is because that is how I set it up.. The leadscrews are actually metric - but you can set the scale up either way. It would not be a big deal to make a mm config.

(although G20,21 work well also)

sam
The following user(s) said Thank You: krlynn

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

More
14 May 2014 00:22 #46900 by BigJohnT
Replied by BigJohnT on topic Inches and/or mm
I have a G code tutorial here that might help you get started.

gnipsel.com/linuxcnc/g-code/index.html

JT
The following user(s) said Thank You: krlynn

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

More
14 May 2014 06:33 - 14 May 2014 08:24 #46905 by krlynn

The INI file "Units" actually just defines the units used in the INI file, I believe. I think G20/21 might even be "sticky" through restarts. (I haven't checked). It is certainly "sticky" between G-code programs. If you G-code doesn't specify then the units will be whatever the last program defined.

The reason why the config is in inches is because that is how I set it up.. The leadscrews are actually metric - but you can set the scale up either way. It would not be a big deal to make a mm config. (although G20,21 work well also)


That's counter-intuitive to me and makes my head hurt a little. I assumed some machines were shipped with standard lead screws and some with metric (hence why different inch and mm configuration files are found in linuxcnc for the Sherline machines), and that not matching the unit of measure specified in a configuration file with the corresponding machine's specs would produce unwanted results. So much for assumptions. I'll probably want to come back and get a better understanding of how this works at some point, but for now I think I should just move on.

I have a G code tutorial here that might help you get started.

gnipsel.com/linuxcnc/g-code/index.html


Thanls y'all for the thoughtful replies.

Beyond the inch vs mm issue, something I've run into in trying to generate G-code from dxf files is that I can get radically different G-code by converting from different dxfs derived from the same ai (Adobe Illustrator) source file. And so far nothing I've opened in Axis was recognizable as the handle I drew. That said, skunkworks was able to take a dwg file I gave him, extract a dxf from it, convert that to G-code using the Ace utility, and then turn a perfectly dimensioned handle on an EMCO Compact 5 (with mm lead screws but standard-unit configuration). I have a ways to go. Illustrator probably isn't the best starting point, but it's what I have, and I know it can be made to work for present purposes. I suspect, however, that exporting directly from it to dxf is not resulting in files that are usable for conversion to G-code, at least not the way I'm going about it.

Thanks again.
Last edit: 14 May 2014 08:24 by krlynn.

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

More
14 May 2014 09:43 #46907 by Todd Zuercher
I import ai files from our graphical designers at work all the time into the cam programs I use there. They are using Adobe Illustrator to create the files. The key we have found is to be sure to save the ai files in a version format that your cam (or cad) program can work well with. For us saving the ai files in version 6 format seems to give the most consistently accurate results. There are a number of pitfalls that can lead to bad results. One of the bigger ones are, outlines, or lines with stroke widths will not import properly most of the time.

I would not suggest tool pathing directly from an ai drawing. Open it with cad/cam software and then save it to a better format, (preferably G-code)
The following user(s) said Thank You: krlynn

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

More
14 May 2014 20:32 #46926 by krlynn

I import ai files from our graphical designers at work all the time into the cam programs I use there. They are using Adobe Illustrator to create the files. The key we have found is to be sure to save the ai files in a version format that your cam (or cad) program can work well with. For us saving the ai files in version 6 format seems to give the most consistently accurate results. There are a number of pitfalls that can lead to bad results. One of the bigger ones are, outlines, or lines with stroke widths will not import properly most of the time.

I would not suggest tool pathing directly from an ai drawing. Open it with cad/cam software and then save it to a better format, (preferably G-code)


This is very helpful. What I'm pretty sure has worked at least once is me exporting to dwg (I'm not sure what format options I selected) and then handing that off to someone with a CAD program to generate G-Code (in one instance probably via a dxf using AutoCAD 2000). Since I don't have a cam or cad program, I've been trying to export directly from ai to dxf (using every combination of version/format) in order to convert from dxf to G-code (using Ace and other free converters I've found, one of which came with some malware).

I'm going to see if I can pick up a copy of AutoCAD 2000 somewhere and either install it on an old XP system or, better, see if I can get it to work with Wine on the computer I have running Ubuntu with linuxcnc. First, though, I'm going to check line width on the drawing I've been trying to convert.

Thanks.

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

Time to create page: 0.141 seconds
Powered by Kunena Forum