DwgReader leaves the value of a table block cell as a default CadValue

Open Beginner friendly
#1,264 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
79/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
backend

Research direction

Start in DwgObjectReader.Entities.cs at readTableCellContent, specifically the TableCellContentType.Block case; compare its handling with the DXF cell value described in the issue. The repository samples sample_AC1032.dwg and sample_AC1032_ascii.dxf reproduce the discrepancy, including cells at row 1, column 3 and column 4. Done means block-cell values read from DWG are empty rather than unknown values with data, matching the DXF result.

Written by the indexing model from the issue text.

Description

When a table cell contains a block, DwgReader reads the block record handle of the cell content and leaves CellContent.CadValue as it was created: ValueType Unknown, Flags 0, so IsEmpty is false. AutoCAD stores the value of the same cells as an empty string.

How to reproduce, with the samples in the repository (the DXF was saved by AutoCAD from the same drawing):

CadDocument dwg = DwgReader.Read("samples/sample_AC1032.dwg");
CadDocument dxf = DxfReader.Read("samples/sample_AC1032_ascii.dxf");

CadValue fromDwg = dwg.GetCadObject<TableEntity>(0xA35).Rows[1].Cells[3].Content.CadValue;
CadValue fromDxf = dxf.GetCadObject<TableEntity>(0xA35).Rows[1].Cells[3].Content.CadValue;
ValueType Flags IsEmpty Value
sample_AC1032.dwg Unknown 0 false null
sample_AC1032_ascii.dxf String 1 true null

Cell 4 of the same row gives the same result, and so do sample_AC1024.dwg and sample_AC1027.dwg. In the DXF, AutoCAD writes the value of both cells as 301 CELL_VALUE, 93 1, 90 4, 94 0, 300, 302, 304 ACVALUE_END.

The difference comes from readTableCellContent in DwgObjectReader.Entities.cs: the TableCellContentType.Block case reads only the handle and never sets the value.

Expected: the value of a block cell is read as empty, as in the file saved by AutoCAD, so that it is not taken for a value with data.

I found this while testing the CadValue writer in #1263: the DXF round trip writes these cells back as unknown values with data.

Dominant language
C#
Stars
873
Forks
223
Avg merge
1d 15h
Merged PRs (30d)
28

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DomCR/ACadSharp

All issues in DomCR/ACadSharp

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.