SolidWorks Import Solution: Wrong Units in IGES Files?

Article by Irfan Zardadkhan, PhD, CSWE updated April 11, 2013

Article

So you have just received a file from your customer in the IGES format and when you open it up, you notice that its size has been scaled up by around 25. The issue is that you were expecting the units to be in mm but the file is stored in inches. One way would be to simply scale the entire model by a factor of 1/25.4 but what if this is an IGES assembly and has multiple parts. I am sure you will find some way to scale everything and put the things back together again.

Here is a simple technique that you can use to correct the units stored within the IGES document. IGES documents are stored as simple ASCII documents so you will need a text editor (I use notepad++ rather notepad because it can handle very large file sizes).

When you open the iges file, the first few lines are the iges header and contain the metadata including the units. Look for the following unit indicator, possibly in the 3rd or 4th line of the document: 2HIN, 4HINCH, 2HMM, 2HFT, 2HMI, 1HM, 2HKM, 3HMIL, 2HUM, 2HCM, 3HUIN. Once you locate this, the entry just before this entry, will be another unit indicator which is an integer between 1 to 11. Both these indicators have to be consistent so if you change one, you have to change the other one as well. Here is a table of units for the iges header.

unitindicator 1indicator 2
  • inches
  • millimeters
  • feet
  • miles
  • meters
  • kilometers
  • mils
  • microns
  • centimeters
  • microinches
  • 1
  • 2
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 2HIN or 4HINCH
  • 2HMM
  • 2HFT
  • 2HMI
  • 1HM
  • 2HKM
  • 3HMIL
  • 2HUM
  • 2HCM
  • 3HUIN

 

Once you have edited the two unit indicators in the iges file, you can save the document. Open it in SolidWorks and you will see that the size has been scaled to the units you want.

 

Example, an IGES file originally marked as inches


,,22HI-DEAS Master Series 7,33H/scratch/dobobd/iges/Example2.igs,,31HI-DG      1
EAS Master Series 7:      IGES,32,38,6,308,1,2HIN,1.0D0,2,2HMM,1,0.0D0, G      2
13H990208.103851,.01D0,100.0D0,12HYourNameHere,15HYourCompanyHere,11,0, G      3
13H990208.103851,;                                                      G      4

 

The units changed in the header to be mm


,,22HI-DEAS Master Series 7,33H/scratch/dobobd/iges/Example2.igs,,31HI-DG      1
EAS Master Series 7:      IGES,32,38,6,308,2,2HMM,1.0D0,2,2HMM,1,0.0D0, G      2
13H990208.103851,.01D0,100.0D0,12HYourNameHere,15HYourCompanyHere,11,0, G      3
13H990208.103851,;                                                      G      4

Related Links

Get Certified SOLIDWORKS Services from Javelin

Javelin Experts can help you to:

Find Related Content by TAG:

Irfan Zardadkhan, PhD, CSWE

Irfan holds a PhD in Aerospace Engineering and is as Elite AE. He contributes regularly to the SIMULATION and COMPOSER tech blogs. He has won the TenLinks Top blogger award for SOLIDWORKS. He has presented at local user groups and at SOLIDWORKS World.