DGN Core Converter#
The DGN core converter is a Kit extension that converts Bentley MicroStation DGN v8 files to USD. It is the GUI-less backend for omni.kit.converter.dgn.
Quick Start#
Use this recipe when running inside Kit with omni.kit.converter.dgn_core enabled.
import omni.converter.dgn
from omni.kit.converter.dgn_core import OdaDgnOptions, get_instance
converter = get_instance()
if converter is None:
raise RuntimeError("omni.kit.converter.dgn_core is not loaded")
options = OdaDgnOptions()
options.levelFilterStyle = omni.converter.dgn.FilterStyle.eOmit
options.levelIncludes = ["Default", "3D*"]
options.meshConversionStyle = omni.converter.dgn.ConversionStyle.eRenderable
options.curveConversionStyle = omni.converter.dgn.ConversionStyle.eNone
options.importAttributesByList = True
output_url, status = await converter.create_converter_task(
"C:/data/site.DGN",
"C:/data/site.usd",
options.toArgs(),
)
if status.error_code != 0 or not output_url:
raise RuntimeError(status.error_msg)
Success means status.error_code == 0 and output_url is non-empty.
Prerequisites#
Run inside a Kit Python environment where
omni.kit.converter.dgn_coreand its native ODA converter library are loaded.The input
.DGNfile must exist locally or be resolvable through supported Omniverse/Nucleus URL handling.The output folder must be writable locally or resolvable through supported Omniverse/Nucleus URL handling.
create_converter_task(...)is async; call it from an async context.
What This Converter Does#
Reads .DGN files through the Open Design Alliance Kernel and Drawings SDKs and writes USD output. It converts DGN containers to UsdGeomXform, mesh-like elements to UsdGeomMesh, supported curves and 3D text to UsdGeomBasisCurves when enabled, and DGN properties to USD attributes when configured.
DGN level names are prepended to converted prim names so users can quickly find geometry from a source level.
Input and Output Formats#
Format |
Notes |
|---|---|
|
Bentley MicroStation DGN v8 input. Filter regex currently matches uppercase |
Output |
Notes |
|---|---|
|
USD output path supplied by the caller. |
Conversion APIs#
Use these APIs to perform conversions, in this order of preference:
API |
When to use |
|---|---|
|
Preferred core extension API when calling the loaded extension from Python. Returns |
|
Lower-level helper used by the extension implementation. Treat as internal despite being the helper conversion method. |
|
Backend SDK wrapper for local conversion paths. Use only when you do not need the core extension’s Nucleus handling, output copying, logging, and Scene Optimizer post-processing. |
Minimal direct API call:
import omni.converter.dgn
from omni.kit.converter.dgn_core import OdaDgnOptions, get_instance
converter = get_instance()
options = OdaDgnOptions()
options.levelFilterStyle = omni.converter.dgn.FilterStyle.eOmit
options.levelIncludes = ["Default", "3D*"]
options.meshConversionStyle = omni.converter.dgn.ConversionStyle.eRenderable
options.curveConversionStyle = omni.converter.dgn.ConversionStyle.eNone
options.importAttributesByList = True
output_url, status = await converter.create_converter_task(
"C:/data/site.DGN",
"C:/data/site.usd",
options.toArgs(),
)
For direct backend conversion with local paths only, pass the options object itself:
import omni.converter.dgn
from omni.kit.converter.dgn_core import OdaDgnOptions
options = OdaDgnOptions()
options.levelFilterStyle = omni.converter.dgn.FilterStyle.eOmit
options.levelIncludes = ["Default", "3D*"]
options.meshConversionStyle = omni.converter.dgn.ConversionStyle.eRenderable
options.curveConversionStyle = omni.converter.dgn.ConversionStyle.eNone
options.importAttributesByList = True
converter = omni.converter.dgn.Converter(options)
error_code, error_msg = converter.convert("C:/data/site.DGN", "C:/data/site.usd", {})
Supported DGN Element Types#
DGN element category |
USD output |
|---|---|
Cell Header, Shared Cell Reference, Shared Cell Definition |
|
Complex Shape, Shape 3D, Solid, Surface, Mesh, Cone, BSpline Surface |
|
Line, Line String, Ellipse, Arc, BSpline Curve |
|
Converter Options#
Configure these as properties on OdaDgnOptions. Pass options.toArgs() to create_converter_task(...); pass options directly only when calling omni.converter.dgn.Converter(options).
Enum-valued pybind property setters require enum objects, not raw integers. For example, set options.levelFilterStyle = omni.converter.dgn.FilterStyle.eOmit and options.meshConversionStyle = omni.converter.dgn.ConversionStyle.eRenderable. Numeric enum values are valid in JSON/dict config parsed by OdaDgnOptions.parse(...) and in the serialized dict returned by options.toArgs().
|
Default |
Description |
|---|---|---|
|
|
Maximum number of grid lines. |
|
|
Maximum facet edge length. |
|
|
Circular surface tessellation tolerance in degrees. |
|
|
Grid aspect ratio. |
|
|
Additional points or isolines between knots for NURB data. |
|
|
Points per edge. |
|
|
Maximum distance between tessellated mesh and source surface. |
|
|
Create USD materials; false writes colors as |
|
|
Material output: |
|
|
Geometry attributes: |
|
|
Enable instancing through USD references. Prefer |
|
|
Shared Cell Reference instancing: |
|
|
Export hidden DGN elements and set converted prim visibility to invisible. |
|
|
Mesh elements: |
|
|
Non-text curves: |
|
|
3D text: |
|
|
BasisCurves width for converted 3D text. |
|
|
Sample count for approximating curves and 3D text. Must be at least 2. |
|
|
Width for curves with no source width. |
|
|
Apply model global origin as transforms instead of storing it only as an attribute. |
|
|
Hide prims whose source level matches |
|
|
Case-sensitive wildcard level patterns to hide after conversion. |
|
|
Exclude hidden levels from conversion. |
|
|
Level filter handling: |
|
|
Case-sensitive wildcard level patterns to include during filtering. |
|
|
Case-sensitive wildcard level patterns to exclude during filtering. |
|
|
Merge meshes that share level, color, and element type. |
|
|
Merge curves that share level, color, and element type. |
|
|
Triangulate polygons during conversion. |
|
|
Convert DGN element IDs to USD attributes. |
|
|
Case-sensitive wildcard model name patterns; empty means all models. |
|
|
Convert selected DGN custom properties to USD attributes. |
|
|
JSON array of |
|
|
Handling for merged differing attributes: |
|
|
Report conversion progress. |
|
|
Emit detailed logs for debugging conversion issues. |
Development Rules#
Keep
OdaDgnOptionsinpython/impl/options.pyas the single source for option parsing.When adding or changing an option, update
python/impl/options.py,docs/Overview.md, and tests together.Preserve level/model filtering semantics: wildcard matching is case-sensitive;
*means all; empty list behavior depends on the option.Keep DGN level-name prim naming behavior aligned across implementation, tests, and docs.
Keep creator metadata behavior unless replacing it with equivalent extension/backend version metadata.
Verification#
Build and run the repo test suite from the repository root:
./repo.bat build -xrd
./repo.bat test
For focused changes, run the generated omni.kit.converter.dgn_core extension tests after building, or cover the affected tests under source/extensions/omni.kit.converter.dgn_core/python/tests.
The configured Python coverage threshold for this extension is 85%.
Codebase Map#
File |
Role |
|---|---|
|
|
|
|
|
DGN file filter and supported format regex. |
|
Conversion and memory leak tests. |
|
User-facing behavior, supported element types, and converter option documentation. |
|
Package metadata, native converter library, tests, coverage settings. |