Repository navigation
DWG reader: keep plot style, plot view and xref block handles - #1284
Open
jarrett-meyer wants to merge 1 commit into
Open
jarrett-meyer wants to merge 1 commit into
jarrett-meyer wants to merge 1 commit into
Conversation
The DWG reader read these handles and discarded them: - entity plot style flags and plot style handle (named plot styles), now Entity.PlotStyleFlags and Entity.PlotStyleHandle; - layer plot style handle, now set to Layer.PlotStyleName as the DXF reader already does; - layer external reference block handle, which was stored in an unused LayerControlHandle template property, now Layer.XrefBlockHandle; - plot settings plot view handle, now PlotSettings.PlotViewHandle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 13, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The DWG reader reads several handles and then throws them away. This PR keeps them on the model so callers can use them, for example to plot drawings with named plot styles. Split out of #1272 as requested.
readCommonEntityDataread the plot style flags (BB) and the plot style handle and discarded both. They are now inEntity.PlotStyleFlags(0 = by layer, 1 = by block, 3 = handle present) andEntity.PlotStyleHandle. The handle points to an entry of theACAD_PLOTSTYLENAMEdictionary.CadLayerTemplatehad the build ofPlotStyleHandlecommented out, soLayer.PlotStyleNamewas always 0 for DWG files. It is now set from the handle, as the DXF reader already does with code 390.CadLayerTemplate.LayerControlHandleis the external reference block handle (the existing TODO pointed this out), and nothing used that property. It is now exposed asLayer.XrefBlockHandle, and the unused template property is removed. This gives a reliable link from an xref-dependent layer to its xref block, even when theXREF|prefix of the layer name is stale.PlotSettings.PlotViewHandle.These are exposed as raw handles, like the existing
Layer.PlotStyleName, because the plot style name entries have no model class yet. I can change them to resolved objects if you prefer.Tests
The full
ACadSharp.Testssuite passes on net9.0 (2432 passed, 2 skipped). I did not add tests: the writer does not produce named plot styles or xref-dependent layers, so a meaningful synthetic DWG cannot be created for these paths. They were checked against real drawings that I cannot share.🤖 Generated with Claude Code