Repository navigation
feat: read Tianzheng TDBXDATAMAP property blocks - #1275
Open
WallanceLee wants to merge 1 commit into
Open
WallanceLee wants to merge 1 commit into
WallanceLee wants to merge 1 commit into
Conversation
Tangent (TArch / Tianzheng, 天正) stores its custom objects (TCH_* / TDb*) as
ObjectARX entities. When they are saved without the application present they end
up as proxy entities carrying the original object payload, and that payload
contains a self-describing property block terminated by the
TDBXDATAMAP_BLOCK_BEGIN_ / TDBXDATAMAP_BLOCK_END_ marker pair.
The block is written through AcDbDwgFiler, so it uses the ordinary DWG string
encoding (BitShort character count followed by UTF-16LE). It is sparse: only
properties that differ from their default are present, and different classes
carry different properties. Values may be numeric text or localized text, e.g.
PIPE_SYSTEM_NAME = 消防
PIPE_THICK = (present, value written natively rather than as text)
TchDataMap decodes the block and exposes both the ordered entry list and a
name/value map. It reuses IDwgStreamReader.ReadVariableText(), so the string
encoding stays in one place, and it restores the reader position when a string
cannot be decoded so the caller can carry on with the enclosing object.
The tests run against retained payloads of real proxy entities, embedded as
base64 so no external data files are needed. They cover an object with
properties, an object whose property map is empty, and a truncated payload.
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
Tangent (TArch / 天正) stores its custom objects (
TCH_*/TDb*) as ObjectARX entities.When a drawing is saved without the application present, those objects end up as proxy entities
that retain the original object payload. That payload contains a self-describing property block
terminated by the
TDBXDATAMAP_BLOCK_BEGIN_/TDBXDATAMAP_BLOCK_END_marker pair.This PR adds a reader for that block, so the named properties Tianzheng stores on its objects
become available without implementing each object type.
The block is written through
AcDbDwgFiler, so it uses the ordinary DWG string encoding(
BitShortcharacter count followed by UTF-16LE) and no new bit-level logic is needed —TchDataMapreusesIDwgStreamReader.ReadVariableText().Real decoded example:
Tasks done in this PR
TchDataMapto decode the Tianzheng property block.reading the enclosing object.
data files are required.
Related Issues / Pull Requests
TCHcustom entity parsing) — this covers the first, self-describing partof that request.
ProxyEntity.Data/ProxyObject.Data. That is thesource this reader consumes on the DWG path; the two are independent but fit together.
notes below.
Notes for reviewer
Scope. This deliberately does not touch the object model. It decodes one self-contained
structure and hands back a dictionary, so it can be reviewed and merged independently of any
decision about how
TCH_*objects should eventually be modelled.Why not through the proxy readers (#1148). Routing these objects through
readProxyEntity()does not add anything:
CadEntityTemplatealready populatesProxyGeometriesfor every entitytemplate,
UnknownEntityincluded, so the proxy graphics were never lost. On top of that thesaved proxy graphics of Tianzheng objects contain only
PUSH_MATRIX/POP_MATRIXand zerogeometry primitives — I measured this over 400 entities, which matches the proxy dialog reporting
"entities with real graphics: 0".
Two properties of the format that shape the API:
different classes carry different properties (184 of 600 sampled objects had
PIPE_SYSTEM_NAME, 86 had theVPIPE_DIM_*group). Callers must look properties up by name.threshold; otherwise it writes the native type. So the block reliably tells you which
properties exist and gives you some values. That is why
Entries(the ordered raw list) isexposed alongside
Properties, and why a name may appear with anullvalue.Pairing is heuristic. Values such as
DN25are indistinguishable from names by shape, so anaive every-other-entry pairing mis-classifies them. The implementation requires an entry to be
upper-case ASCII, and an entry containing digits is only treated as a name when it also contains
an underscore.
Test data. The payloads are the retained data of real proxy entities from a Tianzheng
plumbing drawing (
TCH_PIPE, class id 575, andTCH_PIPEFITTING, class id 576). They areembedded as base64 to keep the test self-contained.
Verification. Built and tested against current master (3.8.10) with
net9.0:Happy to restructure if you would prefer this to live somewhere else, or to split the
disassembly-derived notes (field order per class) into a separate document.