Files
autodesk/Plant3D2026/P_Rec_Annot/docs/research/dwgquery-model-files-api.md

4.2 KiB

Plant 3D 2026 DwgQuery / ModelFiles API contract

Scope and method

This report is based on metadata-only inspection of the installed Plant 3D 2026 assemblies. The assemblies were read from <PLANT3D_2026_INSTALL> and were not copied into the repository. Metadata-only inspection was necessary because the normal PowerShell host cannot load the product's .NET 8 dependencies safely.

Legacy source at the documented local path was not present on this machine, so there is no legacy API claim in this report.

Confirmed assemblies

Assembly Version Relevant type
PnPDwg2dDef 0.0.0.0 Autodesk.ProcessPower.Drawings2d.DwgQuery, IDwgQuery, DwgViewDef, IDwgViewDef, DwgSheetDef, IDwgSheetDef
PnPDwg2dUtil 0.0.0.0 Autodesk.ProcessPower.Drawings2d.ModelFile
PnP3dOrthoProjectPart 17.0.60.1 Ortho project-part integration assembly; the metadata scan found no public DwgQuery declaration there

PnPDwg2dDef and PnPDwg2dUtil use 0.0.0.0 assembly versions in the installed metadata. The supported runtime contract is therefore identified by the exact public type names below, not by an invented product-version number.

Confirmed contract

Autodesk.ProcessPower.Drawings2d.IDwgViewDef.DwgQuery
  : Autodesk.ProcessPower.Drawings2d.IDwgQuery

Autodesk.ProcessPower.Drawings2d.IDwgQuery.ModelFiles
  : Autodesk.ProcessPower.Drawings2d.ModelFile[]

Autodesk.ProcessPower.Drawings2d.ModelFile.ModelFileName
  : System.String

Autodesk.ProcessPower.Drawings2d.ModelFile.ModelFileGuid
  : System.String

DwgViewDef implements IDwgViewDef; DwgQuery implements IDwgQuery and IDisposable; ModelFile implements IComparable<ModelFile>.

ModelFiles is an array, not an untyped enumerable. ModelFileName is the only confirmed string field representing the model-file reference. ModelFileGuid is a separate identity field. IsReferencedDwg and Xform describe reference state and transform, not a substitute path.

Public members relevant to source resolution

IDwgViewDef exposes DwgQuery, ViewName, layout/orientation properties, and SetClippingPlanes, SetLayout, SetOrientation, Erase, and New.

IDwgQuery exposes ModelFiles, Execute, and Erase.

ModelFile exposes ModelFileName, ModelFileGuid, IsReferencedDwg, and Xform; its constructors accept a file-name string and optional transform, reference flag, and GUID.

IDwgSheetDef.DwgViewDefs exposes the view-definition collection. Sheet DwgName/DwgPath identify the Ortho sheet and must not be used as the source of Piping DataLinks.

Current and legacy usage

The original adapter used reflection and tried several possible names (ModelFileName, Value, and arbitrary string values). That was not a valid Plant 3D 2026 contract.

The production read path now uses the confirmed typed chain only:

IDwgViewDef.DwgQuery.ModelFiles[].ModelFileName

The legacy source path was unavailable locally, so no legacy source-model or DataLinks workaround has been imported.

Runtime evidence

Static metadata cannot prove whether ModelFileName is project-relative or absolute in a concrete Ortho fixture, or whether a particular view has zero, one, or multiple model files. In DryRun only, setting P_REC_ANNOT_DIAGNOSTICS=OrthoStructure enables a sanitized structure probe. It records type names, collection counts, null state, string length, and a one-way value hash; it does not emit paths or engineering data.

On the local DryRun fixture, the runtime probe recorded one view with one ModelFile. The concrete types were DwgViewDef, DwgQueryByBox, and ModelFile[]; ModelFileName was non-null and an absolute fixture-model reference. The path itself was not retained in repository evidence.

The resolver resolves that reference to exactly one PipingProject.GetPnPDrawingFiles() entry by normalized full-path equality, then uses the confirmed DataLinksManager.SelectAcPpRowIds(int dwgid) overload with the resolved PnPProjectDrawing.Id. It does not open or query the active Ortho database for Piping rows.

The production resolver has no fallback property-name search. If the exact contract is unavailable at runtime it reports ORTHO_MODEL_FILES_API_UNSUPPORTED rather than guessing.