Skip to content

feat: decode LAYER table and resolve BYLAYER colors across scene, SVG, and 2D viewer - #74

Merged
mahach666 merged 3 commits into
mainfrom
feat/layers-and-bylayer
Dec 2, 2026
Merged

mahach666 merged 3 commits into
mainfrom
feat/layers-and-bylayer

Conversation

@mahach666

Copy link
Copy Markdown
Contributor

Summary

  • Add DwgLayerInfo and LayerParser to decode LAYER (0x33) table records across R2004 (inline codepage strings) and R2007–R2018 (separate UTF-16LE string stream):
    • Layer Name, Handle, ACI ColorIndex, 24-bit TrueColorRgb, IsFrozen, IsOff/IsOn, IsFrozenInNewViewports, IsLocked, IsPlottable, LineWeight, and IsVisible.
  • Add DwgHandle.ResolveTarget(ownerHandle) for absolute and relative DWG handle codes (6, 8, 10, 12) and extract each entity's LayerHandle / LayerName in EntityDecoder (R2010+ handle stream and R2004 decoded bodies).
  • Add DwgEntity.EffectiveColorIndex and EffectiveTrueColorRgb to resolve BYLAYER (256) colours from the owning layer while keeping raw ColorIndex untouched.
  • Add DwgReaderOptions.ReadLayers (default true) and expose DwgDocument.Layers.
  • Wire Layers and resolved BYLAYER colours into:
    • DwgJsonExporter (layers array plus layer, layerHandle, effectiveColorIndex on entities)
    • DwgSceneReader (ColourOf resolves BYLAYER colours onto SceneInstance)
    • DwgSvgExporter (resolves BYLAYER stroke/fill colours)
    • dwgio inspect (prints decoded Layers: summary)
    • DwgCadHtmlViewer (exports layer list, initializes AutoCAD On/Frozen visibility, adds interactive layer visibility chips in the sidebar, displays Layer in Properties, and renders BYLAYER colours)
  • Add LayersTests covering R2010/R2013/R2018 public fixtures, synthetic R2018 & R2004 layer records, handle offset codes, ReadLayers = false, and JSON/Scene/SVG/CLI/2D-viewer integration.

Stacked on #73.

Verification

  • dotnet build DwgIO.slnx -c Release — 0 warnings, 0 errors
  • dotnet test DwgIO.slnx -c Release --no-build — 286 passed, 0 failed, 1 skipped (unconfigured private fixtures) on both net8.0 and net10.0
  • BuildNativeCoreOnly=true passed cleanly for both DwgIO.csproj and DwgIO.Scene.csproj

@mahach666
mahach666 changed the base branch from feat/header-variables to main December 2, 2026 10:40
@mahach666
mahach666 merged commit cb15281 into main Dec 2, 2026
12 checks passed
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.

1 participant