Documentation

Import VRML Models from CATIA Software

You can use CAD designs created in the CATIA® product to create Simulink® 3D Animation™ virtual reality scenes. CATIA models are hierarchical trees comprised of products that contain parts.

To export CATIA parts or products to the VRML format, in the CATIA dialog box, select File > Save as and select VRML in the Save as type list.

Note

You cannot use the Simulink 3D Animation to import CATIA models to X3D files in Simulink 3D Animation.

When exporting products, the CATIA software creates one compound VRML file that contains all the parts of the product.

To export each part of the assembly hierarchy into a separate VRML file, in the CATIA environment:

  1. Save each part individually to a separate virtual world 3D file.

  2. Create the main model virtual world 3D file manually, with Inline references to the part files.

CATIA Coordinate Systems

Also, the CATIA software exports background color and viewpoints. The software exports individual parts without these properties.

By default, the CATIA software uses right-handed Cartesian coordinate system, identical to the MATLAB coordinate system. Account for the coordinate system when you export objects from the CATIA environment into virtual worlds. Also account for the coordinate system when you manipulate exported objects using the Simulink 3D Animation software.

You can also define a different coordinate system. Within the current geometrical set, create an axis system. Doing so sets this new system as a reference system that you can use to export the VRML virtual world. Consider creating such an axis system so that it corresponds to the virtual world coordinate system. This approach makes all the coordinates and orientations of objects compatible with other objects you combine into virtual worlds. See Virtual World Coordinate System.

Settings That Affect the VRML Output

In the CATIA environment, the properties that affect the VRML output are available in two options dialog boxes:

  • Display Performances dialog box

  • VRML Compatibility dialog box

Level of Detail

The level of detail of the exported VRML file (accuracy of the tessellation mesh of objects) corresponds to the setting of CATIA general visualization mesh. In the CATIA menu, select Tools > Options > General > Display > Performances. In the resulting dialog box, select the 3D Accuracy options to control the visualization mesh detail.

Use the proportional method of tessellation (arcs are substituted by line segments based on their relative, not absolute, accuracy). This method works for models regardless their dimensions. For maximum accuracy of the exported virtual world model, set the slider at the rightmost position. If the resulting file is too complex to be handled effectively with VRML rendering tools, experiment with this accuracy setting. Find the setting that gives you the smallest possible virtual world model that is visually acceptable.

VRML Export Filter Settings

The CATIA software enables you to tune some VRML export options.

  1. Select Tools > Options > General > Compatibility > VRML options.

  2. Select VRML97 as the export format.

    The Simulink 3D Animation software uses VRML97 standard format.

  3. Select the Save normals check box.

    This option affects whether to export explicit face normals definitions.

  4. Clear the Save edges check box

    Clear this check box for optimum performance. Selecting this check box directs the CATIA software to export object edges (in the form of IndexedLineSets).

  5. Set the appropriate Save textures check boxes to the desired settings.

    In particular, if you want to save textures, select the Save textures in external files option. This option generates external JPG files for object textures.

  6. Select the VRML model background color.

    This option applies only to exporting products.

VRML Models Exported from the CATIA Environment

The CATIA software exports CATProducts and their CATParts as VRML transforms. The structure of these transforms corresponds to the CATIA model hierarchy. In addition to transforms that represent physical elements, the CATIA software creates several transforms and groups in the VRML file. The transforms and groups represent relationships between objects and other model properties defined in the CATIA environment.

Some of these additional nodes can be empty. Many CATIA model properties do not have equivalents in the VRML language. Each part transform contains a hierarchy of nested transforms, groups, and shapes that correspond to the part internal structure. Some of these elements have synthetic DEF names (for example, _0161DC70). Usually, work with the main transforms that represent each part.

Here is the VRML model of a cylinder assembly consisting of four parts:

The left tree view illustrates the overall structure of the model.

  • The CATIA software saves the general model information in the WorldInfo, NavigationInfo, and Background nodes.

  • The software exports the default CATIA viewpoints (it does not export user-defined viewpoints).

Common to all products exported to VRML, there is a top-level transform node representing the CATProduct.

In the CATIA software, Product CylinderAssembly1 consists of four parts:

  • CrankAssembly1

  • CylinderSleeve1

  • PistonAssembly1

  • CrankshaftAssembly1

The export does not preserve the CATProduct and CATPart names. You can identify these objects in the VRML file in the tree view and in the text mode. For clarity, in the figure, the contents of the part transforms are collapsed so that only the top-level objects are visible. After four transforms representing CATParts, the export adds an empty Group node for definingCATIA Constraints. You can delete such empty nodes from the VRML model.

The conversion scales contents of the CATProduct down by a factor of 1000 (conversion of units from millimeters to meters).

When you have VRML files created with the CATIA software, consider using these features with the Simulink 3D Animation software.

CATIA Feature Support

FeatureConversion Notes
Object names

Exporting to VRML does not preserve CATProduct and CATPart names. The CATIA environment only creates synthetic VRML DEF names for subparts, materials, and object coordinate fields. These synthetic names change between two or more consecutive export operations.

To work with the Simulink 3D Animation software, provide meaningful DEF names for the objects that you want to control from the MATLAB® /Simulink environment.

Vertex coordinates

The CATIA software saves all vertex coordinates for a part in one VRML coordinate field, which resides in the first exported IndexedFaceSet for the part. Several subparts throughout the file reference the VRML coordinate field with USE directives.

Preserve this reference. Do not delete or rename the original Coordinate field DEF name.

Materials

The VRML file stores only one material per part. If the part consists of several subparts in VRML, their material also uses the USE reference to the material of the first subpart.

TexturesTextures are supported.
Level of detail

LOD (exporting parts in several levels of detail for more efficient visualization) is not supported.

Units

The CATIA software exports models in millimeters, VRML units are meters.

Scale resulting objects to visualize them effectively. The conversion scales the main Transform representing the CATIA product by a factor of 0.001 (conversion from millimeters to meters). The scaling occurs regardless of the units used in the CATIA document.

Viewpoints

The VRML file does not save user-defined CATIA viewpoints.

Adjust the Resulting VRML Files

To use the exported VRML models with the Simulink 3D Animation software, adjust exported VRML files. You can perform these adjustments manually, as described in this topic, or use the vrcadcleanup and vrphysmod functions to perform some of these tasks.

Add DEF Names to Part Transforms.

In the VRML file, assign a unique name for each VRML object. Add the DEF Object_Name statement to each part Transform line.

This example shows a VRML file that has DEF names added to the cylinder assembly.

Do not adjust parts in the scene that you do not want to control from the MATLAB environment.

Scale VRML Objects

To convert CATProduct size from millimeters to meters (VRML default units), the CATIA software wraps the transform corresponding to the CATProduct with an additional transform. In this transform, the scale field is defined. The preceding example illustrates this size conversion.

If you have a small object, or an object to place into an overall virtual world, adjust this scale.

If you leave the VRML object scale in the default state, the local part coordinates are still in millimeters. Remember this fact when controlling these parts from the MATLAB or Simulink environment. If your MATLAB or Simulink model units are meters, scale each part individually to achieve correct results. Delete the scale field from the top-level transform, and add it to each individual part transform. For example:

Transform {
  children [
    DEF CylinderAssembly1 Transform {
      children [
        DEF CrankAssembly1 Transform {
          scale  0.001 0.001 0.001
          ..
        }

See Also

Functions

Related Topics

Was this topic helpful?