Skip to content

Add DWG reading for BLOCKLINEARPARAMETER#1097

Open
mdelanno wants to merge 2 commits into
DomCR:masterfrom
mdelanno:port-block-linear-parameter
Open

Add DWG reading for BLOCKLINEARPARAMETER#1097
mdelanno wants to merge 2 commits into
DomCR:masterfrom
mdelanno:port-block-linear-parameter

Conversation

@mdelanno

@mdelanno mdelanno commented May 26, 2026

Copy link
Copy Markdown

Summary

Adds DWG read support for the BLOCKLINEARPARAMETER object. The data-model class BlockLinearParameter already existed, but it was never read by DwgObjectReader (no case and no reader method), so its values were lost
when loading a drawing.

Changes

  • BlockLinearParameter: adds BaseLocation, Minimum, Maximum, Increment and the Values list (the discrete allowed distances).
  • New LinearParameterBaseLocation enum (start point / middle point).
  • New CadBlockLinearParameterTemplate (mirrors CadBlockRotationParameterTemplate).
  • readBlockLinearParameter in DwgObjectReader.Objects.cs + the matching case DxfFileToken.ObjectBlockLinearParameter in the reader switch.

Implementation note

readBlockLinearParameter reads the connection table with a fixed sequence instead of reusing readBlock2PtParameter, because the generic connection-list loop in readBlock2PtParameter was not byte-compatible with the blocks I tested. I kept the two readers separate to avoid changing the existing rotation path, but I'm happy to align readBlockLinearParameter with readBlockRotationParameter if you prefer the shared helper.

Testing

Validated against a real dynamic-block library: the distance min/max, base location and discrete value list extracted from each linear parameter match a known-good reference exactly. No sample DWG is added here because the blocks are proprietary, but I can provide a minimal repro if that would help.

Adds reading support for the BLOCKLINEARPARAMETER object, which was
missing from the DWG reader (only the data model class existed).

- BlockLinearParameter: add BaseLocation, Minimum, Maximum, Increment and
  the Values list (the discrete allowed distances).
- LinearParameterBaseLocation: new enum (start point / middle point).
- CadBlockLinearParameterTemplate: new template mirroring the rotation one.
- readBlockLinearParameter: self-contained reader using a fixed sequence for
  the connection table, validated against real dynamic blocks (it does not
  reuse readBlock2PtParameter, whose generic connection-list loop is not
  byte-compatible with these blocks).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@DomCR

DomCR commented May 29, 2026

Copy link
Copy Markdown
Owner

Hi @mdelanno,

The tests are not passing, this needs another iteration.

Updated parameter reading logic to enhance reusability by introducing `readBlock2PtParameter`. Simplified `readBlockLinearParameter` by delegating common operations and adjusted related variable handling. These changes improve code readability and maintainability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants