Inches and/or mm

More
12 years 5 months ago #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
12 years 5 months ago #46849 by emcPT
Replied by emcPT on topic Inches and/or mm

krlynn wrote:
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.

krlynn wrote: 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.

krlynn wrote: 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
12 years 5 months ago - 12 years 5 months ago #46850 by krlynn
Replied by krlynn on topic Inches and/or mm

emcPT wrote: 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. [strike]Don't know what MDI is yet, but [/strike] 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: 12 years 5 months ago by krlynn.

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

More
12 years 5 months ago #46861 by andypugh
Replied by andypugh on topic Inches and/or mm

krlynn wrote:

emcPT wrote: 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
12 years 5 months ago #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
12 years 5 months ago #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.

Time to create page: 0.360 seconds
Powered by Kunena Forum