Repository navigation
Read dimension object context data from DWG and DXF - #1272
Open
jarrett-meyer wants to merge 4 commits into
Open
jarrett-meyer wants to merge 4 commits into
jarrett-meyer wants to merge 4 commits into
Conversation
DomCR
reviewed
Oct 8, 2026
DomCR
reviewed
Oct 8, 2026
jarrett-meyer
force-pushed
the
feature/dwg-reader-plotstyle-handles
branch
from
October 8, 2026 12:28
17a3d30 to
17034a5
Compare
Owner
|
For this PR please focus it on "dimension context data", the other changes should be in separated PRs, thanks. |
Annotative dimensions have one ACDB_*DIMOBJECTCONTEXTDATA_CLASS object per annotation scale, each pointing to the anonymous block with the dimension graphics for that scale. These objects were read as unknown non-graphical objects, so the per-scale blocks could not be found. Add DimensionObjectContextData with the scale and the block, and read it for every DIMOBJECTCONTEXTDATA class. Only the handles are read, not the data fields, so both writers skip it like other partially supported objects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Address review: dispatch through the switch with DxfFileToken constants instead of a separate check. DWG files store the concrete ACDB_*DIMOBJECTCONTEXTDATA_CLASS subclass names, so each is listed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DWG files store the concrete ACDB_*DIMOBJECTCONTEXTDATA_CLASS names; there is no ACDB_DIMOBJECTCONTEXTDATA_CLASS class. Make DimensionObjectContextData an abstract base (AcDbDimensionObjectContextData) and add one class per type with its real DXF name and subclass marker: aligned, angular, diametric, ordinate, radial and radial large. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read the per-scale text location, text rotation, default text location flag, overridden dimension variables (DIMTOFL, DIMSOXD, DIMTIX and the override flags), arrow flips and the type-specific points of each ACDB_*DIMOBJECTCONTEXTDATA_CLASS object, and read these objects from DXF. The DWG bit layout was decoded from a drawing made in AutoCAD and checked against its DXF export: text location is first, and DIMATFIT and DIMTMOVE are stored as single override bits, so their values are only read from DXF. The jogged radial class name is ACDB_RADIMLRGOBJECTCONTEXTDATA_CLASS and its data extends the radial one. Add samples/annotative with the drawing (7 annotative dimensions at 1:1 and 1:20, some with per-scale overrides) and tests comparing DWG and DXF. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jarrett-meyer
force-pushed
the
feature/dwg-reader-plotstyle-handles
branch
from
October 13, 2026 13:34
17034a5 to
23555b6
Compare
Author
|
Done. This PR now only contains the dimension object context data. The other changes are in separate PRs:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Annotative dimensions have one
ACDB_*DIMOBJECTCONTEXTDATA_CLASSobject per annotation scale. Each one points to the anonymous block with the dimension graphics for that scale, and stores the text and arrow placement for that scale. These objects were read asUnknownNonGraphicalObject, so the per-scale blocks and data could not be used.This PR adds the dimension object context data classes and reads them from DWG and DXF.
Model
DimensionObjectContextData : AnnotScaleObjectContextData(abstract) withBlock,TextLocation,TextRotation,TextMovement,DimensionTextArrowFit,IsDefaultTextLocation, the arrow flip flags, the text inside/outside extension flags, andOverrideFlags.AlignedDimensionObjectContextData(ACDB_ALDIMOBJECTCONTEXTDATA_CLASS):DimensionLinePointAngularDimensionObjectContextData(ACDB_ANGDIMOBJECTCONTEXTDATA_CLASS):ArcPointDiametricDimensionObjectContextData(ACDB_DMDIMOBJECTCONTEXTDATA_CLASS):FirstArcPoint,DefinitionPointOrdinateDimensionObjectContextData(ACDB_ORDDIMOBJECTCONTEXTDATA_CLASS):DefinitionPoint,LeaderEndpointRadialDimensionObjectContextData(ACDB_RADIMOBJECTCONTEXTDATA_CLASS):FirstArcPointRadialDimensionLargeObjectContextData(ACDB_RADIMLGOBJECTCONTEXTDATA_CLASS):OverrideCenter,JogPointDxfFileTokenandDxfSubclassMarkerconstants for each class.Reading
readUnlistedTypeswitch with theDxfFileTokenconstants.DxfObjectsSectionReaderreads the same fields.Writing
The DWG and DXF writers skip these objects, the same way they handle other partially supported objects, so writing keeps its current behavior.
Tests
DimensionObjectContextDataTestsreads a new sample,samples/annotative/annotative_dimensions_AC1032.dwgand its.dxfexport:DwgAndDxfMatch: the DWG and DXF readers produce the same context data.ReadDwg: each dimension type gets the expected subclass, a distinct block per scale, and the expected points.ReadOverrides: the per-scale overrides (text inside/outside, arrow fit, text movement, arrow flip) are read from both formats.The sample has no data for
RadialDimensionLargeObjectContextData: the jogged radial dimension is not read as an entity, so its context data is not reached.The full
ACadSharp.Testssuite passes on net9.0 (2441 passed, 2 skipped).As requested, the other changes that were in this PR are now in separate PRs:
🤖 Generated with Claude Code