Repository navigation
feat: read the retained data of proxy entities and objects - #1274
Open
WallanceLee wants to merge 1 commit into
Open
WallanceLee wants to merge 1 commit into
WallanceLee wants to merge 1 commit into
Conversation
`readCommonProxyData` stopped right before the retained data of the original object, with a
TODO noting that the section cannot be read. That data is the only place where a custom object
survives once it has been saved as a proxy, so leaving it unread makes the payload of any
custom object inaccessible to a consumer of the file.
The section has no length of its own: it extends from the end of the proxy fields up to the
start of the handle section. The reader already computes that offset when it splits the object
stream for R2010 and later, so the value is kept in a field and the remaining bits are read as
the data.
ProxyObject already exposed a Data stream, filled from group 311 in DXF. ProxyEntity had no such
member, so it gets one with the same shape and DXF code. Before R2010 the handle section offset is
not encoded in the file, sections without a length cannot be delimited, and the data is left unset
as it was.
Verified on real drawings, comparing the reader with and without the change over 21 DWG files
(1,607,215 entities in total):
- proxy data decoded: 0 bytes before, 2358 bytes after
- entity count and a per-document fingerprint of entity types and handles: identical in both
runs, no file differs, so consuming the section does not disturb the reads that follow it
This was referenced Oct 8, 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.
Description
readCommonProxyDatastopped right before the retained data of the original object:That section is the only place where a custom object survives once it has been saved as a proxy, so
while it stays unread the payload of any custom object is inaccessible to a consumer of the file.
The section has no length of its own: it extends from the end of the proxy fields up to the start of
the handle section. The reader already computes that offset when it splits the object stream for
R2010 and later:
So the value is kept in a field and the remaining bits are read as the data.
ProxyObjectalready exposed aDatastream, filled from group 311 in DXF.ProxyEntityhad nosuch member, so it gets one with the same shape and the same DXF code.
Before R2010 the handle section offset is not encoded in the file, sections without a length cannot
be delimited, and the data is left unset exactly as it was before.
Tasks done in this PR
ProxyEntity.Data(group 311), matching the memberProxyObjectalready has.Related Issues / Pull Requests
DWG path. Independent changes, but they fit together.
stored natively through the proxy readers, which consumes the wrong bits; the retained data of
the objects that really are proxies was never read instead.
Notes for reviewer
Verification. I compared the reader with and without the change over 21 DWG files
(1,607,215 entities in total), because consuming the section advances the object reader and could
have disturbed the reads that follow:
Two files in that set contain proxies (
A3____.dwg: 2 proxies, 58 bytes; a 23-proxy drawing:2,300 bytes); the other 19 have none and are unchanged, which is the expected no-op case.
No regression test included. A test needs a DWG that actually contains a proxy entity, and the
ones I have are 579 KB and 643 KB, larger than I wanted to add to
samples/without asking. I amhappy to add one if you want the test, or to use a file you prefer — please say which.
Scope. This only exposes the bytes. Interpreting them is what tells the two PRs apart: reading
the payload is now possible, what a given application stores in it is a separate question.
Out of scope, but worth knowing. The section is measured in bits and I round up to whole bytes,
so the last byte can carry up to 7 padding bits that belong to the handle section. For a caller that
parses the payload from the start this makes no difference; a caller that walks it from the end
would need the exact bit length, which is why the offset is kept in a field rather than discarded.