vcti-usd-schema-model 0.2.0__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.
- vcti_usd_schema_model-0.2.0/LICENSE +8 -0
- vcti_usd_schema_model-0.2.0/PKG-INFO +227 -0
- vcti_usd_schema_model-0.2.0/README.md +200 -0
- vcti_usd_schema_model-0.2.0/pyproject.toml +94 -0
- vcti_usd_schema_model-0.2.0/setup.cfg +4 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/__init__.py +85 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/builder.py +1344 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/cli.py +49 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/declarations.py +588 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/fixtures.py +94 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/plugin/generatedSchema.usda +485 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/plugin/plugInfo.json +215 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/plugin/schema.usda +279 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/py.typed +0 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/registry.py +95 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/buffers/cfd_slab1_points.bin +0 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/cad_assembly.usda +246 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/higher_order.usda +486 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/kinematic.usda +292 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/modal.usda +239 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/multiphysics.usda +381 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/nonlinear_mesh_change.usda +595 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/payloads/cfd_slab0_arrays.usda +65 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/payloads/cfd_slab0_edges.usda +17 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/prestressed_modal.usda +343 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/static_structural.usda +388 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/stages/transient_cfd.usda +490 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/validator.py +964 -0
- vcti_usd_schema_model-0.2.0/src/vcti/usd/schema/model/vocabulary.py +112 -0
- vcti_usd_schema_model-0.2.0/src/vcti_usd_schema_model.egg-info/PKG-INFO +227 -0
- vcti_usd_schema_model-0.2.0/src/vcti_usd_schema_model.egg-info/SOURCES.txt +44 -0
- vcti_usd_schema_model-0.2.0/src/vcti_usd_schema_model.egg-info/dependency_links.txt +1 -0
- vcti_usd_schema_model-0.2.0/src/vcti_usd_schema_model.egg-info/entry_points.txt +5 -0
- vcti_usd_schema_model-0.2.0/src/vcti_usd_schema_model.egg-info/requires.txt +14 -0
- vcti_usd_schema_model-0.2.0/src/vcti_usd_schema_model.egg-info/top_level.txt +1 -0
- vcti_usd_schema_model-0.2.0/tests/test_builder.py +116 -0
- vcti_usd_schema_model-0.2.0/tests/test_cli.py +48 -0
- vcti_usd_schema_model-0.2.0/tests/test_declarations.py +81 -0
- vcti_usd_schema_model-0.2.0/tests/test_docs.py +158 -0
- vcti_usd_schema_model-0.2.0/tests/test_examples.py +268 -0
- vcti_usd_schema_model-0.2.0/tests/test_fixtures.py +64 -0
- vcti_usd_schema_model-0.2.0/tests/test_registry.py +108 -0
- vcti_usd_schema_model-0.2.0/tests/test_validator.py +1005 -0
- vcti_usd_schema_model-0.2.0/tests/test_validator_composition.py +69 -0
- vcti_usd_schema_model-0.2.0/tests/test_version.py +15 -0
- vcti_usd_schema_model-0.2.0/tests/test_vocabulary.py +46 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Copyright (c) 2018-2026 Visual Collaboration Technologies Inc.
|
|
2
|
+
All Rights Reserved.
|
|
3
|
+
|
|
4
|
+
This software is proprietary and confidential. Unauthorized copying,
|
|
5
|
+
distribution, or use of this software, via any medium, is strictly
|
|
6
|
+
prohibited. Access is granted only to authorized VCollab developers
|
|
7
|
+
and individuals explicitly authorized by Visual Collaboration
|
|
8
|
+
Technologies Inc.
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vcti-usd-schema-model
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Codeless OpenUSD schema for the VCollab model, the stage the server builds for one model and projects into the viewer protocol: schema source, generated plugin, synthetic fixtures and a validator
|
|
5
|
+
Author: Visual Collaboration Technologies Inc.
|
|
6
|
+
License-Expression: LicenseRef-Proprietary
|
|
7
|
+
Project-URL: Repository, https://github.com/vcollab/vcti-python-usd-schema-model
|
|
8
|
+
Project-URL: Changelog, https://github.com/vcollab/vcti-python-usd-schema-model/blob/main/CHANGELOG.md
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Requires-Python: <3.15,>=3.12
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: usd-core<27,>=26.11
|
|
17
|
+
Provides-Extra: test
|
|
18
|
+
Requires-Dist: pytest; extra == "test"
|
|
19
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
20
|
+
Provides-Extra: lint
|
|
21
|
+
Requires-Dist: ruff; extra == "lint"
|
|
22
|
+
Provides-Extra: typecheck
|
|
23
|
+
Requires-Dist: mypy; extra == "typecheck"
|
|
24
|
+
Provides-Extra: schema
|
|
25
|
+
Requires-Dist: jinja2; extra == "schema"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# VCollab USD Model Schema
|
|
29
|
+
|
|
30
|
+
Codeless OpenUSD schema for the VCollab model, the stage the server builds for one model and projects into the viewer protocol: schema source, generated plugin, synthetic fixtures and a validator
|
|
31
|
+
|
|
32
|
+
## Overview
|
|
33
|
+
|
|
34
|
+
The model is the USD stage the VCollab server composes for one
|
|
35
|
+
model once its readers and operators have run. It holds everything a viewer
|
|
36
|
+
needs and nothing it has to compute, in three parts. **Definitions** describe
|
|
37
|
+
the objects a client understands: the logical assembly, meshes, named
|
|
38
|
+
representations, fields, frames, materials and histories. **Bindings** say
|
|
39
|
+
which arrays serve which combination: the points of one mesh, or the stress
|
|
40
|
+
values for those points at one frame. **Arrays** hold flat typed tuples
|
|
41
|
+
behind a small header, inline or in an external buffer file. Bindings and
|
|
42
|
+
the arrays they name are built on request, when a client asks for them. The
|
|
43
|
+
browser never receives USD; a packaging step projects the stage into the
|
|
44
|
+
viewer protocol, which names what the stage holds by prim path.
|
|
45
|
+
|
|
46
|
+
This package ships that schema as a codeless USD plugin, the declarations it
|
|
47
|
+
is generated from, nine fixture stages that each exercise one group of
|
|
48
|
+
contracts, the authoring helpers that reproduce the CAE fixtures, and the
|
|
49
|
+
validator a server-built stage must pass unchanged. The fixtures are
|
|
50
|
+
deliberately small and synthetic: they illustrate the contracts, not
|
|
51
|
+
engineering results.
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install vcti-usd-schema-model
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### In `requirements.txt`
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
vcti-usd-schema-model>=0.2.0
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### In `pyproject.toml` dependencies
|
|
66
|
+
|
|
67
|
+
```toml
|
|
68
|
+
dependencies = [
|
|
69
|
+
"vcti-usd-schema-model>=0.2.0",
|
|
70
|
+
]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Quick Start
|
|
76
|
+
|
|
77
|
+
### Validate a stage
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from vcti.usd.schema.model import open_fixture, validate
|
|
81
|
+
|
|
82
|
+
stage = open_fixture("static_structural")
|
|
83
|
+
errors = validate(stage)
|
|
84
|
+
print(errors) # [] for a conforming stage
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`open_fixture` and `open_stage` register the plugin first. Any failure is one
|
|
88
|
+
string, prefixed by the prim it concerns.
|
|
89
|
+
|
|
90
|
+
### Open your own stage with the plugin registered
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from pxr import Usd
|
|
94
|
+
|
|
95
|
+
from vcti.usd.schema.model import fixture_path, register_plugin
|
|
96
|
+
|
|
97
|
+
register_plugin()
|
|
98
|
+
stage = Usd.Stage.Open(str(fixture_path("transient_cfd")))
|
|
99
|
+
model = stage.GetPrimAtPath("/Model")
|
|
100
|
+
print(model.GetTypeName(), model.GetAttribute("vct:schemaVersion").Get())
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Registration is explicit and idempotent. Without it, every `Vct` prim is an
|
|
104
|
+
untyped prim with authored properties, and the validator reports each one.
|
|
105
|
+
It also registers every installed sibling schema, such as
|
|
106
|
+
`vcti-usd-schema-report`: USD only knows the plugins registered before it
|
|
107
|
+
first looks up a typed prim, so a process that opens stages itself calls
|
|
108
|
+
`register_plugin()` before the first one.
|
|
109
|
+
|
|
110
|
+
### Author a stage
|
|
111
|
+
|
|
112
|
+
The builder module is the smallest API that writes a conforming stage. A
|
|
113
|
+
one-mesh model with a single load case and one field:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from pathlib import Path
|
|
117
|
+
|
|
118
|
+
from vcti.usd.schema.model import open_stage, validate
|
|
119
|
+
from vcti.usd.schema.model.builder import (
|
|
120
|
+
L_POINTS,
|
|
121
|
+
L_TRIANGLES,
|
|
122
|
+
add_array,
|
|
123
|
+
add_field,
|
|
124
|
+
add_frame,
|
|
125
|
+
add_frame_group,
|
|
126
|
+
add_index_data,
|
|
127
|
+
add_mesh,
|
|
128
|
+
add_occurrence,
|
|
129
|
+
add_points_data,
|
|
130
|
+
bind_field,
|
|
131
|
+
finish,
|
|
132
|
+
flat,
|
|
133
|
+
new_model_stage,
|
|
134
|
+
vector_values,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
stage = new_model_stage(Path("bracket.usda"), "run://example")
|
|
138
|
+
mesh = add_mesh(stage, "bracket", L_POINTS)
|
|
139
|
+
points = add_array(stage, "points", "float32", 3, flat(L_POINTS))
|
|
140
|
+
normals = add_array(stage, "normals", "float32", 3, flat([(0, 0, 1)] * 6))
|
|
141
|
+
triangles = add_array(stage, "triangles", "int32", 3, L_TRIANGLES)
|
|
142
|
+
data = add_points_data(stage, "bracketPoints", mesh, points, normals, extent=L_POINTS)
|
|
143
|
+
add_index_data(stage, "bracketSurface", mesh, data, triangles, "surface")
|
|
144
|
+
add_occurrence(stage, "bracket", mesh)
|
|
145
|
+
add_frame_group(stage, "loadCases", "loadCase", "static")
|
|
146
|
+
frame = add_frame(stage, "loadCases/tension", 0)
|
|
147
|
+
displacement = add_field(stage, "displacement", "vector", "m", "displacement", "deformation")
|
|
148
|
+
values = add_array(stage, "u_tension", "float32", 3, vector_values(L_POINTS, 0.001))
|
|
149
|
+
bind_field(stage, "u_tension", data, displacement, values, frame, ranges=True)
|
|
150
|
+
finish(stage)
|
|
151
|
+
|
|
152
|
+
print(validate(open_stage("bracket.usda")))
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### From the command line
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
vcti-usd-model-validate model.usda other.usda
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
One line per stage, `PASS` or `FAIL`, each failure indented beneath it, and
|
|
162
|
+
a non-zero exit status when any stage fails or cannot be opened.
|
|
163
|
+
|
|
164
|
+
### Rebuild the fixtures
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
from pathlib import Path
|
|
168
|
+
|
|
169
|
+
from vcti.usd.schema.model import build_fixtures
|
|
170
|
+
|
|
171
|
+
written = build_fixtures(Path("stages"))
|
|
172
|
+
print([p.name for p in written])
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The eight CAE fixtures are written with the authoring helpers. The shipped
|
|
176
|
+
copies are authored by hand so they can carry comments; the tests assert the
|
|
177
|
+
two compose to the same prims and values.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Key API
|
|
182
|
+
|
|
183
|
+
| Name | What it does |
|
|
184
|
+
|---|---|
|
|
185
|
+
| `register_plugin()` | Register the shipped codeless plugin, and every installed sibling schema's, with this process, once |
|
|
186
|
+
| `open_stage(path)`, `open_fixture(name)` | Open with the plugin registered |
|
|
187
|
+
| `validate(stage)`, `validate_file(path)` | Every contract the schema states, as a list of messages |
|
|
188
|
+
| `fixture_path(name)`, `fixture_paths()`, `FIXTURE_NAMES` | The nine shipped stages |
|
|
189
|
+
| `build_fixtures(dir)` | Write the eight CAE fixtures, payloads and buffer |
|
|
190
|
+
| `render_schema()`, `write_schema(path)` | The `schema.usda` text, from the declarations |
|
|
191
|
+
| `SCHEMA_VERSION`, `FAMILY_WIDTH`, `ELEMENT_TYPES`, … | The closed vocabularies |
|
|
192
|
+
|
|
193
|
+
The fixtures, in reading order:
|
|
194
|
+
|
|
195
|
+
| Fixture | Scenario | Contracts it exercises |
|
|
196
|
+
|---|---|---|
|
|
197
|
+
| `cad_assembly` | A knuckle assembly | Occurrences, placements, shared geometry, incremental detail, part attributes |
|
|
198
|
+
| `higher_order` | A plate of quadratic triangles | Array composition: refinement extends points with complete indices, growth extends both; fields compose too |
|
|
199
|
+
| `static_structural` | One bracket, three load cases | Normals, source ids, a material, frames, bindings with ranges, provenance, a constant field |
|
|
200
|
+
| `modal` | Three bracket modes | Mode-indexed results, one mode per frame |
|
|
201
|
+
| `prestressed_modal` | Modes about two thermal conditions | Nested frame groups, inheritance down the tree, shared arrays across frames |
|
|
202
|
+
| `multiphysics` | Thermal, structural and modal branches | Data at some field and frame combinations only, reference conditions on frames and groups |
|
|
203
|
+
| `transient_cfd` | Flow on two skin patches | Physical time, histories, atoms, element death, payloads, a located array |
|
|
204
|
+
| `kinematic` | A crank and slider | History-only rigid-body motion, arrays shared across meshes |
|
|
205
|
+
| `nonlinear_mesh_change` | A rigid tool and a remeshed workpiece | Per-occurrence mesh selection across a topology change |
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Dependencies
|
|
210
|
+
|
|
211
|
+
- `usd-core` 26.11 or later within the 26 series, the OpenUSD Python
|
|
212
|
+
distribution. Wheels exist for every Python the package supports. The
|
|
213
|
+
shipped plugin was generated by that version's `usdGenSchema`, so a new
|
|
214
|
+
major is admitted only after regeneration.
|
|
215
|
+
- `jinja2`, in the `schema` extra, only to regenerate the plugin.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Documentation
|
|
220
|
+
|
|
221
|
+
| If you want to… | Read |
|
|
222
|
+
|---|---|
|
|
223
|
+
| Get started using the package | Quick Start above |
|
|
224
|
+
| Understand the model and the decisions behind it | [docs/design.md](docs/design.md) |
|
|
225
|
+
| Walk through the fixtures scenario by scenario | [docs/patterns.md](docs/patterns.md) |
|
|
226
|
+
| Navigate and understand the source | [docs/source-guide.md](docs/source-guide.md) |
|
|
227
|
+
| Add a type, a property, a check or a fixture | [docs/extending.md](docs/extending.md) |
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# VCollab USD Model Schema
|
|
2
|
+
|
|
3
|
+
Codeless OpenUSD schema for the VCollab model, the stage the server builds for one model and projects into the viewer protocol: schema source, generated plugin, synthetic fixtures and a validator
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The model is the USD stage the VCollab server composes for one
|
|
8
|
+
model once its readers and operators have run. It holds everything a viewer
|
|
9
|
+
needs and nothing it has to compute, in three parts. **Definitions** describe
|
|
10
|
+
the objects a client understands: the logical assembly, meshes, named
|
|
11
|
+
representations, fields, frames, materials and histories. **Bindings** say
|
|
12
|
+
which arrays serve which combination: the points of one mesh, or the stress
|
|
13
|
+
values for those points at one frame. **Arrays** hold flat typed tuples
|
|
14
|
+
behind a small header, inline or in an external buffer file. Bindings and
|
|
15
|
+
the arrays they name are built on request, when a client asks for them. The
|
|
16
|
+
browser never receives USD; a packaging step projects the stage into the
|
|
17
|
+
viewer protocol, which names what the stage holds by prim path.
|
|
18
|
+
|
|
19
|
+
This package ships that schema as a codeless USD plugin, the declarations it
|
|
20
|
+
is generated from, nine fixture stages that each exercise one group of
|
|
21
|
+
contracts, the authoring helpers that reproduce the CAE fixtures, and the
|
|
22
|
+
validator a server-built stage must pass unchanged. The fixtures are
|
|
23
|
+
deliberately small and synthetic: they illustrate the contracts, not
|
|
24
|
+
engineering results.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install vcti-usd-schema-model
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### In `requirements.txt`
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
vcti-usd-schema-model>=0.2.0
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### In `pyproject.toml` dependencies
|
|
39
|
+
|
|
40
|
+
```toml
|
|
41
|
+
dependencies = [
|
|
42
|
+
"vcti-usd-schema-model>=0.2.0",
|
|
43
|
+
]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
### Validate a stage
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from vcti.usd.schema.model import open_fixture, validate
|
|
54
|
+
|
|
55
|
+
stage = open_fixture("static_structural")
|
|
56
|
+
errors = validate(stage)
|
|
57
|
+
print(errors) # [] for a conforming stage
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`open_fixture` and `open_stage` register the plugin first. Any failure is one
|
|
61
|
+
string, prefixed by the prim it concerns.
|
|
62
|
+
|
|
63
|
+
### Open your own stage with the plugin registered
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from pxr import Usd
|
|
67
|
+
|
|
68
|
+
from vcti.usd.schema.model import fixture_path, register_plugin
|
|
69
|
+
|
|
70
|
+
register_plugin()
|
|
71
|
+
stage = Usd.Stage.Open(str(fixture_path("transient_cfd")))
|
|
72
|
+
model = stage.GetPrimAtPath("/Model")
|
|
73
|
+
print(model.GetTypeName(), model.GetAttribute("vct:schemaVersion").Get())
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Registration is explicit and idempotent. Without it, every `Vct` prim is an
|
|
77
|
+
untyped prim with authored properties, and the validator reports each one.
|
|
78
|
+
It also registers every installed sibling schema, such as
|
|
79
|
+
`vcti-usd-schema-report`: USD only knows the plugins registered before it
|
|
80
|
+
first looks up a typed prim, so a process that opens stages itself calls
|
|
81
|
+
`register_plugin()` before the first one.
|
|
82
|
+
|
|
83
|
+
### Author a stage
|
|
84
|
+
|
|
85
|
+
The builder module is the smallest API that writes a conforming stage. A
|
|
86
|
+
one-mesh model with a single load case and one field:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from pathlib import Path
|
|
90
|
+
|
|
91
|
+
from vcti.usd.schema.model import open_stage, validate
|
|
92
|
+
from vcti.usd.schema.model.builder import (
|
|
93
|
+
L_POINTS,
|
|
94
|
+
L_TRIANGLES,
|
|
95
|
+
add_array,
|
|
96
|
+
add_field,
|
|
97
|
+
add_frame,
|
|
98
|
+
add_frame_group,
|
|
99
|
+
add_index_data,
|
|
100
|
+
add_mesh,
|
|
101
|
+
add_occurrence,
|
|
102
|
+
add_points_data,
|
|
103
|
+
bind_field,
|
|
104
|
+
finish,
|
|
105
|
+
flat,
|
|
106
|
+
new_model_stage,
|
|
107
|
+
vector_values,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
stage = new_model_stage(Path("bracket.usda"), "run://example")
|
|
111
|
+
mesh = add_mesh(stage, "bracket", L_POINTS)
|
|
112
|
+
points = add_array(stage, "points", "float32", 3, flat(L_POINTS))
|
|
113
|
+
normals = add_array(stage, "normals", "float32", 3, flat([(0, 0, 1)] * 6))
|
|
114
|
+
triangles = add_array(stage, "triangles", "int32", 3, L_TRIANGLES)
|
|
115
|
+
data = add_points_data(stage, "bracketPoints", mesh, points, normals, extent=L_POINTS)
|
|
116
|
+
add_index_data(stage, "bracketSurface", mesh, data, triangles, "surface")
|
|
117
|
+
add_occurrence(stage, "bracket", mesh)
|
|
118
|
+
add_frame_group(stage, "loadCases", "loadCase", "static")
|
|
119
|
+
frame = add_frame(stage, "loadCases/tension", 0)
|
|
120
|
+
displacement = add_field(stage, "displacement", "vector", "m", "displacement", "deformation")
|
|
121
|
+
values = add_array(stage, "u_tension", "float32", 3, vector_values(L_POINTS, 0.001))
|
|
122
|
+
bind_field(stage, "u_tension", data, displacement, values, frame, ranges=True)
|
|
123
|
+
finish(stage)
|
|
124
|
+
|
|
125
|
+
print(validate(open_stage("bracket.usda")))
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### From the command line
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
vcti-usd-model-validate model.usda other.usda
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
One line per stage, `PASS` or `FAIL`, each failure indented beneath it, and
|
|
135
|
+
a non-zero exit status when any stage fails or cannot be opened.
|
|
136
|
+
|
|
137
|
+
### Rebuild the fixtures
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from pathlib import Path
|
|
141
|
+
|
|
142
|
+
from vcti.usd.schema.model import build_fixtures
|
|
143
|
+
|
|
144
|
+
written = build_fixtures(Path("stages"))
|
|
145
|
+
print([p.name for p in written])
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The eight CAE fixtures are written with the authoring helpers. The shipped
|
|
149
|
+
copies are authored by hand so they can carry comments; the tests assert the
|
|
150
|
+
two compose to the same prims and values.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Key API
|
|
155
|
+
|
|
156
|
+
| Name | What it does |
|
|
157
|
+
|---|---|
|
|
158
|
+
| `register_plugin()` | Register the shipped codeless plugin, and every installed sibling schema's, with this process, once |
|
|
159
|
+
| `open_stage(path)`, `open_fixture(name)` | Open with the plugin registered |
|
|
160
|
+
| `validate(stage)`, `validate_file(path)` | Every contract the schema states, as a list of messages |
|
|
161
|
+
| `fixture_path(name)`, `fixture_paths()`, `FIXTURE_NAMES` | The nine shipped stages |
|
|
162
|
+
| `build_fixtures(dir)` | Write the eight CAE fixtures, payloads and buffer |
|
|
163
|
+
| `render_schema()`, `write_schema(path)` | The `schema.usda` text, from the declarations |
|
|
164
|
+
| `SCHEMA_VERSION`, `FAMILY_WIDTH`, `ELEMENT_TYPES`, … | The closed vocabularies |
|
|
165
|
+
|
|
166
|
+
The fixtures, in reading order:
|
|
167
|
+
|
|
168
|
+
| Fixture | Scenario | Contracts it exercises |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| `cad_assembly` | A knuckle assembly | Occurrences, placements, shared geometry, incremental detail, part attributes |
|
|
171
|
+
| `higher_order` | A plate of quadratic triangles | Array composition: refinement extends points with complete indices, growth extends both; fields compose too |
|
|
172
|
+
| `static_structural` | One bracket, three load cases | Normals, source ids, a material, frames, bindings with ranges, provenance, a constant field |
|
|
173
|
+
| `modal` | Three bracket modes | Mode-indexed results, one mode per frame |
|
|
174
|
+
| `prestressed_modal` | Modes about two thermal conditions | Nested frame groups, inheritance down the tree, shared arrays across frames |
|
|
175
|
+
| `multiphysics` | Thermal, structural and modal branches | Data at some field and frame combinations only, reference conditions on frames and groups |
|
|
176
|
+
| `transient_cfd` | Flow on two skin patches | Physical time, histories, atoms, element death, payloads, a located array |
|
|
177
|
+
| `kinematic` | A crank and slider | History-only rigid-body motion, arrays shared across meshes |
|
|
178
|
+
| `nonlinear_mesh_change` | A rigid tool and a remeshed workpiece | Per-occurrence mesh selection across a topology change |
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Dependencies
|
|
183
|
+
|
|
184
|
+
- `usd-core` 26.11 or later within the 26 series, the OpenUSD Python
|
|
185
|
+
distribution. Wheels exist for every Python the package supports. The
|
|
186
|
+
shipped plugin was generated by that version's `usdGenSchema`, so a new
|
|
187
|
+
major is admitted only after regeneration.
|
|
188
|
+
- `jinja2`, in the `schema` extra, only to regenerate the plugin.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Documentation
|
|
193
|
+
|
|
194
|
+
| If you want to… | Read |
|
|
195
|
+
|---|---|
|
|
196
|
+
| Get started using the package | Quick Start above |
|
|
197
|
+
| Understand the model and the decisions behind it | [docs/design.md](docs/design.md) |
|
|
198
|
+
| Walk through the fixtures scenario by scenario | [docs/patterns.md](docs/patterns.md) |
|
|
199
|
+
| Navigate and understand the source | [docs/source-guide.md](docs/source-guide.md) |
|
|
200
|
+
| Add a type, a property, a check or a fixture | [docs/extending.md](docs/extending.md) |
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vcti-usd-schema-model"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Codeless OpenUSD schema for the VCollab model, the stage the server builds for one model and projects into the viewer protocol: schema source, generated plugin, synthetic fixtures and a validator"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Visual Collaboration Technologies Inc."}
|
|
12
|
+
]
|
|
13
|
+
license = "LicenseRef-Proprietary"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
]
|
|
21
|
+
requires-python = ">=3.12,<3.15"
|
|
22
|
+
dependencies = [
|
|
23
|
+
# The shipped plugin was generated by usdGenSchema 26.11; a new major is
|
|
24
|
+
# admitted only after the plugin is regenerated and checked against it.
|
|
25
|
+
"usd-core>=26.11,<27",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Repository = "https://github.com/vcollab/vcti-python-usd-schema-model"
|
|
30
|
+
Changelog = "https://github.com/vcollab/vcti-python-usd-schema-model/blob/main/CHANGELOG.md"
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
vcti-usd-model-validate = "vcti.usd.schema.model.cli:main"
|
|
34
|
+
|
|
35
|
+
# Every schema package of the family names its plugin directory here, and
|
|
36
|
+
# each one's register_plugin() registers them all; see registry.py.
|
|
37
|
+
[project.entry-points."vcti.usd.schema"]
|
|
38
|
+
model = "vcti.usd.schema.model.registry:PLUGIN_DIR"
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["src"]
|
|
42
|
+
include = ["vcti.usd.schema.model", "vcti.usd.schema.model.*"]
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.package-data]
|
|
45
|
+
"vcti.usd.schema.model" = [
|
|
46
|
+
"py.typed",
|
|
47
|
+
"plugin/*.json",
|
|
48
|
+
"plugin/*.usda",
|
|
49
|
+
"stages/*.usda",
|
|
50
|
+
"stages/payloads/*.usda",
|
|
51
|
+
"stages/buffers/*.bin",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[project.optional-dependencies]
|
|
55
|
+
test = ["pytest", "pytest-cov"]
|
|
56
|
+
lint = ["ruff"]
|
|
57
|
+
typecheck = ["mypy"]
|
|
58
|
+
# usdGenSchema, which regenerates the plugin, renders its output with jinja2.
|
|
59
|
+
schema = ["jinja2"]
|
|
60
|
+
|
|
61
|
+
[tool.pytest.ini_options]
|
|
62
|
+
addopts = "--cov=vcti.usd.schema.model --cov-report=term-missing --cov-fail-under=95"
|
|
63
|
+
|
|
64
|
+
[tool.mypy]
|
|
65
|
+
python_version = "3.12"
|
|
66
|
+
strict = true
|
|
67
|
+
files = ["src"]
|
|
68
|
+
namespace_packages = true
|
|
69
|
+
explicit_package_bases = true
|
|
70
|
+
mypy_path = ["src"]
|
|
71
|
+
|
|
72
|
+
# usd-core ships no type information, so its modules are untyped here.
|
|
73
|
+
[[tool.mypy.overrides]]
|
|
74
|
+
module = ["pxr.*"]
|
|
75
|
+
ignore_missing_imports = true
|
|
76
|
+
|
|
77
|
+
[tool.coverage.run]
|
|
78
|
+
branch = true
|
|
79
|
+
|
|
80
|
+
[tool.coverage.report]
|
|
81
|
+
exclude_also = [
|
|
82
|
+
"raise NotImplementedError",
|
|
83
|
+
"if TYPE_CHECKING:",
|
|
84
|
+
"if __name__ == .__main__.:",
|
|
85
|
+
"@(abc\\.)?abstractmethod",
|
|
86
|
+
"^\\s*\\.\\.\\.\\s*$",
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
[tool.ruff]
|
|
90
|
+
target-version = "py312"
|
|
91
|
+
line-length = 99
|
|
92
|
+
|
|
93
|
+
[tool.ruff.lint]
|
|
94
|
+
select = ["E", "F", "W", "I", "UP"]
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Copyright Visual Collaboration Technologies Inc. All Rights Reserved.
|
|
2
|
+
# See LICENSE for details.
|
|
3
|
+
"""vcti.usd.schema.model: the OpenUSD schema for the VCollab model.
|
|
4
|
+
|
|
5
|
+
The model is the stage the VCollab server builds for one model and
|
|
6
|
+
projects into the viewer protocol. This package ships that schema as a
|
|
7
|
+
codeless USD plugin, the declarations it is generated from, nine fixture
|
|
8
|
+
stages that exercise its contracts, the authoring helpers that reproduce the
|
|
9
|
+
CAE fixtures, and the validator a server-built stage must pass.
|
|
10
|
+
|
|
11
|
+
Typical use::
|
|
12
|
+
|
|
13
|
+
from vcti.usd.schema.model import open_fixture, validate
|
|
14
|
+
|
|
15
|
+
stage = open_fixture("static_structural")
|
|
16
|
+
assert validate(stage) == []
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from importlib.metadata import version
|
|
20
|
+
|
|
21
|
+
from .builder import build_fixtures
|
|
22
|
+
from .declarations import normalize_plugin_info, render_schema, write_schema
|
|
23
|
+
from .fixtures import (
|
|
24
|
+
BUILT_FIXTURE_NAMES,
|
|
25
|
+
FIXTURE_NAMES,
|
|
26
|
+
STAGES_DIR,
|
|
27
|
+
fixture_path,
|
|
28
|
+
fixture_paths,
|
|
29
|
+
open_fixture,
|
|
30
|
+
open_stage,
|
|
31
|
+
)
|
|
32
|
+
from .registry import ENTRY_POINT_GROUP, PLUGIN_DIR, is_registered, plugin_dirs, register_plugin
|
|
33
|
+
from .validator import validate, validate_file
|
|
34
|
+
from .vocabulary import (
|
|
35
|
+
COMPONENT_ORDER,
|
|
36
|
+
ELEMENT_TYPES,
|
|
37
|
+
FAMILY_WIDTH,
|
|
38
|
+
FIDELITIES,
|
|
39
|
+
GEOMETRY_ARRAYS,
|
|
40
|
+
LIBRARY_NAME,
|
|
41
|
+
MAPPINGS,
|
|
42
|
+
MODEL_KINDS,
|
|
43
|
+
PRECISIONS,
|
|
44
|
+
PRIMITIVE_TOKEN,
|
|
45
|
+
PRIMITIVES,
|
|
46
|
+
SCHEMA_VERSION,
|
|
47
|
+
SOURCE_ASSOCIATIONS,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
__version__ = version("vcti-usd-schema-model")
|
|
51
|
+
|
|
52
|
+
__all__ = [
|
|
53
|
+
"BUILT_FIXTURE_NAMES",
|
|
54
|
+
"COMPONENT_ORDER",
|
|
55
|
+
"ELEMENT_TYPES",
|
|
56
|
+
"ENTRY_POINT_GROUP",
|
|
57
|
+
"FAMILY_WIDTH",
|
|
58
|
+
"FIDELITIES",
|
|
59
|
+
"FIXTURE_NAMES",
|
|
60
|
+
"GEOMETRY_ARRAYS",
|
|
61
|
+
"LIBRARY_NAME",
|
|
62
|
+
"MAPPINGS",
|
|
63
|
+
"MODEL_KINDS",
|
|
64
|
+
"PLUGIN_DIR",
|
|
65
|
+
"PRECISIONS",
|
|
66
|
+
"PRIMITIVES",
|
|
67
|
+
"PRIMITIVE_TOKEN",
|
|
68
|
+
"SCHEMA_VERSION",
|
|
69
|
+
"SOURCE_ASSOCIATIONS",
|
|
70
|
+
"STAGES_DIR",
|
|
71
|
+
"__version__",
|
|
72
|
+
"build_fixtures",
|
|
73
|
+
"fixture_path",
|
|
74
|
+
"fixture_paths",
|
|
75
|
+
"is_registered",
|
|
76
|
+
"normalize_plugin_info",
|
|
77
|
+
"open_fixture",
|
|
78
|
+
"open_stage",
|
|
79
|
+
"plugin_dirs",
|
|
80
|
+
"register_plugin",
|
|
81
|
+
"render_schema",
|
|
82
|
+
"validate",
|
|
83
|
+
"validate_file",
|
|
84
|
+
"write_schema",
|
|
85
|
+
]
|