DWG writer: text styles get the text-style table as their xref block handle
Maintainers usually reply within 3 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 81/100
Research direction
Start by reading DwgObjectWriter.writeTextStyle and compare its final handle reference with the corresponding writes for other table entries. The report gives a minimal reproduction using an empty CadDocument and says BricsCAD V22 AUDIT flags the text-style xref block handle; confirm the output handle is null for a style without an xref. Done when that audit finding is gone for the reproduced file.
Written by the indexing model from the issue text.
Description
Version: 3.8.30. The same line is on master today.
What happens: DwgObjectWriter.writeTextStyle writes the text-style table handle in the slot where the DWG format has the entry's xref block handle. That handle should be null for a style that does not come from an xref. The method ends with:
this._writer.HandleReference(DwgReferenceType.HardPointer, this._document.TextStyles);
The other table entries write a null handle there. Layers, line types and the others use HandleReference(DwgReferenceType.HardPointer, 0) or null.
BricsCAD V22's AUDIT reports it for every text style, including the Standard style of an empty new CadDocument(ACadVersion.AC1024):
Name: AcDbTextStyleTableRecord(2D)
Value: Is not externally dependent on an Xref, but XRefBlockId ((4)) is not Null
Validation: Invalid
Default value: Set to Null
Here (4) is the handle of the text-style table in that file.
Suggested fix:
this._writer.HandleReference(DwgReferenceType.HardPointer, 0);
To reproduce:
var doc = new CadDocument(ACadVersion.AC1024);
using (var w = new DwgWriter("empty.dwg", doc)) w.Write();
Open empty.dwg in BricsCAD, then run AUDIT and answer N.
For context: BricsCAD's AUDIT of that empty document reports 16 findings in all. Besides this one and TILEMODELIGHTSYNCH, the others are default values:
- TEXTSIZE, PSOLWIDTH, LENSLENGTH and 3DDWFPREC are 0;
- the Standard style's last height is 0;
- the active viewport's snap spacing is 0;
- the model layout lacks the ModelType plot flag;
- the TABLESTYLE has a null text style;
- there are two invalid named-object dictionary entries, one of them ACAD_FIELDLIST.
These may be related to #834 and #1327. Every file opens and displays correctly; BricsCAD repairs all of them when it opens the file.
- 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
-
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
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
DomCR/ACadSharp#1334 · 1 comment ·
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