PDA

View Full Version : Inch vs mm units problems


John Scheffel
10-09-2003, 12:14 PM
Please use this thead to post tips about importing DXF files into Drafting/ME10 or Annotation.

Here is a tip I received from Eric Barton of Agilent some time ago.

If you import DXF file in and the size is scaled up or down by a factor 25.4, this is the result of a Metric-English conversion problem. AutoCAD has no internal notion of units (mm vs. inch vs. feet vs. miles vs. light years) but it does keep track of English vs. Metric systems. This controlled by an environment variable on the PC running AutoCAD.

If the wrong setting was used, it can be fixed by a simple edit to the DXF file. DXF files are plain text, so they are easy to edit. To change the variable:

Open the .dxf file in a text editor (NotePad or WordPad will work.)
Search for the string $MEASUREMENT. You should find a section that looks like this:

$MEASUREMENT
70
X
0

If the X is a 0, then it will import as English (inches in CoCreate apps). If the X is a 1, then it will import as Metric (mm in CoCreate apps). Note that the 4th line may be a different number.
Change the X to the other value.
Save the file using File, Save. If you use Save As... to rename the file, enclose the file name in double quotes ("filename.dxf"), otherwise a .txt extension will automatically be added to the name.

John Scheffel
10-09-2003, 12:15 PM
This information came from CoCreate support in response to a question about importing a DXF file which was intended to be drawn in microns (not created by AutoCAD). In order to change the settings as described below, you must edit the dxfdwg.con file which is located under the <install_dir>\dxfdwg\ folder. <install_dir> is the main application folder such as C:\CoCreate\OSD_Drafting_xx.xx or C:\CoCreate\OSD_Modeling_x.x.x.x.

CustomUnits
This switch controls the handling of drawing units in the translation.
When set to OFF (the default), the drawing units will be based on AutoCAD MEASUREMENT variable in the DXF file (see above): 0 for inches and 1 for millimeters.
When set to ON, the drawing units will be set based on the values of Units and UnitsScale parameters.

Units and UnitsScale
The Units parameter specifies the units used in the DXF to MI translation, and UnitsScale the scale of the units used. The following table shows the relationship between these two parameters:

Units Units scale
micrometer um 0.001
millimeter mm 1.0
centimeter cm 10.0
meter m 1000.0
kilometer km 1000000.0
microinch uinch 0.0000254
mil mil 0.0254
inch in 25.4
foot foot 304.8
yard yard 914.4
mile mile 1609344.0
user unit user unit See below

In the case of user unit (meaning user-defined units), the corresponding Units scale factor must be calculated. If, for example, the user unit has been defined as 2 inches, the Units scale s 2x25.4 = 50.8. The factor 2 comes from 2 inches, and the factor 25.4 stems from the Units scale for inch in the above table.

The default settings are mm and 1.0 for Units and UnitsScale, respectively.