parasolid-kit 0.1.0.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- parasolid_kit-0.1.0.dev0/Cargo.lock +137 -0
- parasolid_kit-0.1.0.dev0/Cargo.toml +25 -0
- parasolid_kit-0.1.0.dev0/LICENSE +21 -0
- parasolid_kit-0.1.0.dev0/PKG-INFO +150 -0
- parasolid_kit-0.1.0.dev0/README.md +130 -0
- parasolid_kit-0.1.0.dev0/corpus/README.md +55 -0
- parasolid_kit-0.1.0.dev0/corpus/manifest.schema.json +166 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/Cargo.toml +15 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/brep/mapper.rs +2317 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/brep/metrics.rs +210 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/brep/mod.rs +15 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/brep/model.rs +668 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/comparison.rs +971 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/document.rs +841 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/error.rs +332 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/header.rs +488 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/lib.rs +31 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/reader.rs +543 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/schema/catalog.rs +842 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/schema/coverage.rs +93 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/schema/decoder.rs +710 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/schema/mod.rs +18 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/schema/model.rs +397 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/schema/provider.rs +86 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/schema/registry.rs +276 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/text_document.rs +1192 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-core/src/text_reader.rs +501 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-python/Cargo.toml +20 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-python/src/brep.rs +628 -0
- parasolid_kit-0.1.0.dev0/crates/parasolid-python/src/lib.rs +970 -0
- parasolid_kit-0.1.0.dev0/docs/api.md +109 -0
- parasolid_kit-0.1.0.dev0/docs/format-support.md +104 -0
- parasolid_kit-0.1.0.dev0/fuzz/Cargo.lock +94 -0
- parasolid_kit-0.1.0.dev0/fuzz/Cargo.toml +37 -0
- parasolid_kit-0.1.0.dev0/fuzz/fuzz_targets/inspect.rs +14 -0
- parasolid_kit-0.1.0.dev0/fuzz/fuzz_targets/parse.rs +56 -0
- parasolid_kit-0.1.0.dev0/fuzz/fuzz_targets/schema_catalog.rs +15 -0
- parasolid_kit-0.1.0.dev0/pyproject.toml +80 -0
- parasolid_kit-0.1.0.dev0/scripts/inspect_xb_headers.py +47 -0
- parasolid_kit-0.1.0.dev0/scripts/verify_artifacts.py +504 -0
- parasolid_kit-0.1.0.dev0/scripts/verify_corpus.py +189 -0
- parasolid_kit-0.1.0.dev0/scripts/verify_isolated_install.py +136 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/__init__.py +156 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/__main__.py +5 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/_native.py +80 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/api.py +565 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/binary/__init__.py +15 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/binary/document.py +262 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/binary/header.py +87 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/brep/__init__.py +95 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/brep/_native.py +590 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/brep/geometry.py +290 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/brep/model.py +80 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/brep/topology.py +205 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/cli.py +216 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/diagnostics.py +126 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/errors.py +66 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/limits.py +67 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/py.typed +1 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/schema/__init__.py +33 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/schema/api.py +324 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/schema/model.py +289 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/schema/provider.py +124 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/text/__init__.py +5 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/text/header.py +70 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/validation/__init__.py +5 -0
- parasolid_kit-0.1.0.dev0/src/parasolid_kit/validation/comparison.py +126 -0
- parasolid_kit-0.1.0.dev0/tests/__init__.py +1 -0
- parasolid_kit-0.1.0.dev0/tests/support/__init__.py +1 -0
- parasolid_kit-0.1.0.dev0/tests/support/parasolid_binary.py +105 -0
- parasolid_kit-0.1.0.dev0/tests/support/parasolid_schema.py +55 -0
- parasolid_kit-0.1.0.dev0/tests/support/parasolid_text.py +26 -0
- parasolid_kit-0.1.0.dev0/tests/test_artifact_gate.py +219 -0
- parasolid_kit-0.1.0.dev0/tests/test_brep.py +185 -0
- parasolid_kit-0.1.0.dev0/tests/test_cli.py +97 -0
- parasolid_kit-0.1.0.dev0/tests/test_corpus_gate.py +94 -0
- parasolid_kit-0.1.0.dev0/tests/test_corpus_manifest.py +51 -0
- parasolid_kit-0.1.0.dev0/tests/test_diagnostics.py +75 -0
- parasolid_kit-0.1.0.dev0/tests/test_inspect_xb.py +102 -0
- parasolid_kit-0.1.0.dev0/tests/test_limits.py +41 -0
- parasolid_kit-0.1.0.dev0/tests/test_parse_xb.py +198 -0
- parasolid_kit-0.1.0.dev0/tests/test_parse_xt.py +142 -0
- parasolid_kit-0.1.0.dev0/tests/test_public_contracts.py +35 -0
- parasolid_kit-0.1.0.dev0/tests/test_schema_catalog.py +74 -0
- parasolid_kit-0.1.0.dev0/tests/test_schema_resolution.py +157 -0
- parasolid_kit-0.1.0.dev0/tests/test_synthetic_binary.py +53 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "heck"
|
|
7
|
+
version = "0.5.0"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "libc"
|
|
13
|
+
version = "0.2.189"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "once_cell"
|
|
19
|
+
version = "1.21.4"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
22
|
+
|
|
23
|
+
[[package]]
|
|
24
|
+
name = "parasolid-core"
|
|
25
|
+
version = "0.1.0-dev0"
|
|
26
|
+
|
|
27
|
+
[[package]]
|
|
28
|
+
name = "parasolid-python"
|
|
29
|
+
version = "0.1.0-dev0"
|
|
30
|
+
dependencies = [
|
|
31
|
+
"parasolid-core",
|
|
32
|
+
"pyo3",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[[package]]
|
|
36
|
+
name = "portable-atomic"
|
|
37
|
+
version = "1.15.0"
|
|
38
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
39
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
40
|
+
|
|
41
|
+
[[package]]
|
|
42
|
+
name = "proc-macro2"
|
|
43
|
+
version = "1.0.107"
|
|
44
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
46
|
+
dependencies = [
|
|
47
|
+
"unicode-ident",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[[package]]
|
|
51
|
+
name = "pyo3"
|
|
52
|
+
version = "0.29.2"
|
|
53
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
54
|
+
checksum = "4688ddedf473e32662b9b067670129a8afb8c18e351482c70d62ba4a88171e8b"
|
|
55
|
+
dependencies = [
|
|
56
|
+
"libc",
|
|
57
|
+
"once_cell",
|
|
58
|
+
"portable-atomic",
|
|
59
|
+
"pyo3-build-config",
|
|
60
|
+
"pyo3-ffi",
|
|
61
|
+
"pyo3-macros",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[[package]]
|
|
65
|
+
name = "pyo3-build-config"
|
|
66
|
+
version = "0.29.2"
|
|
67
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
68
|
+
checksum = "f41027e41b4bd03f6e60f9f417fe24a6341a6bb744edd62b6f709f2a52ea30e9"
|
|
69
|
+
dependencies = [
|
|
70
|
+
"target-lexicon",
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
[[package]]
|
|
74
|
+
name = "pyo3-ffi"
|
|
75
|
+
version = "0.29.2"
|
|
76
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
77
|
+
checksum = "e591a95526fead067432c3b3a33fc74770b87b1e04e73671090d9c2055a2b327"
|
|
78
|
+
dependencies = [
|
|
79
|
+
"libc",
|
|
80
|
+
"pyo3-build-config",
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
[[package]]
|
|
84
|
+
name = "pyo3-macros"
|
|
85
|
+
version = "0.29.2"
|
|
86
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
87
|
+
checksum = "73225868fc1cd84eef2c3c230ddb91273bf1de46aeb8a4248da76d32a0924a1c"
|
|
88
|
+
dependencies = [
|
|
89
|
+
"proc-macro2",
|
|
90
|
+
"pyo3-macros-backend",
|
|
91
|
+
"quote",
|
|
92
|
+
"syn",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
[[package]]
|
|
96
|
+
name = "pyo3-macros-backend"
|
|
97
|
+
version = "0.29.2"
|
|
98
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
99
|
+
checksum = "571575aa3749fa6216757dd47d2a3e7ef360f329a40f0666a9fbd14889024952"
|
|
100
|
+
dependencies = [
|
|
101
|
+
"heck",
|
|
102
|
+
"proc-macro2",
|
|
103
|
+
"quote",
|
|
104
|
+
"syn",
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
[[package]]
|
|
108
|
+
name = "quote"
|
|
109
|
+
version = "1.0.47"
|
|
110
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
111
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
112
|
+
dependencies = [
|
|
113
|
+
"proc-macro2",
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
[[package]]
|
|
117
|
+
name = "syn"
|
|
118
|
+
version = "2.0.119"
|
|
119
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
120
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
121
|
+
dependencies = [
|
|
122
|
+
"proc-macro2",
|
|
123
|
+
"quote",
|
|
124
|
+
"unicode-ident",
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
[[package]]
|
|
128
|
+
name = "target-lexicon"
|
|
129
|
+
version = "0.13.5"
|
|
130
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
131
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
132
|
+
|
|
133
|
+
[[package]]
|
|
134
|
+
name = "unicode-ident"
|
|
135
|
+
version = "1.0.24"
|
|
136
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
137
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[workspace]
|
|
2
|
+
members = ["crates/parasolid-core", "crates/parasolid-python"]
|
|
3
|
+
exclude = ["fuzz"]
|
|
4
|
+
resolver = "3"
|
|
5
|
+
|
|
6
|
+
[workspace.package]
|
|
7
|
+
version = "0.1.0-dev0"
|
|
8
|
+
edition = "2024"
|
|
9
|
+
rust-version = "1.88"
|
|
10
|
+
description = "Schema-aware parser core for Parasolid X_T and X_B data"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
repository = "https://github.com/monozukuri-ai/parasolid-kit"
|
|
13
|
+
|
|
14
|
+
[workspace.dependencies]
|
|
15
|
+
pyo3 = { version = "=0.29.2", features = ["abi3-py310", "extension-module"] }
|
|
16
|
+
|
|
17
|
+
[workspace.lints.rust]
|
|
18
|
+
unsafe_code = "forbid"
|
|
19
|
+
|
|
20
|
+
[workspace.lints.clippy]
|
|
21
|
+
all = { level = "warn", priority = -1 }
|
|
22
|
+
pedantic = { level = "warn", priority = -1 }
|
|
23
|
+
expect_used = "deny"
|
|
24
|
+
panic = "deny"
|
|
25
|
+
unwrap_used = "deny"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 parasolid-kit contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: parasolid-kit
|
|
3
|
+
Version: 0.1.0.dev0
|
|
4
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
5
|
+
Classifier: Programming Language :: Python :: 3
|
|
6
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Programming Language :: Rust
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Summary: Schema-aware Python parser for Parasolid X_T and X_B data
|
|
15
|
+
License-Expression: MIT
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
18
|
+
Project-URL: Repository, https://github.com/monozukuri-ai/parasolid-kit
|
|
19
|
+
|
|
20
|
+
# parasolid-kit
|
|
21
|
+
|
|
22
|
+
`parasolid-kit` is an experimental, schema-aware parser for Parasolid X_T and
|
|
23
|
+
X_B transmit files. Parsing and geometry mapping run in a safe Rust core, while
|
|
24
|
+
Python users work with immutable typed models.
|
|
25
|
+
|
|
26
|
+
The project is read-focused and currently pre-alpha. It is intended for file
|
|
27
|
+
inspection, validation, research, and conversion pipelines where preserving
|
|
28
|
+
the transmitted structure matters more than silently approximating unsupported
|
|
29
|
+
data.
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- Inspect X_T and X_B headers without a schema catalog.
|
|
34
|
+
- Parse complete X_T and X_B node streams with the exact caller-provided schema.
|
|
35
|
+
- Reconstruct an unmodified parsed X_B document byte-for-byte.
|
|
36
|
+
- Compare X_T and X_B documents after pointer-index remapping.
|
|
37
|
+
- Map supported topology, analytic geometry, and NURBS records to a typed B-Rep
|
|
38
|
+
source model.
|
|
39
|
+
- Return structured diagnostics and enforce configurable resource limits.
|
|
40
|
+
- Use the same functionality from Python or a JSON command-line interface.
|
|
41
|
+
|
|
42
|
+
See [format support and limitations](docs/format-support.md) before relying on
|
|
43
|
+
the parser for production data.
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
Python 3.10 or newer is required. Install a downloaded wheel with `pip`:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python -m pip install /path/to/parasolid_kit-0.1.0.dev0-cp310-abi3-PLATFORM.whl
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
To install from a source checkout, Rust 1.88 or newer is also required:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
git clone https://github.com/monozukuri-ai/parasolid-kit.git
|
|
57
|
+
cd parasolid-kit
|
|
58
|
+
python -m pip install .
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The project is not yet claiming a published PyPI release. Once a release is
|
|
62
|
+
available there, the installation command will be `python -m pip install
|
|
63
|
+
parasolid-kit`.
|
|
64
|
+
|
|
65
|
+
## Schema catalogs
|
|
66
|
+
|
|
67
|
+
Header inspection works without external data. Complete parsing requires the
|
|
68
|
+
exact `sch_*.sch_txt` catalog identified by the file's internal schema key.
|
|
69
|
+
There is no fallback to a nearby version and no inferred replacement for a
|
|
70
|
+
missing catalog.
|
|
71
|
+
|
|
72
|
+
Siemens schema catalogs are not included in this repository or its packages.
|
|
73
|
+
You must provide a catalog from software or an SDK that you are licensed to use
|
|
74
|
+
and comply with its storage and redistribution terms. The parser reads the
|
|
75
|
+
catalog in place and does not copy it into the package.
|
|
76
|
+
|
|
77
|
+
## Python example
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from pathlib import Path
|
|
81
|
+
|
|
82
|
+
from parasolid_kit import (
|
|
83
|
+
InMemorySchemaProvider,
|
|
84
|
+
SchemaKey,
|
|
85
|
+
inspect_xb,
|
|
86
|
+
load_schema_catalog,
|
|
87
|
+
map_brep,
|
|
88
|
+
parse_xb,
|
|
89
|
+
write_xb,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
source = Path("model.x_b")
|
|
93
|
+
header = inspect_xb(source)
|
|
94
|
+
schema_id = SchemaKey.parse(header.schema_key).provider_schema
|
|
95
|
+
|
|
96
|
+
catalog = load_schema_catalog(
|
|
97
|
+
Path("/path/to/schema") / f"sch_{schema_id}.sch_txt",
|
|
98
|
+
expected_schema_id=schema_id,
|
|
99
|
+
)
|
|
100
|
+
provider = InMemorySchemaProvider((catalog,))
|
|
101
|
+
|
|
102
|
+
document = parse_xb(source, schema_provider=provider)
|
|
103
|
+
brep = map_brep(document)
|
|
104
|
+
|
|
105
|
+
print(header.modeller_version)
|
|
106
|
+
print(len(document.nodes), len(brep.bodies), brep.complete)
|
|
107
|
+
assert write_xb(document) == document.raw_bytes
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`map_brep()` can return a valid but incomplete model when a well-formed geometry
|
|
111
|
+
record has no typed mapping yet. Inspect `brep.complete` and `brep.diagnostics`
|
|
112
|
+
instead of assuming that every parsed record has been interpreted.
|
|
113
|
+
|
|
114
|
+
## Command line
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Header inspection does not need a schema catalog.
|
|
118
|
+
parasolid-kit inspect model.x_b
|
|
119
|
+
|
|
120
|
+
# Complete parsing and comparison require the exact catalog in --schema-dir.
|
|
121
|
+
parasolid-kit parse model.x_t --schema-dir /path/to/schema
|
|
122
|
+
parasolid-kit parse model.x_b --schema-dir /path/to/schema --brep
|
|
123
|
+
parasolid-kit compare model.x_t model.x_b --schema-dir /path/to/schema
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Reports are JSON. Exit status is `0` for success or equivalent documents, `1`
|
|
127
|
+
for a valid comparison that found differences, and `2` for input, schema, or
|
|
128
|
+
parse errors. `python -m parasolid_kit` provides the same interface.
|
|
129
|
+
|
|
130
|
+
## Documentation
|
|
131
|
+
|
|
132
|
+
- [Python API](docs/api.md)
|
|
133
|
+
- [Format support and limitations](docs/format-support.md)
|
|
134
|
+
- [Corpus provenance and redistribution policy](corpus/README.md)
|
|
135
|
+
|
|
136
|
+
## Project boundaries
|
|
137
|
+
|
|
138
|
+
`parasolid-kit` does not parse native CAD containers such as iCAD `.icd`, CAD
|
|
139
|
+
assembly structures, occurrence transforms, visibility, or appearance. A
|
|
140
|
+
format-specific adapter can extract a bounded X_T/X_B payload and pass it to
|
|
141
|
+
this package without making the parser depend on that CAD product.
|
|
142
|
+
|
|
143
|
+
The package has no runtime dependency on a CAD product, geometry kernel, or
|
|
144
|
+
OpenCascade binding. It does not bundle Siemens schema data or proprietary CAD
|
|
145
|
+
files.
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
150
|
+
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# parasolid-kit
|
|
2
|
+
|
|
3
|
+
`parasolid-kit` is an experimental, schema-aware parser for Parasolid X_T and
|
|
4
|
+
X_B transmit files. Parsing and geometry mapping run in a safe Rust core, while
|
|
5
|
+
Python users work with immutable typed models.
|
|
6
|
+
|
|
7
|
+
The project is read-focused and currently pre-alpha. It is intended for file
|
|
8
|
+
inspection, validation, research, and conversion pipelines where preserving
|
|
9
|
+
the transmitted structure matters more than silently approximating unsupported
|
|
10
|
+
data.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- Inspect X_T and X_B headers without a schema catalog.
|
|
15
|
+
- Parse complete X_T and X_B node streams with the exact caller-provided schema.
|
|
16
|
+
- Reconstruct an unmodified parsed X_B document byte-for-byte.
|
|
17
|
+
- Compare X_T and X_B documents after pointer-index remapping.
|
|
18
|
+
- Map supported topology, analytic geometry, and NURBS records to a typed B-Rep
|
|
19
|
+
source model.
|
|
20
|
+
- Return structured diagnostics and enforce configurable resource limits.
|
|
21
|
+
- Use the same functionality from Python or a JSON command-line interface.
|
|
22
|
+
|
|
23
|
+
See [format support and limitations](docs/format-support.md) before relying on
|
|
24
|
+
the parser for production data.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Python 3.10 or newer is required. Install a downloaded wheel with `pip`:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
python -m pip install /path/to/parasolid_kit-0.1.0.dev0-cp310-abi3-PLATFORM.whl
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
To install from a source checkout, Rust 1.88 or newer is also required:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://github.com/monozukuri-ai/parasolid-kit.git
|
|
38
|
+
cd parasolid-kit
|
|
39
|
+
python -m pip install .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The project is not yet claiming a published PyPI release. Once a release is
|
|
43
|
+
available there, the installation command will be `python -m pip install
|
|
44
|
+
parasolid-kit`.
|
|
45
|
+
|
|
46
|
+
## Schema catalogs
|
|
47
|
+
|
|
48
|
+
Header inspection works without external data. Complete parsing requires the
|
|
49
|
+
exact `sch_*.sch_txt` catalog identified by the file's internal schema key.
|
|
50
|
+
There is no fallback to a nearby version and no inferred replacement for a
|
|
51
|
+
missing catalog.
|
|
52
|
+
|
|
53
|
+
Siemens schema catalogs are not included in this repository or its packages.
|
|
54
|
+
You must provide a catalog from software or an SDK that you are licensed to use
|
|
55
|
+
and comply with its storage and redistribution terms. The parser reads the
|
|
56
|
+
catalog in place and does not copy it into the package.
|
|
57
|
+
|
|
58
|
+
## Python example
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from pathlib import Path
|
|
62
|
+
|
|
63
|
+
from parasolid_kit import (
|
|
64
|
+
InMemorySchemaProvider,
|
|
65
|
+
SchemaKey,
|
|
66
|
+
inspect_xb,
|
|
67
|
+
load_schema_catalog,
|
|
68
|
+
map_brep,
|
|
69
|
+
parse_xb,
|
|
70
|
+
write_xb,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
source = Path("model.x_b")
|
|
74
|
+
header = inspect_xb(source)
|
|
75
|
+
schema_id = SchemaKey.parse(header.schema_key).provider_schema
|
|
76
|
+
|
|
77
|
+
catalog = load_schema_catalog(
|
|
78
|
+
Path("/path/to/schema") / f"sch_{schema_id}.sch_txt",
|
|
79
|
+
expected_schema_id=schema_id,
|
|
80
|
+
)
|
|
81
|
+
provider = InMemorySchemaProvider((catalog,))
|
|
82
|
+
|
|
83
|
+
document = parse_xb(source, schema_provider=provider)
|
|
84
|
+
brep = map_brep(document)
|
|
85
|
+
|
|
86
|
+
print(header.modeller_version)
|
|
87
|
+
print(len(document.nodes), len(brep.bodies), brep.complete)
|
|
88
|
+
assert write_xb(document) == document.raw_bytes
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`map_brep()` can return a valid but incomplete model when a well-formed geometry
|
|
92
|
+
record has no typed mapping yet. Inspect `brep.complete` and `brep.diagnostics`
|
|
93
|
+
instead of assuming that every parsed record has been interpreted.
|
|
94
|
+
|
|
95
|
+
## Command line
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Header inspection does not need a schema catalog.
|
|
99
|
+
parasolid-kit inspect model.x_b
|
|
100
|
+
|
|
101
|
+
# Complete parsing and comparison require the exact catalog in --schema-dir.
|
|
102
|
+
parasolid-kit parse model.x_t --schema-dir /path/to/schema
|
|
103
|
+
parasolid-kit parse model.x_b --schema-dir /path/to/schema --brep
|
|
104
|
+
parasolid-kit compare model.x_t model.x_b --schema-dir /path/to/schema
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Reports are JSON. Exit status is `0` for success or equivalent documents, `1`
|
|
108
|
+
for a valid comparison that found differences, and `2` for input, schema, or
|
|
109
|
+
parse errors. `python -m parasolid_kit` provides the same interface.
|
|
110
|
+
|
|
111
|
+
## Documentation
|
|
112
|
+
|
|
113
|
+
- [Python API](docs/api.md)
|
|
114
|
+
- [Format support and limitations](docs/format-support.md)
|
|
115
|
+
- [Corpus provenance and redistribution policy](corpus/README.md)
|
|
116
|
+
|
|
117
|
+
## Project boundaries
|
|
118
|
+
|
|
119
|
+
`parasolid-kit` does not parse native CAD containers such as iCAD `.icd`, CAD
|
|
120
|
+
assembly structures, occurrence transforms, visibility, or appearance. A
|
|
121
|
+
format-specific adapter can extract a bounded X_T/X_B payload and pass it to
|
|
122
|
+
this package without making the parser depend on that CAD product.
|
|
123
|
+
|
|
124
|
+
The package has no runtime dependency on a CAD product, geometry kernel, or
|
|
125
|
+
OpenCascade binding. It does not bundle Siemens schema data or proprietary CAD
|
|
126
|
+
files.
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Corpus policy
|
|
2
|
+
|
|
3
|
+
The distributable corpus contains only Parasolid X_T/X_B files whose origin,
|
|
4
|
+
generator, export settings, checksums, and redistribution status are recorded
|
|
5
|
+
in `manifest.jsonl` and validated by `manifest.schema.json`.
|
|
6
|
+
|
|
7
|
+
The distributable corpus is currently empty. Files are added only after their
|
|
8
|
+
manifest entry, reproducible generation or acquisition record, checksums, and
|
|
9
|
+
redistribution status have been reviewed. A locally captured fixture remains
|
|
10
|
+
under `corpus/local/` until that review is complete.
|
|
11
|
+
|
|
12
|
+
## Scope
|
|
13
|
+
|
|
14
|
+
- Prefer small, self-generated X_T/X_B pairs with a reproducible construction
|
|
15
|
+
recipe.
|
|
16
|
+
- Export STEP from the same immutable model state when it is used as a geometry
|
|
17
|
+
oracle.
|
|
18
|
+
- Record exact product/build information and the explicitly selected Parasolid
|
|
19
|
+
target version.
|
|
20
|
+
- Keep credentials, private cloud document identifiers, and confidential CAD
|
|
21
|
+
data out of the repository.
|
|
22
|
+
- Keep native containers such as iCAD `.icd` outside this corpus. They belong to
|
|
23
|
+
an adapter-specific, local-only corpus unless redistribution is explicitly
|
|
24
|
+
allowed.
|
|
25
|
+
|
|
26
|
+
## Redistribution states
|
|
27
|
+
|
|
28
|
+
- `allowed`: reviewed and permitted to ship with this repository.
|
|
29
|
+
- `local_only`: may be used by a developer but must not be committed or packed.
|
|
30
|
+
- `unknown`: provenance is recorded but redistribution has not been cleared.
|
|
31
|
+
- `prohibited`: retained only as an external reference; do not copy it here.
|
|
32
|
+
|
|
33
|
+
An entry marked `unknown` or `prohibited` must never be included in a wheel,
|
|
34
|
+
sdist, source archive, or public test fixture.
|
|
35
|
+
|
|
36
|
+
## Layout
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
corpus/
|
|
40
|
+
manifest.schema.json
|
|
41
|
+
manifest.jsonl
|
|
42
|
+
generated/
|
|
43
|
+
<generator>/<lineage>/<parasolid-version>/<file>
|
|
44
|
+
local/ # ignored, local-only inputs
|
|
45
|
+
downloads/ # ignored, unreviewed third-party inputs
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`manifest.jsonl` is created with the first accepted file. Each non-empty line
|
|
49
|
+
must be one independent JSON object conforming to `manifest.schema.json`.
|
|
50
|
+
Paths are POSIX-style paths relative to this `corpus/` directory and public
|
|
51
|
+
entries must live under `generated/`. Every public entry must be marked
|
|
52
|
+
`allowed`, state its license or permission basis, and match the recorded
|
|
53
|
+
SHA-256 checksum. Run `uv run python scripts/verify_corpus.py` before building
|
|
54
|
+
distribution artifacts; the gate also rejects undeclared files under
|
|
55
|
+
`generated/`.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "parasolid-kit corpus manifest entry",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": [
|
|
7
|
+
"id",
|
|
8
|
+
"lineage_id",
|
|
9
|
+
"source_kind",
|
|
10
|
+
"generator",
|
|
11
|
+
"recipe",
|
|
12
|
+
"parasolid_version",
|
|
13
|
+
"encoding",
|
|
14
|
+
"path",
|
|
15
|
+
"sha256",
|
|
16
|
+
"redistribution",
|
|
17
|
+
"expected"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"id": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"pattern": "^[a-z0-9][a-z0-9._-]*$"
|
|
23
|
+
},
|
|
24
|
+
"lineage_id": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"pattern": "^[a-z0-9][a-z0-9._-]*$"
|
|
27
|
+
},
|
|
28
|
+
"source_kind": {
|
|
29
|
+
"enum": [
|
|
30
|
+
"self_generated",
|
|
31
|
+
"synthetic",
|
|
32
|
+
"third_party",
|
|
33
|
+
"local_reference"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"generator": {
|
|
37
|
+
"$ref": "#/$defs/generator"
|
|
38
|
+
},
|
|
39
|
+
"recipe": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"minLength": 1
|
|
42
|
+
},
|
|
43
|
+
"parasolid_version": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"minLength": 1
|
|
46
|
+
},
|
|
47
|
+
"encoding": {
|
|
48
|
+
"enum": ["text", "binary"]
|
|
49
|
+
},
|
|
50
|
+
"path": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"minLength": 1,
|
|
53
|
+
"description": "Repository-relative path to an X_T/X_B family file"
|
|
54
|
+
},
|
|
55
|
+
"sha256": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"pattern": "^[0-9a-f]{64}$"
|
|
58
|
+
},
|
|
59
|
+
"related": {
|
|
60
|
+
"$ref": "#/$defs/related"
|
|
61
|
+
},
|
|
62
|
+
"redistribution": {
|
|
63
|
+
"enum": ["allowed", "local_only", "unknown", "prohibited"]
|
|
64
|
+
},
|
|
65
|
+
"source_url": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"format": "uri"
|
|
68
|
+
},
|
|
69
|
+
"acquired_at": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"format": "date-time"
|
|
72
|
+
},
|
|
73
|
+
"license": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"minLength": 1
|
|
76
|
+
},
|
|
77
|
+
"expected": {
|
|
78
|
+
"$ref": "#/$defs/expected"
|
|
79
|
+
},
|
|
80
|
+
"notes": {
|
|
81
|
+
"type": "string"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"$defs": {
|
|
85
|
+
"generator": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"additionalProperties": false,
|
|
88
|
+
"required": ["product", "product_version", "document_version"],
|
|
89
|
+
"properties": {
|
|
90
|
+
"product": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"minLength": 1
|
|
93
|
+
},
|
|
94
|
+
"product_version": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"minLength": 1
|
|
97
|
+
},
|
|
98
|
+
"document_version": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"minLength": 1
|
|
101
|
+
},
|
|
102
|
+
"exporter_version": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"minLength": 1
|
|
105
|
+
},
|
|
106
|
+
"export_settings": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"additionalProperties": {
|
|
109
|
+
"type": ["string", "number", "integer", "boolean", "null"]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"related": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"additionalProperties": false,
|
|
117
|
+
"properties": {
|
|
118
|
+
"text": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"minLength": 1
|
|
121
|
+
},
|
|
122
|
+
"binary": {
|
|
123
|
+
"type": "string",
|
|
124
|
+
"minLength": 1
|
|
125
|
+
},
|
|
126
|
+
"step": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"minLength": 1
|
|
129
|
+
},
|
|
130
|
+
"native": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"minLength": 1
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"expected": {
|
|
137
|
+
"type": "object",
|
|
138
|
+
"additionalProperties": false,
|
|
139
|
+
"required": ["schema", "required_node_types"],
|
|
140
|
+
"properties": {
|
|
141
|
+
"schema": {
|
|
142
|
+
"type": ["string", "null"]
|
|
143
|
+
},
|
|
144
|
+
"required_node_types": {
|
|
145
|
+
"type": "array",
|
|
146
|
+
"items": {
|
|
147
|
+
"type": "integer",
|
|
148
|
+
"minimum": 0
|
|
149
|
+
},
|
|
150
|
+
"uniqueItems": true
|
|
151
|
+
},
|
|
152
|
+
"node_count": {
|
|
153
|
+
"type": "integer",
|
|
154
|
+
"minimum": 0
|
|
155
|
+
},
|
|
156
|
+
"body_count": {
|
|
157
|
+
"type": "integer",
|
|
158
|
+
"minimum": 0
|
|
159
|
+
},
|
|
160
|
+
"notes": {
|
|
161
|
+
"type": "string"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|