Hide menu
Loading...
Searching...
No Matches
Measurement Units

Overview

CAD Exchanger implicitly uses millimeters as the unit of length measurement and radians as the unit of plane angle measurement.

Each format has its own conventions on what units of measurement are used to store geometric data. CAD Exchanger takes these conventions into account and performs scaling of coordinates, lengths and angles when importing and exporting models. Import and export parameters classes also contain methods (Base_ReaderParameters::SetLengthUnit(), Base_WriterParameters::LengthUnit()) allowing to specify the length unit that will be used if the format has no conventions about units (e.g. STL, OBJ) or when the choice is arbitrary (as is often the case in export).

As a result of these scaling procedures, all length (or derived) parameters provided via SDK API are assumed to be in millimeters. Likewise, coordinates retrieved from B-Rep or polygonal representations are also in millimeters.

Support of units across formats and the unit handling strategies in import and export are summarized in the table below:

Format Unit assignment Import behavior

Export behavior

3D PDF No unit information Scale from meters (current limitation)

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit()

3D XML File-wide Scale lengths/coordinates according to file-wide units

N/A

3DS No unit information Scale lengths/coordinates according to Base_ReaderParameters::SetLengthUnit()

N/A

3MF No unit information Scale lengths/coordinates according to Base_ReaderParameters::SetLengthUnit()

N/A

ACIS-SAT File-wide Scale lengths/coordinates according to file-wide units

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit()

BRep Millimeteres and radians by convention No scaling

No scaling

CATIA File-wide Scale lengths/coordinates according to file-wide units

N/A

Collada Meters and degrees by convention Scale lengths/coordinates and angles from convention unit

Scale lengths/coordinates and angles to convention unit

Creo File-wide Scale lengths/coordinates according to file-wide units

N/A

DXF File-wide Scale lengths/coordinates according to Base_ReaderParameters::SetLengthUnit()

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit()

DWG File-wide Scale lengths/coordinates according to Base_ReaderParameters::SetLengthUnit()

N/A

FBX Centimeters and degrees by convention Scale lengths/coordinates and angles from convention unit

Scale lengths/coordinates and angles to convention unit

GLTF Meters and radians by convention Scale lengths/coordinates and angles from convention unit

Scale lengths/coordinates and angles to convention unit

IFC File-wide Scale lengths/coordinates and angles according to file-wide units

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit(), save angles in radians

IGES File-wide Scale lengths/coordinates according to file-wide units

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit()

INV File-wide Scale lengths/coordinates according to file-wide units

N/A

JT Per-Logical Scene Graph element; same as Parasolid for XT segments Scale lengths/coordinates of mesh and JT B-Rep data using units in LSG; same as Parasolid for XT segments

Scale lengths/coordinates of mesh according to JT_WriterParameters::PolyRepresentationUnit(); same as Parasolid for XT segments

NX File-wide Scale lenghts/coordinates according to file-wide units

N/A

OBJ No unit information Scale lengths/coordinates according to Base_ReaderParameters::SetLengthUnit()

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit()

Parasolid-XT Meters and radians by convention Scale lengths/coordinates from convention unit

Scale lengths/coordinates to convention unit

PLY No unit information Scale lengths/coordinates according to Base_ReaderParameters::SetLengthUnit()

N/A

PRC File-wide Scale lengths/coordinates and angles according to file-wide units

N/A

Revit Feet and radians by convention Scale lengths/coordinates and angles from convention unit

N/A

Rhino File-wide Scale lengths/coordinates according to file-wide units

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit()

Solid Edge File-wide Scale lengths/coordinates according to file-wide units

N/A

SolidWorks File-wide Scale lengths/coordinates according to file-wide units

N/A

STEP Per-product Scale lengths/coordinates and angles according to per-product units

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit(), save angles in radians

STL No unit information Scale lengths/coordinates according to Base_ReaderParameters::SetLengthUnit()

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit()

U3D No unit information Scale from meters (current limitation)

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit()

USD File-wide N/A

No scaling (current limitation)

VRML Meters and radians by convention Scale lengths/coordinates according to Base_ReaderParameters::SetLengthUnit()

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit()

X3D Meters and radians by convention Scale lengths/coordinates according to Base_ReaderParameters::SetLengthUnit()

Scale lengths/coordinates according to Base_WriterParameters::LengthUnit()

Retrieving original measurement units

CAD Exchanger also retains information about measurement units used in imported file. This information is stored inside the property table of ModelData_Model in form of Base_UTF16String.

Note
These are measurement units, that are used in original file, not measurement units used inside CAD Exchanger - it uses millimeters and radians.

Here is the full list of unit names:

Length units:

  • "Millimeters"
  • "Centimeters"
  • "Meters"
  • "Inches"
  • "Feets"
  • "Yards"
  • "Micrometers"
  • "Decimeters"
  • "Kilometers"
  • "Mils"
  • "Miles"

Angle Units:

  • "Degrees"
  • "Radians"

To get this information, you need to get ModelData_PropertyTable from ModelData_Model and use predefined table keys:

ModelData_PropertyTable::OriginalLengthUnitPropertyName()
ModelData_PropertyTable::OriginalAngleUnitPropertyName()

Here is an example showing how to use them to get information about measurement units:

auto aProperties = aModel.Properties();
if (!aProperties.IsNull()) {
Base_UTF16String aLengthUnit, anAngleUnit;
if (aProperties.FindProperty (aProperties.OriginalLengthUnitPropertyName(), aLengthUnit)) {
std::cout << "Length unit: " << aLengthUnit.String() << std::endl;
} else {
std::cout << "No length unit information." << std::endl;
}
if (aProperties.FindProperty (aProperties.OriginalAngleUnitPropertyName(), anAngleUnit)) {
std::cout << "Angle unit: " << anAngleUnit.String() << std::endl;
} else {
std::cout << "No angle unit information." << std::endl;
}
} else {
std::cout << "No unit information." << std::endl;
}

If property table is empty, it means that at that moment providing information about original file measurement units is not supported for current format.

If, when using ModelData_PropertyTable::OriginalAngleUnitPropertyName(), there is no corresponding value in table, than original file contain only polygonal representation. CAD Exchanger don't provide angle unit information for polygonal representations. For B-Rep representations files, CAD Exchanger provide both angular and linear measurement unit information.

For formats where measurement units can be specified per product structure component, like STEP and NX, CAD Exchanger reads measurement units of the first encountered component.

This function is currently supported for the following formats: