R12 DXF: POLYLINE/VERTEX with subclass markers dropped ("same key has already been added")
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start by reading DxfSectionReaderBase.readLegacyPolyline, readVertex, and readPolyline, which the issue identifies as the R12 parsing path. Reproduce with an AC1009 DXF containing group 100 subclass markers on POLYLINE and VERTEX records, then trace how those markers enter map.SubClasses. Done when the polyline and its vertices load without the duplicate-key exception and the markers are ignored for R12.
Written by the indexing model from the issue text.
Description
Describe the bug
A DXF read by the R12 rules ($ACADVER AC1009, or no version at all) whose POLYLINE and VERTEX records carry subclass markers loses every such polyline. IxMilia.Dxf writes 100 AcDb2dPolyline on every POLYLINE even for R12, so its R12 exports hit this.
The R12 path (readLegacyPolyline) reads the records with a map that already holds the subclass; when the record then contains 100 AcDb2dVertex (or AcDb2dPolyline), readVertex / readPolyline call map.SubClasses.Add(...) for a key that is already there, which throws ArgumentException: An item with the same key has already been added. The polyline and its vertices are dropped (measured on an R12 export of ours: 5 of 12 entities lost).
R12 has no subclass markers, so the R12 readers could ignore group 100, or use TryAdd.
To Reproduce
- Write an R12 DXF with IxMilia.Dxf 0.8.4 containing one 2D POLYLINE with three VERTEX records (or add
100/AcDb2dPolylineto the POLYLINE and100/AcDb2dVertexto each VERTEX of any AC1009 file). new DxfReader(stream).Read().- The polyline is missing from the model space and a notification is raised.
Expected behavior
The polyline is read with its vertices; the markers are ignored in R12.
Version
ACadSharp 3.8.0 (NuGet). The same code is on master (v3.8.10): DxfSectionReaderBase.readLegacyPolyline and readVertex (map.SubClasses.Add(DxfSubclassMarker.PolylineVertex, ...)).
We work around it by stripping group 100 from POLYLINE and VERTEX records of R12 files before reading.
- Dominant language
- C#
- Stars
- 873
- Forks
- 223
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 28
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DomCR/ACadSharp
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
DWG writer: text styles get the text-style table as their xref block handlePossibly taken @menes97 claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 81/100
Maintainers usually reply within 3 days
-
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 3 days
-
DwgWriter writes a null shape-file handle for SHAPE entities (WriteShapes = true)Possibly taken @menes97 claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
DwgReader reads a color-book entity's Color as ByBlock instead of the book's colorPossibly taken @menes97 claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
Similar issues
-
hand-to-AI
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
CactuseSecurity/firewall-orchestrator#5803 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
bug python
Difficulty 1/5 Under an hour Newbie friendliness 88/100
ilia-sokolov/OfficeAgent.NET#89 ·
Maintainers usually reply within 13 days