# DGN Reader

DGN
File Extension | DGN
Supported Versions | 7, 8
Platforms |
Tessellation | Supported (computed)
Boundary Representation (B-rep) | Generated from file
PMI | Unsupported by format

The DGN (Design) format is a prominent file format used primarily for computer-aided design (CAD) and building information modeling (BIM) applications. Developed and maintained by Bentley Systems, DGN files are extensively employed in various industries, including architecture, engineering, construction, and geospatial.

The file extensions of DGN files that you can expect to be loaded by HOOPS Exchange include:

- .DGN

## How to Import from DGN

Reading `DGN` files follows the same pattern as other formats: configure load parameters, then call the standard load function.

To load a DGN file, use `A3DAsmModelFileLoadFromFile()`. The `A3DParamsLoadData` structure is used to customize the loading behavior:

    A3DAsmModelFile* pModelFile = 0;

    A3DRWParamsLoadData sReadParam = A3D_MAKE_DATA(A3DRWParamsLoadData);
    sReadParam.m_sGeneral.m_bReadSolids = true;

    // ... set other A3DRWParamsLoadData fields as necessary

    A3DAsmModelFileLoadFromFile("path/to/file.dgn", &sReadParam, &pModelFile);

See Simple Load and Export for more about loading model files.

## Boundary Representation (B-rep)

The DGN file format does not store the geometry as either tessellation or boundary representation. Instead, we have an exact definition of how to create the geometry. This can include definitions of an extrusion, a revolution, a B-spline surface, etc.

HOOPS Exchange interprets these various geometrical definitions and translates them into B-rep models.

## Levels

HOOPS Exchange provides support of items visibility based on the level they are attached to:

- In the DGN format, each item is attached to a level.
- In the PRC structure generated by HOOPS Exchange, it creates a separate layer for each level, assigning a layer id that corresponds to the level number.
- We set the layer id of each `A3DRiRepresentationItem` or `A3DAsmProductOccurrence` to match the level number of its counterpart in the DGN file.

To manage layer visibility and control the visibility of different layers, a filter is applied on the root `A3DAsmProductOccurrence`. This is based on the `GlobalDisplay` and `GlobalFreeze` settings of the respective level in the DGN file.

## Limitations

- Topology is not supported for revolutions, except for cones and cylinders.

- Multilines, notes, texts, fonts, and dimensions are not supported.

- Levels

  > - Levels are fully supported only for V8 files; they are not for V7 files.
  > - Only the `GlobalDisplay` and `GlobalFreeze` settings are supported for controlling level visibility. The ViewDisplay setting is not handled.
  > - Level numbers greater than 65,535 are not supported. These levels will not be assigned to any `A3DRiRepresentationItem` or `A3DAsmProductOccurrence`, and will not be included in the default filter layer list.
  > - Changes to color, style, transparency, or material based on level are not yet supported.

- iModel files, with a .i.dgn extension, are not supported.

- UV mapping, color, and normal redefinitions are not supported for meshes.

- Reference files that are not in DGN format (such as DWG, IFC, …) are not supported.

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Exchange in your own language, or choose a sample question below to start a conversation:

What is HOOPS Exchange?
What are the latest release notes for HOOPS Exchange?
How do I start evaluating HOOPS Exchange?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...