- Posts: 40
- Thank you received: 0
Inches and/or mm
- krlynn
- Offline
- Senior Member
-
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.
- emcPT
- Offline
- Platinum Member
-
- Posts: 424
- Thank you received: 95
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
Please Log in or Create an account to join the conversation.
- krlynn
- Offline
- Senior Member
-
- Posts: 40
- Thank you received: 0
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.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
- Posts: 19899
- Thank you received: 4655
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.
Please Log in or Create an account to join the conversation.
- skunkworks
- Offline
- Moderator
-
- Posts: 351
- Thank you received: 153
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
Please Log in or Create an account to join the conversation.
- BigJohnT
- Offline
- Administrator
-
- Posts: 3981
- Thank you received: 994
gnipsel.com/linuxcnc/g-code/index.html
JT
Please Log in or Create an account to join the conversation.