Repository navigation
Preserve orphan and nested FIELD objects in DXF output - #1351
Open
jogibear9988 wants to merge 1 commit into
Open
jogibear9988 wants to merge 1 commit into
jogibear9988 wants to merge 1 commit into
Conversation
Port acad-ts 5bf4c0ee and 60b92017. FIELDLIST references can contain orphan fields whose handles and owners have not been assigned. Register their parent graphs before HANDSEED and the DXF class table, preserve existing child/dictionary ownership, and enqueue nested FIELD records for output. Retain C# observable child collections and existing handle deduplication. Six regressions cover list/dictionary roots, nested references, child-first order, high handles, extension dictionaries and stable repeated writes.
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.
Description
A FIELD referenced only by a FIELDLIST can reach the DXF writer without an owner or registered handle. This can throw while writing the owner reference and leaves HANDSEED/the class table inconsistent with objects discovered later. Nested FIELD children are also referenced with group 360 but never queued for the OBJECTS section, so their records can be omitted.
Prepare the reachable FIELD graphs before writing the header and class table: preserve existing child/dictionary owners, assign a list owner only to otherwise orphan fields, register parent graphs before their children, and refresh DXF classes when registration adds fields. Queue nested children during output and reuse the existing handle deduplication so fields shared through multiple references are emitted once.
Tasks done in this PR
Related Issues / Pull Requests
Extracted from #1316, source commit
fe5d20d1, based on acad-ts5bf4c0eeand60b92017. This PR contains one implementation commit on currentmaster(90c6f871) and has no dependency on the modeler or other changes in #1316. The aggregate PR remains unchanged.Notes for reviewer
Minimal reproduction:
After the fix, both FIELD records are emitted with valid ownership/child references, and their handles are below the written HANDSEED. The tests inspect the actual DXF records, reject duplicate FIELD handles, check registration in the document, and confirm a second write keeps the same handle seed.
Validation on this isolated branch:
dotnet test src/ACadSharp.Tests/ACadSharp.Tests.csproj -f net9.0 --filter FullyQualifiedName~FieldWriterRegressionTests: 6 passed.ArcTests.CreateFromBulgeTest,ArcTests.GetCenter, and the culture/scientific-format case inDimensionStyleTests.GetLinearMeasurementText.git diff --checkpasses.AI-assisted port and extraction, with source comparison, isolated regression testing and review of the resulting diff.