From a47aa016a28d8474462940af31fd4e5c3239d178 Mon Sep 17 00:00:00 2001 From: Odin Glynn-Martin Date: Fri, 20 Nov 2026 07:21:22 -0800 Subject: [PATCH 1/3] Read bounded SOLIDWORKS view records with archive context --- .../Archive/SolidworksConfigViewRecords.md | 19 ++ .../ViewListWindowsChangeContext.md | 12 + .../Maintenance/ConversionBacklog.md | 11 + .../Reference/Adapters/Solidworks.md | 5 + .../measurements/2026/ConfigViewSource01.json | 294 ++++++++++++++++++ re/solidworks/records/ConfigViewSlice2026.md | 106 +++++++ re/tooling/sw2026/CheckCfgViews.py | 244 +++++++++++++++ .../Archive/Bodies/ChangeContext.py | 17 + .../Archive/Bodies/IsBranchTaken.py | 9 + .../Bodies/Layouts/Config/GeometryFields.py | 58 ++++ .../Bodies/Layouts/Config/ViewFields.py | 69 ++++ .../Archive/Bodies/Reading/ReadActions.py | 4 + .../Archive/Bodies/Reading/ReadContextMut.py | 8 + .../Archive/Config/Members/CfgMemberTypes.py | 9 +- .../Archive/Config/Members/CheckCfgMember.py | 4 + .../Archive/Config/Members/CheckCfgView.py | 16 + .../Archive/Config/Members/MemberLayouts.py | 8 + .../Solidworks/Configuration/CfgViewTests.py | 86 +++++ .../Solidworks/Configuration/ReadViewCase.py | 26 ++ 19 files changed, 1003 insertions(+), 2 deletions(-) create mode 100644 Documentation/Changes/Solidworks/Archive/SolidworksConfigViewRecords.md create mode 100644 Documentation/Gotchas/Conversion/Solidworks/Archive/Configuration/ViewListWindowsChangeContext.md create mode 100644 re/solidworks/measurements/2026/ConfigViewSource01.json create mode 100644 re/solidworks/records/ConfigViewSlice2026.md create mode 100644 re/tooling/sw2026/CheckCfgViews.py create mode 100644 src/convert/adapters/solidworks/Archive/Bodies/ChangeContext.py create mode 100644 src/convert/adapters/solidworks/Archive/Bodies/Layouts/Config/GeometryFields.py create mode 100644 src/convert/adapters/solidworks/Archive/Bodies/Layouts/Config/ViewFields.py create mode 100644 src/convert/adapters/solidworks/Archive/Bodies/Reading/ReadContextMut.py create mode 100644 src/convert/adapters/solidworks/Archive/Config/Members/CheckCfgView.py create mode 100644 tests/Convert/Solidworks/Configuration/CfgViewTests.py create mode 100644 tests/Convert/Solidworks/Configuration/ReadViewCase.py diff --git a/Documentation/Changes/Solidworks/Archive/SolidworksConfigViewRecords.md b/Documentation/Changes/Solidworks/Archive/SolidworksConfigViewRecords.md new file mode 100644 index 0000000000..303ba47217 --- /dev/null +++ b/Documentation/Changes/Solidworks/Archive/SolidworksConfigViewRecords.md @@ -0,0 +1,19 @@ +# SOLIDWORKS configuration view records + +The internal configuration member reader accepts one concrete +version-19000 `moView_c` record with compact transforms, empty linked +rows and absent optional lists. Supply its actual archive map snapshot. +The reader retains the stored name, scalars, both transform forms and +the class and object slots. + +The shared body executor supports native zero-byte context assignments, +bit sets and clears. A view uses this state across its two list windows. +The two disclosed standard view groups and an independent active-condition +contrast are covered by prepared merge-queue process cases. + +Populated lists, extended transforms, complete Config-0 admission and +native writing require separate qualification. + +[Exact evidence and process scope](../../../../re/solidworks/records/ConfigViewSlice2026.md) + +[Adapter guide](../../../Reference/Adapters/Solidworks.md) diff --git a/Documentation/Gotchas/Conversion/Solidworks/Archive/Configuration/ViewListWindowsChangeContext.md b/Documentation/Gotchas/Conversion/Solidworks/Archive/Configuration/ViewListWindowsChangeContext.md new file mode 100644 index 0000000000..acf66f157a --- /dev/null +++ b/Documentation/Gotchas/Conversion/Solidworks/Archive/Configuration/ViewListWindowsChangeContext.md @@ -0,0 +1,12 @@ +# View list windows change archive context + +The ordinary schema-one view reads two optional lists while `ctx87c` +is set. That state changes at field boundaries even when both lists +are absent. Entering with `ctx3d0` also sets condition bit `0x200` +for the two windows and clears it before the trailing view fields. + +Keep those changes in the archive context and leave the view's wire +position untouched. A cleared condition bit leaves unrelated bits in +place. The stored list flags still consume their signed words. + +[Native boundaries and authored state contrast](../../../../../../re/solidworks/records/ConfigViewSlice2026.md) diff --git a/Documentation/Maintenance/ConversionBacklog.md b/Documentation/Maintenance/ConversionBacklog.md index db42f73582..057f928bfa 100644 --- a/Documentation/Maintenance/ConversionBacklog.md +++ b/Documentation/Maintenance/ConversionBacklog.md @@ -188,6 +188,17 @@ Populated thread maps and complete configuration support have separate exits. [Change entry](../Changes/Solidworks/Archive/SolidworksConfigThreadMarks.md) +### B04-SW2026-CONFIG-VIEWS + +The PR #121 takeover team owns this bounded `moView_c` reader on +`codex/solidworks-config-view-context`. It depends on the shared +member reader and field actions from #187. Exit requires both disclosed +view groups, the authored archive state and refusal cases, and current +revision queue and review evidence. Full configuration admission, +annotation view owners and populated presentation lists retain separate +exits. +[Change entry](../Changes/Solidworks/Archive/SolidworksConfigViewRecords.md) + ### B08-SW2026-TERMINAL-FIN The PR #121 takeover agent owns this active reader compatibility task. diff --git a/Documentation/Reference/Adapters/Solidworks.md b/Documentation/Reference/Adapters/Solidworks.md index f00a7b0af6..8a0e7d5286 100644 --- a/Documentation/Reference/Adapters/Solidworks.md +++ b/Documentation/Reference/Adapters/Solidworks.md @@ -93,6 +93,11 @@ remain separate. A present thread manager retains the signed wire word and its runtime Boolean. [Thread and mark record scope](../../Changes/Solidworks/Archive/SolidworksConfigThreadMarks.md) +The bounded configuration member reader also handles the ordinary view +record with compact transforms and empty presentation lists. Context +changes govern both optional list windows in the same archive. +[Configuration view scope](../../Changes/Solidworks/Archive/SolidworksConfigViewRecords.md) + The KeyWords framer serializes a typed XML tree with the native stream marker, UTF-8 declaration and explicit empty tag style. [KeyWords framing scope](../../Changes/Solidworks/Archive/SolidworksKeywordFraming.md) diff --git a/re/solidworks/measurements/2026/ConfigViewSource01.json b/re/solidworks/measurements/2026/ConfigViewSource01.json new file mode 100644 index 0000000000..d6ef959c0b --- /dev/null +++ b/re/solidworks/measurements/2026/ConfigViewSource01.json @@ -0,0 +1,294 @@ +{ + "archive_version": 19000, + "delivery_base": "15a4462ce69e516e36512b3185684e4778f87d30", + "native_build": "34.5.2.0604", + "native_view_serializer": { + "range": ["0x4c22c9d0", "0x4c22d028"], + "sha256": "dd858d51e82d3ff05842ef4a0c0ef1d31ff3e6cf26a34f7813247abde0ccb439" + }, + "physical_owner": "moModel_c.FUN_4c234150.f9f8", + "reference_commit": "a98e89e7eb1ebcb0e0ccfb5387ff2fdd76aec605", + "reference_source_sha256": { + "re/solidworks/records/ConfigRuntimeDescriptors2026.json": "5a6f8158c835cd6e4f105c46fb3e3f22646a7d6aeb1b89f47617da4c92baaaeb", + "re/solidworks/records/StandardViewsConstruction2026.md": "da823dd4f641ec2392aeeaf3ddcbd9c8c47bbbd1579daebe1bbfd1f1e297efef", + "re/solidworks/records/GeometryArchive2026.md": "c34d15044b8816b7c8ecebb9d9cec2324b821473477d3bf3a2c76316cdb185b5", + "re/tooling/sw2026/serial/defs/SmallCMgr.py": "76c46ab9d70235fa5346e449a34df0850484cfeb9ad10553bd5f54ff811db11d", + "src/convert/adapters/solidworks/Archive/Bodies/ChangeContext.py": "dc6d0dc58398e3e53de45ec3c30a8c19b26c6e02b11eb48ba4f710bc90d53ca0", + "src/convert/adapters/solidworks/Archive/Bodies/IsBranchTaken.py": "71f31190ed43fef58dd91f1e97eb5b521ee2c9d2ef9986451dea66047e552382", + "src/convert/adapters/solidworks/Archive/Bodies/IsFieldBranch.py": "2d151df6765beef4d0aa289da2f87bafdb466af3e6339c96fc9ae8f79a15c269", + "src/convert/adapters/solidworks/Archive/Bodies/Layouts/Config/GeometryFields.py": "8fed1b002d7861e5c6546baa193764bb3bf3a1fcb7e0249c2b87f4d9f9eaf132", + "src/convert/adapters/solidworks/Archive/Bodies/Layouts/Config/ModelFields.py": "fb679705fcb9ae37b7de314d9c12bd2433d444dce3e928fe7d8d3469116247c7", + "src/convert/adapters/solidworks/Archive/Bodies/Layouts/Config/ViewFields.py": "0bbba0a61461375afdca707ef780124b6a4fcabd62e9c521da7a213c2387c9df", + "src/convert/adapters/solidworks/Archive/Bodies/Reading/ReadControlMut.py": "99deb854ca0fd34778e05db12bd9e3e0de438afa144387719f3f673795d96027", + "src/convert/adapters/solidworks/Archive/Config/ReadConfigMut.py": "154f9b3bb35bd37a9a731ea8ef55befb5f4342b7c544d96599f6fbea0487ed48" + }, + "runtime_class": [ + "moView_c", + 1 + ], + "stream": "Contents/Config-0", + "vendor_modules": { + "sldmgu.dll": "99b6382da64df9fd37ca04720c210eaadc6750feb8cdeae6dd1289865da56e7c", + "sldmodu.dll": "569a081928ad24afac5408cc15a1034d18e89b2c5001428a64115a3cc497067e" + }, + "controls": { + "concave": { + "configuration_bytes": 22700, + "configuration_sha256": "f8b42cb72d75f14be04410c18daae6f77164e2561dd5e99d7f26a107b5b049a1", + "part_sha256": "fa1b84b7cd9e8860d549c599fdb536c6de965e3ec7b4ed5f53706cb57c743d33", + "path": "re/solidworks/v2026/corpus/local-import-readback/ConcaveOwned.SLDPRT", + "seed_relation_slots": [52,53], + "views": [ + { + "class_slot": 79, + "context": [[20591,0,1],[20599,1,0],[20599,0,1],[20615,1,0]], + "counter": [79,81], + "embedded_intervals": {"f358":[20477,20501],"f368":[20501,20535],"f370":[20535,20569]}, + "field_model_sha256": "a53c308f66d7d46c062c06edd1513361dc1c97c606df84090669c3fee2f0a402", + "interval": [20463,20623], + "name": "*Normal To", + "object_slot": 80, + "row": 0, + "wire_sha256": "bfdd2de3f9e47e264f9b4ed89c962c8686c8b5f1223fa5b2627b0eda58890035" + }, + { + "class_slot": 79, + "context": [[20731,0,1],[20739,1,0],[20739,0,1],[20755,1,0]], + "counter": [81,82], + "embedded_intervals": {"f358":[20625,20641],"f368":[20641,20675],"f370":[20675,20709]}, + "field_model_sha256": "a0c40de474a6c4e3269c497978a9d51270a014f379cbb13e8fd05af823eb3d9f", + "interval": [20623,20763], + "name": "*Front", + "object_slot": 81, + "row": 1, + "wire_sha256": "81c69427811d64d53b3334356c1cc02261fec4eb9f900b496b897add6f68a9be" + }, + { + "class_slot": 79, + "context": [[20941,0,1],[20949,1,0],[20949,0,1],[20965,1,0]], + "counter": [82,83], + "embedded_intervals": {"f358":[20765,20779],"f368":[20779,20885],"f370":[20885,20919]}, + "field_model_sha256": "67e28fc15c643960bac69ad6a81fa50b3420237174678c0bea0368747f3128d7", + "interval": [20763,20973], + "name": "*Back", + "object_slot": 82, + "row": 2, + "wire_sha256": "cdb2d89c78c1442b58c48d2b57bcd2aac82c0f9ea04c107b6dbb5c7080357640" + }, + { + "class_slot": 79, + "context": [[21151,0,1],[21159,1,0],[21159,0,1],[21175,1,0]], + "counter": [83,84], + "embedded_intervals": {"f358":[20975,20989],"f368":[20989,21095],"f370":[21095,21129]}, + "field_model_sha256": "68acb64242c3bc3dc13c1dee4fb544a0871d673f544831b4bca2c30925c8a13f", + "interval": [20973,21183], + "name": "*Left", + "object_slot": 83, + "row": 3, + "wire_sha256": "9a7c31a5af189766499894b70473c87782fb14ce27d01d19cfe935ce7a4c99a4" + }, + { + "class_slot": 79, + "context": [[21363,0,1],[21371,1,0],[21371,0,1],[21387,1,0]], + "counter": [84,85], + "embedded_intervals": {"f358":[21185,21201],"f368":[21201,21307],"f370":[21307,21341]}, + "field_model_sha256": "16f95d3a9e10cad669e2e4bc34a2e3dac96f2eefcde9e7005542be116b010ed8", + "interval": [21183,21395], + "name": "*Right", + "object_slot": 84, + "row": 4, + "wire_sha256": "07df52ce4f889a152f6457f9dc614a9c9bc7719890d580d2bb31102b22288229" + }, + { + "class_slot": 79, + "context": [[21571,0,1],[21579,1,0],[21579,0,1],[21595,1,0]], + "counter": [85,86], + "embedded_intervals": {"f358":[21397,21409],"f368":[21409,21515],"f370":[21515,21549]}, + "field_model_sha256": "a8202e8c69fa732455a9f899c9194f9efb6e0242b3970d48f25a8e12ca21b40f", + "interval": [21395,21603], + "name": "*Top", + "object_slot": 85, + "row": 5, + "wire_sha256": "0d09ea461e2509ed76f247345a685a960244ccf6cfa7cacd160d26fe21e0c58e" + }, + { + "class_slot": 79, + "context": [[21785,0,1],[21793,1,0],[21793,0,1],[21809,1,0]], + "counter": [86,87], + "embedded_intervals": {"f358":[21605,21623],"f368":[21623,21729],"f370":[21729,21763]}, + "field_model_sha256": "50a0702bec30330c7fc27ce0680ac9042d030ed9c89de3e2b855f4714ed4e99e", + "interval": [21603,21817], + "name": "*Bottom", + "object_slot": 86, + "row": 6, + "wire_sha256": "0c4cf8e29397b008d2ee58d3f7c1fdbb670b13141c2662a22ec8b863bf1438d9" + }, + { + "class_slot": 79, + "context": [[22005,0,1],[22013,1,0],[22013,0,1],[22029,1,0]], + "counter": [87,88], + "embedded_intervals": {"f358":[21819,21843],"f368":[21843,21949],"f370":[21949,21983]}, + "field_model_sha256": "a41aa01ea09cb2c890bd403597c96dde9691d612f18a1295ef5aeabd342b0257", + "interval": [21817,22037], + "name": "*Isometric", + "object_slot": 87, + "row": 7, + "wire_sha256": "111ed4e69bed499c460cea2dd7415754c96aa5617ef7354db6d8a03516f7d28b" + }, + { + "class_slot": 79, + "context": [[22225,0,1],[22233,1,0],[22233,0,1],[22249,1,0]], + "counter": [88,89], + "embedded_intervals": {"f358":[22039,22063],"f368":[22063,22169],"f370":[22169,22203]}, + "field_model_sha256": "a24ee4c3d0d3ddeb800bd1596507c04bc1cd0d8df0bf44f51cc68dbb41947352", + "interval": [22037,22257], + "name": "*Trimetric", + "object_slot": 88, + "row": 8, + "wire_sha256": "a1b57303cc29b4feb1865791080ccbc314199f7ca7186813287b3eb1ed03faf4" + }, + { + "class_slot": 79, + "context": [[22443,0,1],[22451,1,0],[22451,0,1],[22467,1,0]], + "counter": [89,90], + "embedded_intervals": {"f358":[22259,22281],"f368":[22281,22387],"f370":[22387,22421]}, + "field_model_sha256": "b0954538b249000375830acd3986714f039077124afb94a3c00dddae13eb5a68", + "interval": [22257,22475], + "name": "*Dimetric", + "object_slot": 89, + "row": 9, + "wire_sha256": "2695047cd6e8fb7a5e9769f8f2e9252bb259254641f343d77760d334ef76a131" + } + ] + }, + "ladder": { + "configuration_bytes": 25390, + "configuration_sha256": "e7e700d5b112e7d9d1b1297bac8149707e67d9aac2e3c6f890b4cb2f97b1e5b2", + "part_sha256": "55e5a9840cc78a1d4b3ac4b8de3f37540695494e4d7a0edfb3cd3a2a876e2ac6", + "path": "re/solidworks/v2026/corpus/ladder/L1_boss.SLDPRT", + "seed_relation_slots": [59,60], + "views": [ + { + "class_slot": 84, + "context": [[22368,0,1],[22376,1,0],[22376,0,1],[22392,1,0]], + "counter": [84,86], + "embedded_intervals": {"f358":[22254,22278],"f368":[22278,22312],"f370":[22312,22346]}, + "field_model_sha256": "a53c308f66d7d46c062c06edd1513361dc1c97c606df84090669c3fee2f0a402", + "interval": [22240,22400], + "name": "*Normal To", + "object_slot": 85, + "row": 0, + "wire_sha256": "bfdd2de3f9e47e264f9b4ed89c962c8686c8b5f1223fa5b2627b0eda58890035" + }, + { + "class_slot": 84, + "context": [[22508,0,1],[22516,1,0],[22516,0,1],[22532,1,0]], + "counter": [86,87], + "embedded_intervals": {"f358":[22402,22418],"f368":[22418,22452],"f370":[22452,22486]}, + "field_model_sha256": "a0c40de474a6c4e3269c497978a9d51270a014f379cbb13e8fd05af823eb3d9f", + "interval": [22400,22540], + "name": "*Front", + "object_slot": 86, + "row": 1, + "wire_sha256": "78fe973db955e6efdfc9f6965e5885eccde2b30fb70d017e6d58fc65743e87e1" + }, + { + "class_slot": 84, + "context": [[22718,0,1],[22726,1,0],[22726,0,1],[22742,1,0]], + "counter": [87,88], + "embedded_intervals": {"f358":[22542,22556],"f368":[22556,22662],"f370":[22662,22696]}, + "field_model_sha256": "67e28fc15c643960bac69ad6a81fa50b3420237174678c0bea0368747f3128d7", + "interval": [22540,22750], + "name": "*Back", + "object_slot": 87, + "row": 2, + "wire_sha256": "26a2f4bf2b1f6b68fda218223667ad3733bc6c9b69e41f136de450c96c71d50e" + }, + { + "class_slot": 84, + "context": [[22928,0,1],[22936,1,0],[22936,0,1],[22952,1,0]], + "counter": [88,89], + "embedded_intervals": {"f358":[22752,22766],"f368":[22766,22872],"f370":[22872,22906]}, + "field_model_sha256": "893118e105725a429ae41d959f742c8f336ca691e3581fa0d68f69397516cf1c", + "interval": [22750,22960], + "name": "*Left", + "object_slot": 88, + "row": 3, + "wire_sha256": "cd8f1dbffaab79262503e34ae613a0c0437593514bf942aaef1b113121698b15" + }, + { + "class_slot": 84, + "context": [[23140,0,1],[23148,1,0],[23148,0,1],[23164,1,0]], + "counter": [89,90], + "embedded_intervals": {"f358":[22962,22978],"f368":[22978,23084],"f370":[23084,23118]}, + "field_model_sha256": "48b9eda8b4f2f3bf237599d86cd753ab17ef87bd858e4270e6729bfdc0cd08c3", + "interval": [22960,23172], + "name": "*Right", + "object_slot": 89, + "row": 4, + "wire_sha256": "6e0f963d3211dba5c5e720876518d9dd4b2e8961edd12af36339f76fa0339052" + }, + { + "class_slot": 84, + "context": [[23348,0,1],[23356,1,0],[23356,0,1],[23372,1,0]], + "counter": [90,91], + "embedded_intervals": {"f358":[23174,23186],"f368":[23186,23292],"f370":[23292,23326]}, + "field_model_sha256": "c80808cc2c97237467a61ab2055a1398fe69971c461157c7d1b91a6e36488a0c", + "interval": [23172,23380], + "name": "*Top", + "object_slot": 90, + "row": 5, + "wire_sha256": "ec052f5ac1895f4baa675124bf323b26124509fc8d2c335f662941c57d382bd6" + }, + { + "class_slot": 84, + "context": [[23562,0,1],[23570,1,0],[23570,0,1],[23586,1,0]], + "counter": [91,92], + "embedded_intervals": {"f358":[23382,23400],"f368":[23400,23506],"f370":[23506,23540]}, + "field_model_sha256": "2ae803300b6e124d522db26fd58c941f67b181ac26aa7e137a483913c4337271", + "interval": [23380,23594], + "name": "*Bottom", + "object_slot": 91, + "row": 6, + "wire_sha256": "24b9192f53d361940ec2cd915e4a736adc1b2621105fe9a06785b2e967b18849" + }, + { + "class_slot": 84, + "context": [[23782,0,1],[23790,1,0],[23790,0,1],[23806,1,0]], + "counter": [92,93], + "embedded_intervals": {"f358":[23596,23620],"f368":[23620,23726],"f370":[23726,23760]}, + "field_model_sha256": "a41aa01ea09cb2c890bd403597c96dde9691d612f18a1295ef5aeabd342b0257", + "interval": [23594,23814], + "name": "*Isometric", + "object_slot": 92, + "row": 7, + "wire_sha256": "8bc391d3a71d70460d6843ba6d74bd1934cb4adb81824845216f4e74c140b813" + }, + { + "class_slot": 84, + "context": [[24002,0,1],[24010,1,0],[24010,0,1],[24026,1,0]], + "counter": [93,94], + "embedded_intervals": {"f358":[23816,23840],"f368":[23840,23946],"f370":[23946,23980]}, + "field_model_sha256": "a24ee4c3d0d3ddeb800bd1596507c04bc1cd0d8df0bf44f51cc68dbb41947352", + "interval": [23814,24034], + "name": "*Trimetric", + "object_slot": 93, + "row": 8, + "wire_sha256": "247608f8d0fbb03c20aff6206a425fadea92965937c4dab42c3151317b9bec3c" + }, + { + "class_slot": 84, + "context": [[24220,0,1],[24228,1,0],[24228,0,1],[24244,1,0]], + "counter": [94,95], + "embedded_intervals": {"f358":[24036,24058],"f368":[24058,24164],"f370":[24164,24198]}, + "field_model_sha256": "b0954538b249000375830acd3986714f039077124afb94a3c00dddae13eb5a68", + "interval": [24034,24252], + "name": "*Dimetric", + "object_slot": 94, + "row": 9, + "wire_sha256": "45de122475cc7efe94abe745f4674a788c50dc5ce0a1bdc433b02eb53b91f5b3" + } + ] + } + } +} diff --git a/re/solidworks/records/ConfigViewSlice2026.md b/re/solidworks/records/ConfigViewSlice2026.md new file mode 100644 index 0000000000..c44eebfb6c --- /dev/null +++ b/re/solidworks/records/ConfigViewSlice2026.md @@ -0,0 +1,106 @@ +# Ordinary SOLIDWORKS configuration view records + +| Delivery item | Scope | +| --- | --- | +| Task | `B04-SW2026-CONFIG-VIEWS` | +| Owner | PR #121 takeover team | +| Delivery | Separate main-target branch `codex/solidworks-config-view-context` | +| Preparation base | `15a4462ce69e516e36512b3185684e4778f87d30`, accepted #187 | +| Dependencies | [Member body reader](ConfigMemberFieldsSlice2026.md) and [field dispatch](ConfigFieldActionsSlice2026.md) | +| Exit | Both disclosed view groups and the authored context and refusal cases pass the guarded queue processes, followed by current revision CI and review | + +## Build and archive rules + +In SOLIDWORKS 2026 SP05.2 build `34.5.2.0604`, model method +`0x4c234150` reads the ten tagged objects in `moModel_c.f9f8`. +The concrete descriptor is `moView_c`, wire schema one. Its serializer +range is `[0x4c22c9d0,0x4c22d028)`, SHA-256 +`dd858d51e82d3ff05842ef4a0c0ef1d31ff3e6cf26a34f7813247abde0ccb439`. +The model module SHA-256 is +`569a081928ad24afac5408cc15a1034d18e89b2c5001428a64115a3cc497067e`. +The serializer owns the stored name, the two embedded transforms, optional +lists and scalar words. The standard model loop also assigns the runtime +view index and localizes the name. This slice retains the original wire fields. + +[Exact serializer and model loop](https://github.com/TryUniCAD/Kit/blob/a98e89e7eb1ebcb0e0ccfb5387ff2fdd76aec605/re/solidworks/records/StandardViewsConstruction2026.md#class-and-active-wire-grammar) + +The shared `mgXform_c.restore` reads one byte of matrix presence, +nine doubles when that byte is nonzero, four doubles and then a flags +byte. Without an extended payload this gives 34 or 106 bytes. The +selector is the high nibble of the last byte. The shared grammar +retains original values and delegates the known extended selectors. +The bounded member role admits the compact transforms, an empty +`f380` array and absent `f398` and `f3b0` lists. Populated linked +lists and extended transforms require separate qualification. + +[Exact matrix and transform read functions](https://github.com/TryUniCAD/Kit/blob/a98e89e7eb1ebcb0e0ccfb5387ff2fdd76aec605/re/solidworks/records/GeometryArchive2026.md#compact-transform-restore-path) + +The shared context action consumes zero wire bytes. `Assign` sets the +named state, `Set` adds the mask, and `Clear` removes the mask. These +values govern the owning archive's subsequent fields. In `moView_c`, +`ctx87c` is assigned one before each list window and zero after it. +With `ctx3d0` active the view also sets condition bit `0x200` before +both windows and clears it before `f3c0`. Unrelated condition bits +survive both operations. The flag state accompanies the reading context. + +[Context and view definition](https://github.com/TryUniCAD/Kit/blob/a98e89e7eb1ebcb0e0ccfb5387ff2fdd76aec605/re/tooling/sw2026/serial/defs/SmallCMgr.py#L408-L425) + +## Native intervals and process verification + +The [source manifest](../measurements/2026/ConfigViewSource01.json) +pins the two disclosed parts, complete Config-0 streams, exact-build +module identities, source rule hashes and per-record observations. +The complete aggregate reader at +`a98e89e7eb1ebcb0e0ccfb5387ff2fdd76aec605` was traced in memory +at the `f9f8` object action and the owning view's transform, string +and context field actions. + +| Control | Group interval | Class slot | Object slots | Map counter | Materialized seed | +| --- | --- | --- | --- | --- | --- | +| L1 boss | [22240, 24252) | 84 | 85–94 | 84 to 95 | Relation class and object 59, 60 | +| ConcaveOwned | [20463, 22475) | 79 | 80–89 | 79 to 90 | Relation class and object 52, 53 | + +Both groups declare the class once and then reuse its mapped descriptor +for nine distinct objects. Each of the twenty records executes four +`ctx87c` assignments, with no `ctx3d0` bit branch in either source. +Both transforms omit a stored matrix in the first two views. The +first transform stores nine matrix values in the remaining eight views, +and the second continues to omit the matrix. The manifest records the +actual names, framing ranges, scalar field digests, and transition offsets. + +The guarded verification process independently reads the bounded +preceding relation manager, then carries those same typed objects +into the measured view counter. Slots outside the selected records +stay unmaterialized. Each bounded read uses `ReadCfgMember` with +the actual descriptor, retains inherited entries by identity, and +consumes the whole view record. Independent wire projections +check the names, transform words and fixed suffix against the +typed values. + +An independently authored view reuses the L1 class and enters at its +verified end counter with `ctx3d0=1`, `ctx87c=9` and unrelated +condition bit `0x1000`. The guarded reader verifies all six ordered +state changes at byte positions 169, 177 and 193, then exits with +`ctx87c=0` and the unrelated condition still set. This is a +contrast for archive state dispatch. It supplies no native +viewport or application acceptance. + +The negative cases cover incomplete and trailing fields, null or +borrowed owners, missing class slots, unsupported versions and wrong +classes, all three populated list paths, and both delegated and +unqualified transform selectors. The worker denies filesystem, +process and network access after reading its hash-bound inputs. + +```sh +python -I -B re/tooling/sw2026/CheckCfgViews.py ladder +python -I -B re/tooling/sw2026/CheckCfgViews.py concave +``` + +[Guarded queue cases](../../../tests/Convert/Solidworks/Configuration/CfgViewTests.py) + +Queue execution of this slice remains pending. The broader Config-0 +graph still needs complete model sections and their remaining owners. +Annotation and user view paths, populated lists, perspective, the full +CMgr context caller and native writing retain separate acceptance. + +[CAD success criteria](../../../Documentation/Reference/Operations/CadSuccessCriteria.md) diff --git a/re/tooling/sw2026/CheckCfgViews.py b/re/tooling/sw2026/CheckCfgViews.py new file mode 100644 index 0000000000..21d1c24666 --- /dev/null +++ b/re/tooling/sw2026/CheckCfgViews.py @@ -0,0 +1,244 @@ +from argparse import ArgumentParser +from codecs import lookup +from functools import partial +import json +from pathlib import Path +from struct import pack, unpack, unpack_from +import sys + +HERE = Path(__file__).resolve() +ROOT = HERE.parents[3] +sys.path[:0] = [str(ROOT / "src"), str(HERE.parent)] + +from CheckCfgMembers import CASES as MEMBER_CASES, digest, refuse, require +from CheckCfgOwners import audit_run +from convert.adapters.solidworks.Archive.Bodies.BodyContext import BodyContext +from convert.adapters.solidworks.Archive.Config.Members.CfgMemberTypes import ( + KCfgMemberSchemas, KRelMgrClass, KViewClass, +) +from convert.adapters.solidworks.Archive.Config.Members.CheckCfgMember import CheckCfgMember +from convert.adapters.solidworks.Archive.Config.Members.MemberLayouts import KMemberLayouts +from convert.adapters.solidworks.Archive.Config.Members.MemberVirtuals import KMemberVirtuals +from convert.adapters.solidworks.Archive.Config.Members.ReadCfgMember import ReadCfgMember +from convert.adapters.solidworks.Archive.Config.Members.ReadMemBodyMut import ReadMemBodyMut +from convert.adapters.solidworks.Archive.Maps.ArchiveMaps import ArchiveMaps +from convert.adapters.solidworks.Archive.Maps.MapSnapshot import MapSnapshot +from convert.adapters.solidworks.Archive.Reading.BinaryReader import BinaryReader +from convert.adapters.solidworks.Archive.Reading.GraphReader import GraphReader +from convert.adapters.solidworks.Archive.Reading.ReadGraphNode import ReadNodeMut +from convert.adapters.solidworks.Container.Archive import ContainerMo +from convert.adapters.solidworks.Container.Container import SldprtArchive + +MANIFEST = ROOT / "re/solidworks/measurements/2026/ConfigViewSource01.json" +TAIL_FIELDS = ("f388", "f38c", "f378", "n380", "f360", "f394", "n398", + "f3a8", "f3b8", "n3b0", "f3c0", "f3c8") + + +class TraceFlags(dict): + def __init__(self, cursor): + super().__init__(conditions=0x1000, ctx3d0=1, ctx87c=9) + self.cursor = cursor + self.events = [] + + def __setitem__(self, name, value): + self.events.append([name, self.cursor.GetOffset(), self.get(name, 0), value]) + super().__setitem__(name, value) + + +def load_case(name): + manifest = json.loads(MANIFEST.read_bytes()) + require(manifest["runtime_class"] == [KViewClass.NameValue, KViewClass.SchemaValue] + and manifest["stream"] == "Contents/Config-0", "view source role changed") + case = manifest["controls"][name] + relative, part_sha, config_sha, member_owners = MEMBER_CASES[name] + source = (ROOT / case["path"]).read_bytes() + require(case["path"].endswith("/" + relative) + and digest(source) == case["part_sha256"] == part_sha, "native view input changed") + archive = SldprtArchive.from_bytes(source) + version = ContainerMo(archive.streams) + require(archive.format_version == 4 and version == manifest["archive_version"] == 19000, + "unsupported native view version") + config = archive.require(manifest["stream"]) + require(len(config) == case["configuration_bytes"] + and digest(config) == case["configuration_sha256"] == config_sha, + "view configuration stream changed") + start, end, counter, relation_sha = member_owners[0] + relation = config[start:end] + require(end < case["views"][0]["interval"][0] and digest(relation) == relation_sha, + "earlier relation evidence changed") + return version, config, case, relation, counter + + +def first_seed(version, case, relation, counter): + manager = ReadCfgMember(relation, version, MapSnapshot(counter, ()), KRelMgrClass) + entries = manager.MapValue.EntriesValue + assert [entry.IndexValue for entry in entries] == case["seed_relation_slots"] + assert entries[-1].EntryValue is manager.RootValue + first = case["views"][0]["counter"][0] + assert manager.MapValue.CounterValue < first + return MapSnapshot(first, entries) + + +def check_transformation(data, fields): + offset = 1 + expected = {"has_matrix": data[0]} + if data[0]: + expected["f08"] = dict(zip( + ("m0", "m1", "m2", "m3", "m4", "m5", "m6", "m7", "m8"), + unpack_from("<9d", data, offset), strict=True, + )) + offset += 72 + expected.update(zip(("f58", "f60", "f68", "f70", "f78"), + unpack("<4dB", data[offset:]), strict=True)) + assert fields == expected + return [len(data), fields["has_matrix"], fields["f78"]] + + +def check_fields(config, row, fields): + spans = row["embedded_intervals"] + frame = config[slice(*spans["f358"])] + assert frame[:3] == b"\xff\xfe\xff" and len(frame) == 4 + frame[3] * 2 + assert fields["f358"] == frame[4:].decode("utf-16-le") == row["name"] + widths = [check_transformation(config[slice(*spans[name])], fields[name]) + for name in ("f368", "f370")] + tail = unpack(" None: + FlagsValue = ContextValue.FlagsValue + Current = FlagsValue.get(RuleValue.NameValue, 0) + match RuleValue.ModeValue: + case "Assign": + FlagsValue[RuleValue.NameValue] = RuleValue.MaskValue + case "Set": + FlagsValue[RuleValue.NameValue] = Current | RuleValue.MaskValue + case "Clear": + FlagsValue[RuleValue.NameValue] = Current & ~RuleValue.MaskValue + case _: + raise ValueError(f"unsupported native context rule {RuleValue.ModeValue}") diff --git a/src/convert/adapters/solidworks/Archive/Bodies/IsBranchTaken.py b/src/convert/adapters/solidworks/Archive/Bodies/IsBranchTaken.py index 2b6296f8d8..cfe5f79022 100644 --- a/src/convert/adapters/solidworks/Archive/Bodies/IsBranchTaken.py +++ b/src/convert/adapters/solidworks/Archive/Bodies/IsBranchTaken.py @@ -1,3 +1,5 @@ +from typing import cast as CastValue + from convert.adapters.solidworks.Archive.Bodies.BodyContext import BodyContext from convert.adapters.solidworks.Archive.Bodies.BodyUnsupported import BodyUnsupported from convert.adapters.solidworks.Archive.Bodies.FieldScope import FieldScope @@ -14,6 +16,13 @@ def IsBranchTaken( ModeValue = RuleValue.ModeValue if ModeValue == "Nonzero": return ReadScopeValue(ScopeValue, RuleValue.NameValue) != 0 + if ModeValue == "NotEquals": + return ReadScopeValue(ScopeValue, RuleValue.NameValue) != RuleValue.MaskValue + if ModeValue == "BitsEqual": + Value = CastValue(int, ReadScopeValue(ScopeValue, RuleValue.NameValue)) + return Value & RuleValue.MaskValue == RuleValue.CompareValue + if ModeValue == "Context": + return bool(FlagsValue.get(RuleValue.NameValue, 0)) if ModeValue == "Condition": return bool(Conditions & RuleValue.MaskValue) if ModeValue == "NotContext": diff --git a/src/convert/adapters/solidworks/Archive/Bodies/Layouts/Config/GeometryFields.py b/src/convert/adapters/solidworks/Archive/Bodies/Layouts/Config/GeometryFields.py new file mode 100644 index 0000000000..2d8fe8c85a --- /dev/null +++ b/src/convert/adapters/solidworks/Archive/Bodies/Layouts/Config/GeometryFields.py @@ -0,0 +1,58 @@ +from types import MappingProxyType + +from convert.adapters.solidworks.Archive.Bodies.NativeField import NativeField + +# current native field order supplies both directions without saved document values +KGeometryFields = MappingProxyType( + { + "mgMatrix_c.restore": ( + NativeField("Scalar", "m0", "f64"), + NativeField("Scalar", "m1", "f64"), + NativeField("Scalar", "m2", "f64"), + NativeField("Scalar", "m3", "f64"), + NativeField("Scalar", "m4", "f64"), + NativeField("Scalar", "m5", "f64"), + NativeField("Scalar", "m6", "f64"), + NativeField("Scalar", "m7", "f64"), + NativeField("Scalar", "m8", "f64"), + ), + "mgXform_c.restore": ( + NativeField("Scalar", "has_matrix", "u8"), + NativeField( + "Branch", + "has_matrix", + BodyValue=(NativeField("Embed", "f08", "mgMatrix_c.restore"),), + ModeValue="NotEquals", + ), + NativeField("Scalar", "f58", "f64"), + NativeField("Scalar", "f60", "f64"), + NativeField("Scalar", "f68", "f64"), + NativeField("Scalar", "f70", "f64"), + NativeField("Scalar", "f78", "u8"), + NativeField( + "Branch", + "f78", + BodyValue=(NativeField("Embed", "f80", "mgMatrix5_c.restore"),), + ModeValue="BitsEqual", + MaskValue=240, + CompareValue=64, + ), + NativeField( + "Branch", + "f78", + BodyValue=(NativeField("Embed", "f80", "mgPerspInfo_c.restore"),), + ModeValue="BitsEqual", + MaskValue=240, + CompareValue=32, + ), + NativeField( + "Branch", + "f78", + BodyValue=(NativeField("Embed", "f80", "mgPerspInfoBase_c.restore"),), + ModeValue="BitsEqual", + MaskValue=240, + CompareValue=16, + ), + ), + } +) diff --git a/src/convert/adapters/solidworks/Archive/Bodies/Layouts/Config/ViewFields.py b/src/convert/adapters/solidworks/Archive/Bodies/Layouts/Config/ViewFields.py new file mode 100644 index 0000000000..3be03e0fc5 --- /dev/null +++ b/src/convert/adapters/solidworks/Archive/Bodies/Layouts/Config/ViewFields.py @@ -0,0 +1,69 @@ +from types import MappingProxyType + +from convert.adapters.solidworks.Archive.Bodies.NativeField import NativeField + +# current native field order supplies both directions without saved document values +KViewFields = MappingProxyType( + { + "moView_c": ( + NativeField("Text", "f358"), + NativeField("Embed", "f368", "mgXform_c.restore"), + NativeField("Embed", "f370", "mgXform_c.restore"), + NativeField("Scalar", "f388", "u16"), + NativeField("Scalar", "f38c", "i32"), + NativeField("Scalar", "f378", "f64"), + NativeField( + "Array", + "f380", + "i32", + BodyValue=(NativeField("Node", "o"),), + CountValue="n380", + ModeValue="Positive", + ), + NativeField("Scalar", "f360", "i32"), + NativeField( + "Branch", + "ctx3d0", + BodyValue=( + NativeField( + "Context", "conditions", ModeValue="Set", MaskValue=512 + ), + ), + ModeValue="Context", + ), + NativeField("Context", "ctx87c", ModeValue="Assign", MaskValue=1), + NativeField("Scalar", "f394", "i32"), + NativeField("Scalar", "n398", "i32"), + NativeField( + "Branch", + "n398", + BodyValue=(NativeField("Embed", "f398", "suObList"),), + ModeValue="NotEquals", + ), + NativeField("Context", "ctx87c", ModeValue="Assign"), + NativeField("Context", "ctx87c", ModeValue="Assign", MaskValue=1), + NativeField("Scalar", "f3a8", "i32"), + NativeField("Scalar", "f3b8", "f64"), + NativeField("Scalar", "n3b0", "i32"), + NativeField( + "Branch", + "n3b0", + BodyValue=(NativeField("Embed", "f3b0", "suObList"),), + ModeValue="NotEquals", + ), + NativeField("Context", "ctx87c", ModeValue="Assign"), + NativeField( + "Branch", + "ctx3d0", + BodyValue=( + NativeField( + "Context", "conditions", ModeValue="Clear", MaskValue=512 + ), + ), + ModeValue="Context", + ), + NativeField("Scalar", "f3c0", "i32"), + NativeField("Scalar", "f3c8", "i32"), + ), + } +) diff --git a/src/convert/adapters/solidworks/Archive/Bodies/Reading/ReadActions.py b/src/convert/adapters/solidworks/Archive/Bodies/Reading/ReadActions.py index 9d3cee01eb..9c6c9200c2 100644 --- a/src/convert/adapters/solidworks/Archive/Bodies/Reading/ReadActions.py +++ b/src/convert/adapters/solidworks/Archive/Bodies/Reading/ReadActions.py @@ -11,6 +11,9 @@ ReadBranchMut, ) from convert.adapters.solidworks.Archive.Bodies.Reading.ReadBytesMut import ReadBytesMut +from convert.adapters.solidworks.Archive.Bodies.Reading.ReadContextMut import ( + ReadContextMut, +) from convert.adapters.solidworks.Archive.Bodies.Reading.ReadLengthMut import ( ReadLengthMut, ) @@ -42,6 +45,7 @@ "Length": ReadLengthMut, "Repeat": ReadRepeatMut, "Branch": ReadBranchMut, + "Context": ReadContextMut, "Virtual": ReadVirtualMut, "Bytes": ReadBytesMut, "Boolean": ReadBooleanMut, diff --git a/src/convert/adapters/solidworks/Archive/Bodies/Reading/ReadContextMut.py b/src/convert/adapters/solidworks/Archive/Bodies/Reading/ReadContextMut.py new file mode 100644 index 0000000000..101e245aae --- /dev/null +++ b/src/convert/adapters/solidworks/Archive/Bodies/Reading/ReadContextMut.py @@ -0,0 +1,8 @@ +from convert.adapters.solidworks.Archive.Bodies.ChangeContext import ChangeFlagsMut +from convert.adapters.solidworks.Archive.Bodies.NativeField import NativeField +from convert.adapters.solidworks.Archive.Bodies.ReadFrame import ReadFrame + + +# archive state changes must affect subsequent reads without consuming a wire field +def ReadContextMut(FrameValue: ReadFrame, RuleValue: NativeField) -> None: + ChangeFlagsMut(FrameValue.ContextValue, RuleValue) diff --git a/src/convert/adapters/solidworks/Archive/Config/Members/CfgMemberTypes.py b/src/convert/adapters/solidworks/Archive/Config/Members/CfgMemberTypes.py index 91ed3a7242..f025f748a3 100644 --- a/src/convert/adapters/solidworks/Archive/Config/Members/CfgMemberTypes.py +++ b/src/convert/adapters/solidworks/Archive/Config/Members/CfgMemberTypes.py @@ -20,11 +20,15 @@ # the kernel mark has its own schema and position in the same part map KPMarkClass = RuntimeClass("moPMarkRecord_c", 1) -# these two bounded roles require concrete owners in the qualified profiles +# standard part views use a distinct descriptor from annotation and exploded views +KViewClass = RuntimeClass("moView_c", 1) + +# these bounded roles require concrete owners in the qualified profiles KRequiredMembers = MappingProxyType( - {KRelMgrClass: "relation", KPMarkClass: "partition mark"} + {KRelMgrClass: "relation", KPMarkClass: "partition mark", KViewClass: "view"} ) + # the member reader admits only the measured concrete descriptors KCfgMemberSchemas = MappingProxyType( { @@ -36,6 +40,7 @@ KExplViewClass, KThreadMgrClass, KPMarkClass, + KViewClass, ) } ) diff --git a/src/convert/adapters/solidworks/Archive/Config/Members/CheckCfgMember.py b/src/convert/adapters/solidworks/Archive/Config/Members/CheckCfgMember.py index c4bc7b6ead..5be7e608a0 100644 --- a/src/convert/adapters/solidworks/Archive/Config/Members/CheckCfgMember.py +++ b/src/convert/adapters/solidworks/Archive/Config/Members/CheckCfgMember.py @@ -5,6 +5,7 @@ KRequiredMembers, KSketchBlockClass, KThreadMgrClass, + KViewClass, ) from convert.adapters.solidworks.Archive.Config.Members.CheckCfgOwner import ( CheckCfgOwner, @@ -15,6 +16,7 @@ from convert.adapters.solidworks.Archive.Config.Members.CheckThreadMap import ( CheckThreadMap, ) +from convert.adapters.solidworks.Archive.Config.Members.CheckCfgView import CheckCfgView from convert.adapters.solidworks.Archive.Maps.ArchiveMaps import ArchiveMaps from convert.adapters.solidworks.Archive.Maps.ObjectIndex import ObjectIndex from convert.adapters.solidworks.Archive.Objects.ArchiveNode import ArchiveNode @@ -47,3 +49,5 @@ def CheckCfgMember( CheckCfgOwner(RootValue) elif MemberClass == KThreadMgrClass: CheckThreadMap(RootValue) + elif MemberClass == KViewClass: + CheckCfgView(RootValue) diff --git a/src/convert/adapters/solidworks/Archive/Config/Members/CheckCfgView.py b/src/convert/adapters/solidworks/Archive/Config/Members/CheckCfgView.py new file mode 100644 index 0000000000..94ce5d2dee --- /dev/null +++ b/src/convert/adapters/solidworks/Archive/Config/Members/CheckCfgView.py @@ -0,0 +1,16 @@ +from typing import cast as CastValue + +from convert.adapters.solidworks.Archive.Bodies.BodyUnsupported import BodyUnsupported +from convert.adapters.solidworks.Archive.Objects.ArchiveNode import ArchiveNode + + +# populated presentation owners and extended transforms need separate native qualification +def CheckCfgView(NodeValue: ArchiveNode) -> None: + Fields = NodeValue.FieldsValue + if any(Fields[NameValue] != 0 for NameValue in ("n380", "n398", "n3b0")): + raise BodyUnsupported("unqualified SOLIDWORKS view lists") + for NameValue in ("f368", "f370"): + Transform = CastValue(dict[str, object], Fields[NameValue]) + FlagsValue = CastValue(int, Transform["f78"]) + if FlagsValue & 0xF0: + raise BodyUnsupported("unqualified SOLIDWORKS view transform selector") diff --git a/src/convert/adapters/solidworks/Archive/Config/Members/MemberLayouts.py b/src/convert/adapters/solidworks/Archive/Config/Members/MemberLayouts.py index 0ea38f6d47..e9c8e5fc09 100644 --- a/src/convert/adapters/solidworks/Archive/Config/Members/MemberLayouts.py +++ b/src/convert/adapters/solidworks/Archive/Config/Members/MemberLayouts.py @@ -6,6 +6,9 @@ from convert.adapters.solidworks.Archive.Bodies.Layouts.Config.FeatColorFields import ( KFeatColorFields, ) +from convert.adapters.solidworks.Archive.Bodies.Layouts.Config.GeometryFields import ( + KGeometryFields, +) from convert.adapters.solidworks.Archive.Bodies.Layouts.Config.OwnerFields import ( KOwnerFields, ) @@ -18,6 +21,9 @@ from convert.adapters.solidworks.Archive.Bodies.Layouts.Config.ThreadFields import ( KThreadFields, ) +from convert.adapters.solidworks.Archive.Bodies.Layouts.Config.ViewFields import ( + KViewFields, +) from convert.adapters.solidworks.Archive.Bodies.Layouts.FeatureFields import ( KFeatureFields, ) @@ -39,5 +45,7 @@ **KOwnerFields, **KRecordFields, **KThreadFields, + **KGeometryFields, + **KViewFields, } ) diff --git a/tests/Convert/Solidworks/Configuration/CfgViewTests.py b/tests/Convert/Solidworks/Configuration/CfgViewTests.py new file mode 100644 index 0000000000..9ac5ae5e8e --- /dev/null +++ b/tests/Convert/Solidworks/Configuration/CfgViewTests.py @@ -0,0 +1,86 @@ +from typing import cast as CastValue + +from tests.Convert.Solidworks.Configuration.ReadViewCase import ReadViewCase + +# the source groups use these separate cases to exercise both compact transform widths +KViewNames = [ + "*Normal To", + "*Front", + "*Back", + "*Left", + "*Right", + "*Top", + "*Bottom", + "*Isometric", + "*Trimetric", + "*Dimetric", +] + + +# wire groups must retain distinct objects under the one actual serialized class +def AssertViewRows( + ReportValue: dict[str, object], ClassSlot: int, StartValue: int, EndValue: int +) -> None: + ViewRows = CastValue(list[dict[str, object]], ReportValue["views"]) + assert ReportValue["counter"] == [ClassSlot, ClassSlot + 11] + assert [ViewValue["slot"] for ViewValue in ViewRows] == list( + range(ClassSlot + 1, ClassSlot + 11) + ) + assert [ViewValue["name"] for ViewValue in ViewRows] == KViewNames + assert all( + ViewValue["class_slot"] == ClassSlot and ViewValue["context_calls"] == 4 + for ViewValue in ViewRows + ) + Intervals = [CastValue(list[int], ViewValue["interval"]) for ViewValue in ViewRows] + assert Intervals[0][0] == StartValue and Intervals[-1][1] == EndValue + assert all( + PriorValue[1] == NextValue[0] + for PriorValue, NextValue in zip(Intervals[:-1], Intervals[1:]) + ) + for Index, ViewValue in enumerate(ViewRows): + Matrix = int(Index >= 2) + assert ViewValue["transforms"] == [[34 + Matrix * 72, Matrix, 0], [34, 0, 0]] + + +# the active condition branch must preserve other flags across both bounded list windows +def AssertViewState(ReportValue: object) -> None: + State = CastValue(dict[str, object], ReportValue) + assert State["slot"] == 95 + assert State["events"] == [ + ["conditions", 169, 4096, 4608], + ["ctx87c", 169, 9, 1], + ["ctx87c", 177, 1, 0], + ["ctx87c", 177, 0, 1], + ["ctx87c", 193, 1, 0], + ["conditions", 193, 4608, 4096], + ] + assert State["flags"] == {"conditions": 4096, "ctx3d0": 1, "ctx87c": 0} + + +# unsupported presentation branches must fail while the exact source role stays usable +def TestLadderViews() -> None: + ReportValue = ReadViewCase("ladder") + AssertViewRows(ReportValue, 84, 22240, 24252) + assert ReportValue["inherited"] == [59, 60] + AssertViewState(ReportValue["authored"]) + assert ReportValue["refusals"] == [ + "truncated", + "trailing", + "null", + "borrowed", + "missing_class", + "wrong_version", + "wrong_role", + "populated_links", + "populated_first_list", + "populated_second_list", + "selected_transform", + "unqualified_selector", + ] + + +# the imported control supplies independent map positions for the same native view owner +def TestConcaveView() -> None: + ReportValue = ReadViewCase("concave") + AssertViewRows(ReportValue, 79, 20463, 22475) + assert ReportValue["inherited"] == [52, 53] diff --git a/tests/Convert/Solidworks/Configuration/ReadViewCase.py b/tests/Convert/Solidworks/Configuration/ReadViewCase.py new file mode 100644 index 0000000000..0181beb7b9 --- /dev/null +++ b/tests/Convert/Solidworks/Configuration/ReadViewCase.py @@ -0,0 +1,26 @@ +from json import loads as LoadJson +from pathlib import Path as FilePath +from subprocess import run as RunProcess +from sys import executable as PythonExec +from typing import cast as CastValue + +# each file requires a fresh guarded process that consumes its bounded native records +KViewProbe = ( + FilePath(__file__).resolve().parents[4] / "re/tooling/sw2026/CheckCfgViews.py" +) + + +# diagnostics and runtime access evidence belong to the shared process boundary +def ReadViewCase(CaseName: str) -> dict[str, object]: + Outcome = RunProcess( + (PythonExec, "-I", "-B", str(KViewProbe), CaseName), + capture_output=True, + text=True, + encoding="utf-8", + check=False, + timeout=60, + ) + assert Outcome.returncode == 0, Outcome.stdout + Outcome.stderr + ReportValue = CastValue(dict[str, object], LoadJson(Outcome.stdout)) + assert ReportValue["runtime_external_accesses"] == 0 + return ReportValue From 86a322719761aa392ab7b1817138fc99ea0e6f58 Mon Sep 17 00:00:00 2001 From: Odin Glynn-Martin Date: Fri, 20 Nov 2026 07:33:47 -0800 Subject: [PATCH 2/3] Verify active view context through the bounded member reader --- re/solidworks/records/ConfigViewSlice2026.md | 8 +++--- re/tooling/sw2026/CheckCfgViews.py | 12 ++++++++- .../Archive/Config/Members/CfgMemberGraph.py | 1 + .../Archive/Config/Members/ReadCfgMember.py | 26 +++++++++++++++++-- .../Solidworks/Configuration/CfgViewTests.py | 2 ++ 5 files changed, 43 insertions(+), 6 deletions(-) diff --git a/re/solidworks/records/ConfigViewSlice2026.md b/re/solidworks/records/ConfigViewSlice2026.md index c44eebfb6c..42a84e647a 100644 --- a/re/solidworks/records/ConfigViewSlice2026.md +++ b/re/solidworks/records/ConfigViewSlice2026.md @@ -81,9 +81,11 @@ An independently authored view reuses the L1 class and enters at its verified end counter with `ctx3d0=1`, `ctx87c=9` and unrelated condition bit `0x1000`. The guarded reader verifies all six ordered state changes at byte positions 169, 177 and 193, then exits with -`ctx87c=0` and the unrelated condition still set. This is a -contrast for archive state dispatch. It supplies no native -viewport or application acceptance. +`ctx87c=0` and the unrelated condition still set. The same authored +bytes go through the bounded member entry with its copied caller context. +The returned immutable context matches the instrumented field trace, and +the caller's flag map remains intact. This is an archive state contrast. +Native viewport and application acceptance remain open. The negative cases cover incomplete and trailing fields, null or borrowed owners, missing class slots, unsupported versions and wrong diff --git a/re/tooling/sw2026/CheckCfgViews.py b/re/tooling/sw2026/CheckCfgViews.py index 21d1c24666..2b26f5a35e 100644 --- a/re/tooling/sw2026/CheckCfgViews.py +++ b/re/tooling/sw2026/CheckCfgViews.py @@ -172,6 +172,7 @@ def authored_view(class_slot, *, flag=0, links=(), first_list=0, second_list=0): def authored_context(data, seed, class_slot): cursor = BinaryReader(data) state = TraceFlags(cursor) + initial = dict(state) context = BodyContext(19000, KMemberLayouts, KMemberVirtuals, KCfgMemberSchemas, FlagsValue=state) original = seed.EntriesValue mapped = ArchiveMaps(seed.CounterValue, seed) @@ -186,8 +187,17 @@ def authored_context(data, seed, class_slot): assert all(mapped.EntryMap[entry.IndexValue] is entry for entry in original) assert node.FieldsValue["f358"] == ("A", "View") assert node.FieldsValue["f3c0"] == 23 and node.FieldsValue["f3c8"] == -31 + bounded = ReadCfgMember(data, 19000, seed, KViewClass, FlagSeed=initial) + assert initial == {"conditions": 4096, "ctx3d0": 1, "ctx87c": 9} + check_slots(bounded.RootValue, seed, bounded.MapValue, { + "row": 10, "counter": [seed.CounterValue, mapped.CounterValue], + "class_slot": class_slot, "object_slot": node.IndexValue, + }) + assert bounded.RootValue.FieldsValue == node.FieldsValue and bounded.FlagsValue == state + assert bounded.RootValue.StartOffset == 0 and bounded.RootValue.EndOffset == len(data) return {"events": state.events, "flags": dict(state), "slot": node.IndexValue, - "fields": node.FieldsValue} + "fields": node.FieldsValue, "member_context_calls": bounded.ReportValue["field_calls"]["Context"], + "member_flags": dict(bounded.FlagsValue)} def refusals(seed, class_slot, first, accepted): diff --git a/src/convert/adapters/solidworks/Archive/Config/Members/CfgMemberGraph.py b/src/convert/adapters/solidworks/Archive/Config/Members/CfgMemberGraph.py index b2197d20e6..054d97edda 100644 --- a/src/convert/adapters/solidworks/Archive/Config/Members/CfgMemberGraph.py +++ b/src/convert/adapters/solidworks/Archive/Config/Members/CfgMemberGraph.py @@ -11,3 +11,4 @@ class CfgMemberGraph: RootValue: ArchiveNode | None MapValue: MapSnapshot ReportValue: Mapping[str, object] + FlagsValue: Mapping[str, int] diff --git a/src/convert/adapters/solidworks/Archive/Config/Members/ReadCfgMember.py b/src/convert/adapters/solidworks/Archive/Config/Members/ReadCfgMember.py index 6f147b5a14..390fbab84b 100644 --- a/src/convert/adapters/solidworks/Archive/Config/Members/ReadCfgMember.py +++ b/src/convert/adapters/solidworks/Archive/Config/Members/ReadCfgMember.py @@ -1,4 +1,6 @@ +from collections.abc import Mapping from functools import partial as PartialValue +from types import MappingProxyType from convert.adapters.solidworks.Archive.Bodies.BodyContext import BodyContext from convert.adapters.solidworks.Archive.Bodies.BodyReport import GetBodyReport @@ -8,6 +10,7 @@ ) from convert.adapters.solidworks.Archive.Config.Members.CfgMemberTypes import ( KCfgMemberSchemas, + KViewClass, ) from convert.adapters.solidworks.Archive.Config.Members.CheckCfgMember import ( CheckCfgMember, @@ -28,6 +31,9 @@ from convert.adapters.solidworks.Archive.Reading.GraphReader import GraphReader from convert.adapters.solidworks.Archive.Reading.ReadGraphNode import ReadNodeMut +# the observed view windows read these caller flags and preserve their unrelated bits +KViewFlagNames = frozenset(("conditions", "ctx3d0", "ctx87c")) + # bounded member bytes and an explicit caller role must agree before exposing the map def ReadCfgMember( @@ -35,6 +41,8 @@ def ReadCfgMember( VersionValue: int, SeedValue: MapSnapshot, MemberClass: RuntimeClass, + *, + FlagSeed: Mapping[str, int] | None = None, ) -> CfgMemberGraph: if type(VersionValue) is not int or VersionValue != 19000: raise BodyUnsupported( @@ -42,8 +50,19 @@ def ReadCfgMember( ) if MemberClass.SchemaValue not in KCfgMemberSchemas.get(MemberClass.NameValue, ()): raise BodyUnsupported("SOLIDWORKS configuration member has an unsupported role") + FlagsValue = dict(FlagSeed or {}) + if FlagsValue and ( + MemberClass != KViewClass + or not FlagsValue.keys() <= KViewFlagNames + or any(type(WordValue) is not int for WordValue in FlagsValue.values()) + ): + raise BodyUnsupported("unsupported SOLIDWORKS configuration member context") ContextValue = BodyContext( - VersionValue, KMemberLayouts, KMemberVirtuals, KCfgMemberSchemas + VersionValue, + KMemberLayouts, + KMemberVirtuals, + KCfgMemberSchemas, + FlagsValue=FlagsValue, ) MapValue = ArchiveMaps(SeedValue.CounterValue, SeedValue) ReaderValue = GraphReader( @@ -57,5 +76,8 @@ def ReadCfgMember( CheckCfgMember(RootValue, MemberClass, MapValue) ContextValue.UsageValue.IsComplete = True return CfgMemberGraph( - RootValue, MapValue.Snapshot(), GetBodyReport(ContextValue.UsageValue) + RootValue, + MapValue.Snapshot(), + GetBodyReport(ContextValue.UsageValue), + MappingProxyType(FlagsValue), ) diff --git a/tests/Convert/Solidworks/Configuration/CfgViewTests.py b/tests/Convert/Solidworks/Configuration/CfgViewTests.py index 9ac5ae5e8e..5a4a4d55f0 100644 --- a/tests/Convert/Solidworks/Configuration/CfgViewTests.py +++ b/tests/Convert/Solidworks/Configuration/CfgViewTests.py @@ -55,6 +55,8 @@ def AssertViewState(ReportValue: object) -> None: ["conditions", 193, 4608, 4096], ] assert State["flags"] == {"conditions": 4096, "ctx3d0": 1, "ctx87c": 0} + assert State["member_context_calls"] == 6 + assert State["member_flags"] == State["flags"] # unsupported presentation branches must fail while the exact source role stays usable From 80b3f6714c968c0228429e0b9ad55a3520738f2d Mon Sep 17 00:00:00 2001 From: Odin Glynn-Martin Date: Fri, 20 Nov 2026 07:48:22 -0800 Subject: [PATCH 3/3] Keep member context validation and research tracing separate --- re/tooling/sw2026/CheckCfgViews.py | 20 ++++++++-------- .../Archive/Config/Members/CopyMemberFlags.py | 24 +++++++++++++++++++ .../Archive/Config/Members/ReadCfgMember.py | 15 ++++-------- 3 files changed, 38 insertions(+), 21 deletions(-) create mode 100644 src/convert/adapters/solidworks/Archive/Config/Members/CopyMemberFlags.py diff --git a/re/tooling/sw2026/CheckCfgViews.py b/re/tooling/sw2026/CheckCfgViews.py index 2b26f5a35e..bd2ef5ce45 100644 --- a/re/tooling/sw2026/CheckCfgViews.py +++ b/re/tooling/sw2026/CheckCfgViews.py @@ -34,15 +34,15 @@ "f3a8", "f3b8", "n3b0", "f3c0", "f3c8") -class TraceFlags(dict): - def __init__(self, cursor): - super().__init__(conditions=0x1000, ctx3d0=1, ctx87c=9) - self.cursor = cursor - self.events = [] +def trace_flags(cursor): + events = [] - def __setitem__(self, name, value): - self.events.append([name, self.cursor.GetOffset(), self.get(name, 0), value]) - super().__setitem__(name, value) + class TraceFlags(dict): + def __setitem__(self, name, value): + events.append([name, cursor.GetOffset(), self.get(name, 0), value]) + super().__setitem__(name, value) + + return TraceFlags(conditions=0x1000, ctx3d0=1, ctx87c=9), events def load_case(name): @@ -171,7 +171,7 @@ def authored_view(class_slot, *, flag=0, links=(), first_list=0, second_list=0): def authored_context(data, seed, class_slot): cursor = BinaryReader(data) - state = TraceFlags(cursor) + state, events = trace_flags(cursor) initial = dict(state) context = BodyContext(19000, KMemberLayouts, KMemberVirtuals, KCfgMemberSchemas, FlagsValue=state) original = seed.EntriesValue @@ -195,7 +195,7 @@ def authored_context(data, seed, class_slot): }) assert bounded.RootValue.FieldsValue == node.FieldsValue and bounded.FlagsValue == state assert bounded.RootValue.StartOffset == 0 and bounded.RootValue.EndOffset == len(data) - return {"events": state.events, "flags": dict(state), "slot": node.IndexValue, + return {"events": events, "flags": dict(state), "slot": node.IndexValue, "fields": node.FieldsValue, "member_context_calls": bounded.ReportValue["field_calls"]["Context"], "member_flags": dict(bounded.FlagsValue)} diff --git a/src/convert/adapters/solidworks/Archive/Config/Members/CopyMemberFlags.py b/src/convert/adapters/solidworks/Archive/Config/Members/CopyMemberFlags.py new file mode 100644 index 0000000000..3f7e5c941b --- /dev/null +++ b/src/convert/adapters/solidworks/Archive/Config/Members/CopyMemberFlags.py @@ -0,0 +1,24 @@ +from collections.abc import Mapping + +from convert.adapters.solidworks.Archive.Bodies.BodyUnsupported import BodyUnsupported +from convert.adapters.solidworks.Archive.Config.Members.CfgMemberTypes import ( + KViewClass, +) +from convert.adapters.solidworks.Archive.Objects.RuntimeClass import RuntimeClass + +# the observed view windows read these caller flags and preserve their unrelated bits +KViewFlagNames = frozenset(("conditions", "ctx3d0", "ctx87c")) + + +# bounded members must copy the supported caller context before any archive state is read +def CopyMemberFlags( + MemberClass: RuntimeClass, FlagSeed: Mapping[str, int] | None +) -> dict[str, int]: + FlagsValue = dict(FlagSeed or {}) + if FlagsValue and ( + MemberClass != KViewClass + or not FlagsValue.keys() <= KViewFlagNames + or any(type(WordValue) is not int for WordValue in FlagsValue.values()) + ): + raise BodyUnsupported("unsupported SOLIDWORKS configuration member context") + return FlagsValue diff --git a/src/convert/adapters/solidworks/Archive/Config/Members/ReadCfgMember.py b/src/convert/adapters/solidworks/Archive/Config/Members/ReadCfgMember.py index 390fbab84b..ad5ff83e21 100644 --- a/src/convert/adapters/solidworks/Archive/Config/Members/ReadCfgMember.py +++ b/src/convert/adapters/solidworks/Archive/Config/Members/ReadCfgMember.py @@ -10,11 +10,13 @@ ) from convert.adapters.solidworks.Archive.Config.Members.CfgMemberTypes import ( KCfgMemberSchemas, - KViewClass, ) from convert.adapters.solidworks.Archive.Config.Members.CheckCfgMember import ( CheckCfgMember, ) +from convert.adapters.solidworks.Archive.Config.Members.CopyMemberFlags import ( + CopyMemberFlags, +) from convert.adapters.solidworks.Archive.Config.Members.MemberLayouts import ( KMemberLayouts, ) @@ -31,9 +33,6 @@ from convert.adapters.solidworks.Archive.Reading.GraphReader import GraphReader from convert.adapters.solidworks.Archive.Reading.ReadGraphNode import ReadNodeMut -# the observed view windows read these caller flags and preserve their unrelated bits -KViewFlagNames = frozenset(("conditions", "ctx3d0", "ctx87c")) - # bounded member bytes and an explicit caller role must agree before exposing the map def ReadCfgMember( @@ -50,13 +49,7 @@ def ReadCfgMember( ) if MemberClass.SchemaValue not in KCfgMemberSchemas.get(MemberClass.NameValue, ()): raise BodyUnsupported("SOLIDWORKS configuration member has an unsupported role") - FlagsValue = dict(FlagSeed or {}) - if FlagsValue and ( - MemberClass != KViewClass - or not FlagsValue.keys() <= KViewFlagNames - or any(type(WordValue) is not int for WordValue in FlagsValue.values()) - ): - raise BodyUnsupported("unsupported SOLIDWORKS configuration member context") + FlagsValue = CopyMemberFlags(MemberClass, FlagSeed) ContextValue = BodyContext( VersionValue, KMemberLayouts,