CAD Exchanger SDK
OBJ Converter

Overview

OBJ_Reader can read files and OBJ_Writer can write files in Wavefront OBJ file format.

The reader can read files with external .mtl (material library) files, files with both multiple and single parts. In the case of multiple parts they are created as roots of the resulting model (ModelData_Model).

Scope

  • polygonal representations
  • colors and materials

Parameters

Importer Parameters

The OBJ import parameters are controlled by OBJ_ReaderParameters. The following table contains a list of parameters for OBJ import:

Parameter Default value Description
UnitCoef() 1.

Specifies the measurement unit to interpret coordinates in the input .obj file.

The value is a scale coefficient to millimeters. For instance to interpret file coordinates in meters, the value of 1000. must be used. By default, coordinates values are interpreted in millimeters.

Exporter Parameters

The OBJ export parameters are controlled by OBJ_WriterParameters. The following table contains a list of parameters for OBJ export:

Parameter Default value Description
ToGenerateMtlFile() true

Specifies whether a separate .mtl file (with material library) should be created.

If the value is true then an .mtl file is created. The .mtl file will have the same base file name as the resulting .obj file.

If the value is false then no colors will be stored and no .mtl file will be created.

WriteNormals() true

Specifies whether vertex normals should be saved in a resulting .obj file.

If the value is true then normals are stored in the file. In this case, third-party viewers may display 3D models in smooth shading. If the value is false then normals are not stored in the .obj file, and the third-party viewers may display 3D models in flat shading.