Reading and rendering Universal 3D (U3D) files in ODA Products is available by converting these types of files into .prc files. Reading .u3d files is implemented using the Universal 3D Sample Software library from Intel®. All types of mesh objects, including RHAdobeMesh, PointSet and LineSet objects, as well as materials and textures can be imported. Import of views and lighting objects is not supported.
The OdU3D2PrcImport module is used to convert U3D format files to PRC:
…
//Load the U3D import module:
OdU3D2PrcImportModulePtr pModule = ::odrxDynamicLinker()->loadModule(OdU3D2PrcImportModuleName);
//Create the U3D importer object and check whether it was successfully created:
OdU3D2PrcImportPtr importer = pModule->create();
if(importer.isNull())
odPrintConsoleString(L"U3D Importer object creation failed!\n");
//Set import parameters using the properties() method of the importer object:
importer->properties()->putAt(L"Database", pFile);
importer->properties()->putAt(L"U3DPath", OdRxVariantValue(u3dName));
//Run the import() method of the importer object and analyze the returned value:
if(OdResult::eOk != importer->import())
odPrintConsoleString(L"import failed!\n");
…
The OdU3D2PrcImport module supports a set of parameters. These parameters are stored in a dictionary object that can be retrieved for reading and modifying by calling the properties() method of the OdPdfImport class. Each parameter is accessible by its name represented with a string.
To set a new parameter value, use the putAt() method of the dictionary object, which assumes two arguments: parameter name and a new value of the parameter.
The full list of import parameters with their access names are described in the following table.
Import Parameter | Parameter Name | Description |
---|---|---|
Database for Import | Database | An OdPrcFilePtr object where the contents of a .u3d file should be imported. |
U3D File Path | U3DPath | A full path to the input .u3d file. |
Transform Matrix | TransformMatrix | A transformation matrix that will be applied to all elements of the imported .u3d file. |
The Database and U3DPath parameters are mandatory.
The OdU3D2PrcImport module also supports importing several .u3d files into one .prc file. The picture below shows the result of importing two U3D models into one .prc file.
U3D support in ODA Vizualize
An example of U3D support in ODA Vizualize is implemented in the Prc2Visualize module. You can see an example in the picture below.