theseus-cad 1.2.1__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.
Files changed (64) hide show
  1. theseus_cad-1.2.1/LICENSE +21 -0
  2. theseus_cad-1.2.1/PKG-INFO +385 -0
  3. theseus_cad-1.2.1/README.md +346 -0
  4. theseus_cad-1.2.1/pyproject.toml +55 -0
  5. theseus_cad-1.2.1/setup.cfg +4 -0
  6. theseus_cad-1.2.1/tests/test_align.py +128 -0
  7. theseus_cad-1.2.1/tests/test_ci.py +394 -0
  8. theseus_cad-1.2.1/tests/test_cli.py +132 -0
  9. theseus_cad-1.2.1/tests/test_features.py +188 -0
  10. theseus_cad-1.2.1/tests/test_formats.py +215 -0
  11. theseus_cad-1.2.1/tests/test_local.py +282 -0
  12. theseus_cad-1.2.1/tests/test_motion.py +160 -0
  13. theseus_cad-1.2.1/tests/test_precision.py +260 -0
  14. theseus_cad-1.2.1/tests/test_publish.py +186 -0
  15. theseus_cad-1.2.1/tests/test_real_file_regressions.py +393 -0
  16. theseus_cad-1.2.1/tests/test_theseus.py +195 -0
  17. theseus_cad-1.2.1/tests/test_viewer.py +96 -0
  18. theseus_cad-1.2.1/tests/test_visual.py +111 -0
  19. theseus_cad-1.2.1/theseus/__init__.py +3 -0
  20. theseus_cad-1.2.1/theseus/__main__.py +5 -0
  21. theseus_cad-1.2.1/theseus/_boolean_worker.py +37 -0
  22. theseus_cad-1.2.1/theseus/_worker.py +48 -0
  23. theseus_cad-1.2.1/theseus/analyze.py +121 -0
  24. theseus_cad-1.2.1/theseus/app.py +251 -0
  25. theseus_cad-1.2.1/theseus/ci.py +269 -0
  26. theseus_cad-1.2.1/theseus/cli.py +317 -0
  27. theseus_cad-1.2.1/theseus/compare.py +464 -0
  28. theseus_cad-1.2.1/theseus/diff/__init__.py +87 -0
  29. theseus_cad-1.2.1/theseus/diff/align.py +263 -0
  30. theseus_cad-1.2.1/theseus/diff/brep.py +607 -0
  31. theseus_cad-1.2.1/theseus/diff/features.py +499 -0
  32. theseus_cad-1.2.1/theseus/diff/motion.py +206 -0
  33. theseus_cad-1.2.1/theseus/diff/surface.py +289 -0
  34. theseus_cad-1.2.1/theseus/diff/visual.py +259 -0
  35. theseus_cad-1.2.1/theseus/export.py +80 -0
  36. theseus_cad-1.2.1/theseus/fmt.py +29 -0
  37. theseus_cad-1.2.1/theseus/formats/__init__.py +159 -0
  38. theseus_cad-1.2.1/theseus/formats/brep.py +123 -0
  39. theseus_cad-1.2.1/theseus/formats/mesh.py +68 -0
  40. theseus_cad-1.2.1/theseus/formats/units.py +30 -0
  41. theseus_cad-1.2.1/theseus/gitops.py +130 -0
  42. theseus_cad-1.2.1/theseus/images.py +79 -0
  43. theseus_cad-1.2.1/theseus/integrate.py +121 -0
  44. theseus_cad-1.2.1/theseus/isolate.py +124 -0
  45. theseus_cad-1.2.1/theseus/load.py +22 -0
  46. theseus_cad-1.2.1/theseus/local.py +145 -0
  47. theseus_cad-1.2.1/theseus/mesh.py +73 -0
  48. theseus_cad-1.2.1/theseus/metrics.py +204 -0
  49. theseus_cad-1.2.1/theseus/model.py +81 -0
  50. theseus_cad-1.2.1/theseus/publish.py +101 -0
  51. theseus_cad-1.2.1/theseus/render/__init__.py +165 -0
  52. theseus_cad-1.2.1/theseus/render/display.py +89 -0
  53. theseus_cad-1.2.1/theseus/render/mpl_backend.py +118 -0
  54. theseus_cad-1.2.1/theseus/render/scene.py +179 -0
  55. theseus_cad-1.2.1/theseus/render/vtk_backend.py +150 -0
  56. theseus_cad-1.2.1/theseus/report_html.py +139 -0
  57. theseus_cad-1.2.1/theseus/textconv.py +92 -0
  58. theseus_cad-1.2.1/theseus/viewer.py +274 -0
  59. theseus_cad-1.2.1/theseus_cad.egg-info/PKG-INFO +385 -0
  60. theseus_cad-1.2.1/theseus_cad.egg-info/SOURCES.txt +62 -0
  61. theseus_cad-1.2.1/theseus_cad.egg-info/dependency_links.txt +1 -0
  62. theseus_cad-1.2.1/theseus_cad.egg-info/entry_points.txt +2 -0
  63. theseus_cad-1.2.1/theseus_cad.egg-info/requires.txt +10 -0
  64. theseus_cad-1.2.1/theseus_cad.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 arkapravopal04
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,385 @@
1
+ Metadata-Version: 2.4
2
+ Name: theseus-cad
3
+ Version: 1.2.1
4
+ Summary: See exactly what changed between two versions of a CAD file (STEP, IGES, STL, 3MF, ...) — which face, which hole, by how many microns — without CAD software.
5
+ License: MIT
6
+ Project-URL: Homepage, https://github.com/arkapravopal04/theseus
7
+ Project-URL: Issues, https://github.com/arkapravopal04/theseus/issues
8
+ Project-URL: Changelog, https://github.com/arkapravopal04/theseus/blob/main/CHANGELOG.md
9
+ Keywords: cad,step,stl,diff,git,mechanical engineering,opencascade,code review
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Manufacturing
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering
23
+ Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
24
+ Classifier: Topic :: Software Development :: Version Control :: Git
25
+ Requires-Python: >=3.11
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: cadquery-ocp==8.0.1.0.0
29
+ Requires-Dist: numpy
30
+ Requires-Dist: trimesh
31
+ Requires-Dist: matplotlib
32
+ Requires-Dist: scipy
33
+ Requires-Dist: networkx
34
+ Requires-Dist: lxml
35
+ Requires-Dist: rtree
36
+ Requires-Dist: manifold3d
37
+ Requires-Dist: vtk
38
+ Dynamic: license-file
39
+
40
+ # theseus
41
+
42
+ See exactly what changed in a CAD file — which face moved, which hole grew, by how many
43
+ microns — without opening CAD software. `theseus` compares two versions of a STEP, IGES,
44
+ BREP, STL, 3MF, OBJ, PLY, OFF or GLB file geometrically, and reports every difference with
45
+ its location and size, down to the precision the files themselves can represent. Drop two files
46
+ into a browser window, run it from `git diff` on any git host, or let it comment on every pull
47
+ request that touches a CAD file. Everything runs on your own machine or CI runner; your geometry
48
+ is never sent to an outside service.
49
+
50
+ | Before | After | Difference |
51
+ |:-:|:-:|:-:|
52
+ | ![Before](docs/example-before.png) | ![After](docs/example-after.png) | ![Difference](docs/example-diff.png) |
53
+
54
+ ```
55
+ bracket.step (changed)
56
+ - Geometry: 3 differences (exact B-rep; detection limit: geometry kernel precision (0.1 nm)):
57
+ - ① through hole along Z Ø8.000 at (50.000, 25.000) → (50.500, 25.000) — axis moved 0.500 mm
58
+ - ② 2 vertices moved, added or removed — largest 0.500 mm at (54.500, 25.000, 10.000)
59
+ ...
60
+ ```
61
+
62
+ That hole moved 0.5 mm without changing the part's volume or bounding box — a numbers-only
63
+ diff would call it unchanged. A **1 µm** change is still unmissable, with a zoomed detail:
64
+
65
+ ![A 1 µm face offset, shown as a deviation map with a zoomed detail](docs/example-micro.png)
66
+
67
+ Every PR comment starts with a summary of what changed, then one expandable section per file:
68
+
69
+ | File | Result | Largest difference | What changed |
70
+ |---|---|---|---|
71
+ | `bracket.step` | **changed** | 0.500 mm | through hole along Z Ø8.000 at (50.000, 25.000) → (50.500, 25.000) — axis moved 0.500 mm |
72
+ | `mount.step` | moved | — | moved +5.000 mm X, shape unchanged |
73
+ | `arm-left.step` | **mirrored** | — | mirror image about XY, opposite hand |
74
+ | `plate.step` | micro-change | 1.0 µm | plane x = 200.0000 → 200.0010 — +1.0 µm |
75
+ | `housing.step` | identical | — | identical (re-export) |
76
+
77
+ Each file also gets a sheet of standard views (front, top, right, isometric) and an interactive
78
+ 3D viewer — rotate, switch between before / after / overlay / difference, slice with a section
79
+ plane, measure, and click a finding to fly to it.
80
+
81
+ ## Get started
82
+
83
+ theseus works the way you already work. Install it once, then pick whichever fits:
84
+
85
+ | You have… | Run | You get |
86
+ |---|---|---|
87
+ | two files | `theseus app` (or `theseus compare old.step new.step`) | a report in your browser |
88
+ | a git repo, on any host | `theseus setup git` | `git diff` shows CAD changes as readable text |
89
+ | a GitHub repo | `theseus setup github` | a report comment on every pull request |
90
+
91
+ ### Install (once)
92
+
93
+ theseus runs on Windows, macOS and Linux with Python 3.11 or newer. If you don't have Python,
94
+ get it from [python.org](https://www.python.org/downloads/) (on Windows, tick "Add python.exe
95
+ to PATH"), then (on macOS and Linux, type `python3` instead of `python`):
96
+
97
+ ```bash
98
+ python -m pip install --user pipx
99
+ python -m pipx ensurepath
100
+ ```
101
+
102
+ Open a new terminal (so the PATH change takes effect), then:
103
+
104
+ ```bash
105
+ pipx install theseus-cad
106
+ ```
107
+
108
+ [`pipx`](https://pipx.pypa.io) puts the `theseus` command on your PATH in its own environment, so
109
+ it can't clash with anything else. `uv tool install theseus-cad` does the same, and plain
110
+ `pip install theseus-cad` works too. During the beta, before the first PyPI release, install
111
+ straight from GitHub instead: `pipx install git+https://github.com/arkapravopal04/theseus.git`.
112
+ The download is large (~1.4 GB, mostly the OpenCascade geometry kernel and the VTK renderer).
113
+
114
+ ### Update
115
+
116
+ Run `theseus --version` to see what you have, then the line that matches how you installed it:
117
+
118
+ | You installed with | Update with |
119
+ |---|---|
120
+ | `pipx`, from GitHub | `pipx install --force git+https://github.com/arkapravopal04/theseus.git` |
121
+ | `pip`, from GitHub | `python -m pip install --upgrade git+https://github.com/arkapravopal04/theseus.git` |
122
+ | `pipx` or `pip`, from PyPI | `pipx upgrade theseus-cad` or `python -m pip install --upgrade theseus-cad` |
123
+ | a clone of this repo | `git pull`, then `python -m pip install -e .` |
124
+ | the GitHub Action, `@v1` | nothing: `@v1` follows the latest 1.x release |
125
+
126
+ **If `theseus --version` says 0.1.0** (the package was called `theseus` back then), remove it first
127
+ with `python -m pip uninstall theseus`, then install as above. Otherwise the old package stays
128
+ installed alongside the new one, and its leftover files with it.
129
+
130
+ ### 1. Compare two files (no git needed)
131
+
132
+ ```bash
133
+ theseus app
134
+ ```
135
+
136
+ A page opens in your browser: drop the old and the new version of a part and you get the
137
+ report — summary, every difference with its location and size, before/after/difference
138
+ images, and an interactive 3D view. It all runs on your computer; the files are deleted as soon
139
+ as they've been compared and nothing is uploaded anywhere.
140
+
141
+ ![The drag-and-drop page](docs/example-app.png)
142
+
143
+ From a terminal, `theseus compare old.step new.step` does the same and opens the report
144
+ directly. Add `--out FOLDER` to keep the report (it's a folder with `report.html` and its
145
+ images, so you can zip it and send it to someone who doesn't have theseus).
146
+
147
+ ![The report page](docs/example-report.png)
148
+
149
+ ### 2. Your git repository (GitLab, Bitbucket, your own server, offline)
150
+
151
+ Inside the repository:
152
+
153
+ ```bash
154
+ theseus setup git
155
+ ```
156
+
157
+ From then on, plain `git diff`, `git log -p` and git GUIs show CAD files as text — every face
158
+ with its dimensions — instead of thousands of lines of STEP entity numbers or "binary files
159
+ differ". A 2 µm bigger hole is one changed line:
160
+
161
+ ```diff
162
+ faces:
163
+ - cylinder along Z Ø8.000000 at (50.000000, 25.000000)
164
+ + cylinder along Z Ø8.002000 at (50.000000, 25.000000)
165
+ plane x = 0.000000
166
+ ```
167
+
168
+ Commit the `.gitattributes` file it writes so the rest of the team gets it too (each person runs
169
+ `theseus setup git` once). For the full visual report on everything you've changed:
170
+
171
+ ```bash
172
+ theseus diff
173
+ ```
174
+
175
+ That compares this branch, uncommitted edits and newly exported files that aren't added yet
176
+ against where the branch started, and opens one report. `theseus diff v1.0 v2.0` compares any
177
+ two revisions.
178
+
179
+ ### 3. GitHub pull requests
180
+
181
+ Inside the repository:
182
+
183
+ ```bash
184
+ theseus setup github
185
+ ```
186
+
187
+ That writes `.github/workflows/theseus.yml`; commit and push it. Every pull request that changes
188
+ a CAD file then gets one report comment, updated in place on each push. Without theseus
189
+ installed, you can paste the same file yourself:
190
+
191
+ ```yaml
192
+ # Posts a theseus report on every pull request that changes a CAD file: what changed, where,
193
+ # and by how much, with before/after/difference images. Written by `theseus setup github`.
194
+ name: theseus
195
+ on:
196
+ pull_request:
197
+ # Path filters are case-sensitive; [sS]-style classes match PART.STEP and part.step alike.
198
+ paths:
199
+ - '**.[sS][tT][eE][pP]'
200
+ - '**.[sS][tT][pP]'
201
+ - '**.[pP]21'
202
+ - '**.[iI][gG][eE][sS]'
203
+ - '**.[iI][gG][sS]'
204
+ - '**.[bB][rR][eE][pP]'
205
+ - '**.[bB][rR][pP]'
206
+ - '**.[sS][tT][lL]'
207
+ - '**.3[mM][fF]'
208
+ - '**.[gG][lL][bB]'
209
+ - '**.[pP][lL][yY]'
210
+ - '**.[oO][bB][jJ]'
211
+ - '**.[oO][fF][fF]'
212
+ permissions:
213
+ contents: write # images are stored on a separate `theseus-assets` branch
214
+ pull-requests: write # to post the report comment
215
+ jobs:
216
+ review:
217
+ runs-on: ubuntu-latest
218
+ steps:
219
+ - uses: actions/checkout@v4
220
+ with: { fetch-depth: 0 } # full history: the diff needs the base commit
221
+ - uses: arkapravopal04/theseus@v1
222
+ ```
223
+
224
+ `fetch-depth: 0` is required: without full history the base commit isn't in the checkout and
225
+ the old version of each file can't be read. (`setup github` adds `lfs: true` when the repo keeps
226
+ CAD files in **Git LFS**, so theseus gets the real files.) The full report is also written to
227
+ the workflow run's summary page. The first run installs theseus (a few minutes); later runs
228
+ reuse a cached copy. The action also runs on `push` events (the report then goes to the run
229
+ summary only).
230
+
231
+ `contents: write` lets theseus put the report images on an orphan `theseus-assets` branch (one
232
+ folder per PR, replaced on each push; your branches are never touched) so they show inline in
233
+ the comment. Without it — or on PRs from forks, whose token is read-only — the images, standard
234
+ views and 3D viewer are attached to the workflow run as the `theseus-images` artifact instead,
235
+ and the comment links there. Use `images: artifact` to always do that, or `images: off`.
236
+
237
+ Optional inputs (`with:`):
238
+
239
+ | Input | Default | |
240
+ |---|---|---|
241
+ | `images` | `inline` | `inline`: images in the comment (needs `contents: write`); `artifact`: only in the run's artifact; `off`: text only |
242
+ | `sensitivity` | `engineering` | When a difference counts as *changed* rather than a *micro-change*: `engineering` (10 µm or 0.1%), `fine` (1 µm or 0.01%), `exact` (anything above the detection limit) |
243
+ | `units` | `mm` | Length unit of formats that don't record one (STL, OBJ, PLY, OFF, BREP): `mm`, `cm`, `m`, `in`, `ft`, `um` |
244
+ | `timeout-seconds` | `600` | Time allowed for one file: loading, comparing and drawing. Past it you keep whatever finished: the text report if comparing did, otherwise a "skipped" line |
245
+ | `max-file-mb` | `50` | Skip files larger than this |
246
+ | `python-version` | `3.11` | 3.11 or newer |
247
+
248
+ ## Command reference
249
+
250
+ | Command | |
251
+ |---|---|
252
+ | `theseus app` | drag-and-drop page in your browser (`--port N`, `--no-open`) |
253
+ | `theseus compare OLD NEW` | compare two files, open the report (`--out DIR`, `--no-open`, `--no-images`) |
254
+ | `theseus diff [BASE] [HEAD]` | every CAD file changed in this git repo; defaults: where this branch forked from main/master → the files on disk now |
255
+ | `theseus setup git` | make `git diff` show CAD files as text (re-run safely any time) |
256
+ | `theseus setup github` | write the pull-request workflow (`--force` replaces an existing one) |
257
+ | `theseus textconv FILE` | print a CAD file as text — what `git diff` uses |
258
+ | `theseus [OLD] NEW --out report.md` | the original interface: a markdown report (`--images DIR`, `--png`, `--glb`) |
259
+ | `theseus --version` | |
260
+
261
+ `compare`, `diff`, `app` and the markdown report also take `--units in` (the unit of unitless
262
+ formats like STL) and `--sensitivity fine|exact` (what counts as a change rather than a
263
+ micro-change). The markdown report's `--glb` exports a `.glb` mesh — commit it to GitHub for a
264
+ free rotate/zoom viewer. Commands exit with status 2 if a file can't be read or written.
265
+
266
+ ## Beta
267
+
268
+ theseus 1.2 is a beta. What's solid: reading every listed format, the precise geometric diff
269
+ and its detection limits, the images, moved-part detection, the 3D viewer, and the local
270
+ commands, all covered by an automated test suite. What still needs real-world mileage:
271
+
272
+ - STEP and IGES exports from every CAD system — the test parts are generated, so files from
273
+ SolidWorks, Fusion, Onshape, Creo, NX or Inventor may turn up cases we haven't seen;
274
+ - the GitHub comment on repositories other than this one, especially whether inline images show
275
+ on private repositories (if they don't, use `images: artifact`);
276
+ - Windows and macOS: supported and tested in CI, but most hands-on use so far has been on Linux;
277
+ - very large assemblies (hundreds of MB).
278
+
279
+ If a result is wrong or confusing, or a file won't load, please
280
+ [open an issue](https://github.com/arkapravopal04/theseus/issues/new/choose) with the report text
281
+ and `theseus --version`. **Don't attach confidential CAD files** — issues are public; a simple
282
+ part that shows the same problem is ideal.
283
+
284
+ ## Precision
285
+
286
+ Every comparison states its **detection limit**: the smallest difference the two files can
287
+ actually represent. Above it, every difference is reported, with where it is. Below it,
288
+ differences are numerical noise, and a file reads as *identical (to within …)*. A sensitivity
289
+ threshold (10 µm / 0.1% by default) only decides whether a real difference is headlined as
290
+ *changed* or listed as a *micro-change* — it never hides one.
291
+
292
+ | Comparing | How | Detection limit |
293
+ |---|---|---|
294
+ | STEP/IGES/BREP ↔ STEP/IGES/BREP | every face matched by surface type and exact parameters (plane offset, cylinder axis and diameter, sphere, cone, torus); free-form faces by projection; every vertex by position | 0.1 nm (kernel precision), or coarser if the file declares or was written with less precision — the report says which |
295
+ | STL ↔ STL, same triangulation | per-vertex deltas | float32 storage: ~5 nm at 20 mm |
296
+ | mesh ↔ mesh, different triangulation | distance from each side's vertices to the other's surface, both ways | float precision on flat areas; on curves, each triangle's own chord error |
297
+ | STEP ↔ STL (or any B-rep ↔ mesh) | as above, measured exactly against the B-rep's true surfaces | as above |
298
+
299
+ Measured by the test suite (`tests/test_precision.py`), all detected and located:
300
+
301
+ | Change | Found as |
302
+ |---|---|
303
+ | one face of a 200 mm plate offset by 0.1 µm | `plane x = 200.00000 → 200.00010 — +0.1 µm` |
304
+ | a Ø8 hole enlarged by 2 µm | `through hole along Z Ø8.0000 → 8.0020 … — Ø +2.0 µm` |
305
+ | a hole moved 0.5 mm sideways (volume unchanged) | `… (50.000, 25.000) → (50.500, 25.000) — axis moved 0.500 mm` |
306
+ | the whole part rotated 0.01° | `plane y = 0.000 — tilted 0.01° (far edge moves 35.0 µm)` |
307
+ | one STL vertex moved 1 µm | `surfaces differ by up to 1.0 µm near (…)` |
308
+ | re-exported STEP, same geometry | `identical (to within 0.1 nm, exact B-rep)` |
309
+ | STEP vs its own coarse STL export | identical — the STL's chord error is recognised as tessellation, not a change |
310
+
311
+ ## Formats and units
312
+
313
+ | Format | Extensions | Geometry | Units |
314
+ |---|---|---|---|
315
+ | STEP | `.step` `.stp` `.p21` | exact (B-rep) | from the file, converted to mm |
316
+ | IGES | `.iges` `.igs` | exact (B-rep) | from the file, converted to mm |
317
+ | OpenCascade BREP | `.brep` `.brp` | exact (B-rep) | none recorded — assumed mm, or `--units` |
318
+ | STL | `.stl` (ASCII or binary) | triangle mesh | none recorded — assumed mm, or `--units` |
319
+ | 3MF | `.3mf` | triangle mesh | from the file, converted to mm |
320
+ | glTF binary | `.glb` | triangle mesh | metres (per the glTF spec), converted to mm |
321
+ | OBJ, PLY, OFF | `.obj` `.ply` `.off` | triangle mesh | none recorded — assumed mm, or `--units` |
322
+
323
+ Formats are recognised by content, not just extension: `PART.STEP`, a STEP file saved as
324
+ `part.step.bak`, and binary STLs whose header starts with "solid" all load correctly, and a
325
+ compiled `.obj` object file in the same repo is ignored rather than reported as a broken model.
326
+ Every report says where its units came from ("file units: inch, converted to mm" or "unitless
327
+ format, assumed mm").
328
+
329
+ ## How it works
330
+
331
+ 1. `git diff --name-status -M` finds changed CAD files between the PR's merge base and head,
332
+ following renames (a renamed part is diffed against its own history).
333
+ 2. Each version is read as a raw blob (`git cat-file`), with Git LFS pointers resolved.
334
+ 3. Both versions of a file are loaded and compared in a child process with a timeout — a
335
+ malformed file that crashes or hangs the geometry kernel becomes one "Skipped" line, not a
336
+ failed run. Exact formats are loaded with OpenCascade (`OCP`); meshes with `trimesh`.
337
+ 4. The geometry is compared face by face (or surface to surface for meshes — see
338
+ [Precision](#precision)), alongside volume, area, bounding box and centre of mass. A part
339
+ whose volume, area and moments of inertia are unchanged is tested for a rigid move, then a
340
+ mirror image: the old version, moved or reflected, must match the new one exactly before it's
341
+ reported that way. If neither fits and the part still looks moved as well as edited, the
342
+ versions are lined up first and the report says how. Holes and fillets are then
343
+ recognised, so a resized hole reads as one line rather than several faces.
344
+ 5. Images are rendered headless (VTK, on a private virtual display when there's no screen;
345
+ a matplotlib fallback otherwise): added material in green, removed in red, or — for changes
346
+ too small to see as material — a deviation map with a scale bar and a zoomed detail.
347
+ 6. Everything is formatted as one markdown comment, edited in place on each push.
348
+
349
+ ## Limitations
350
+
351
+ - **No native CAD formats.** No DWG, SLDPRT, IPT, F3D, CATPart or other proprietary format —
352
+ there's no free reader for them. Export STEP alongside your native files.
353
+ - **Meshes are only as precise as their triangles.** A coarse STL cuts corners on curved surfaces;
354
+ changes smaller than that chord error can't be seen in it (the report's detection limit says
355
+ how small that is for each file). Flat areas keep full float precision.
356
+ - **Features are recognised from geometry, and only some of them.** There's no feature tree in an
357
+ exchange file. Holes (through, blind, counterbored, countersunk, stepped) and fillets get named on
358
+ exact B-reps; everything else, slots and pockets included, is reported face by face. Threads
359
+ can't be seen: a tapped hole is a plain bore in a STEP file. Meshes have no features. A feature
360
+ is only reported as changed if it's measurably off the other version.
361
+ - **Annotation geometry isn't compared.** When a file has solids, those are the part: sheets, wires
362
+ and points (often PMI or construction geometry) only show as a count of open bodies. A real
363
+ surface body in a file that also has solids is treated the same way.
364
+ - **Lining up is automatic and can decline.** A part moved or mirrored as well as edited is lined
365
+ up first, and the report says how. It only happens on exact B-reps of up to 3,000 vertices, when
366
+ at least 25% of vertices and 50% of analytic surface area then agree exactly and the part as it
367
+ sits fits clearly worse. A heavily edited or re-modelled part may not qualify, and is then
368
+ compared where it sits.
369
+ - **Open geometry has no volume.** A mesh with holes or a surface-only STEP/IGES has no inside, so
370
+ its volume and centre of mass are reported as n/a (with a warning) rather than a made-up number;
371
+ the bounding box, area and previews still work. Inside-out mesh bodies are flipped and noted.
372
+ - **"Volume", not "mass".** CAD exchange files carry no density, so nothing here is a mass or
373
+ weight calculation.
374
+ - **Fork PRs** get a read-only token, so the comment can't be posted; the report is still in the
375
+ run summary, and the images in the run's artifact.
376
+ - **Inline images on private repositories** are linked from the `theseus-assets` branch; whether
377
+ GitHub displays them in comments for private repos hasn't been verified yet. If they don't
378
+ show, use `images: artifact`.
379
+ - **The 3D viewer loads three.js from jsDelivr**, so opening it needs an internet connection the
380
+ first time.
381
+
382
+ ## License
383
+
384
+ MIT for this project's code. The geometry kernel underneath (OpenCascade Technology, via the
385
+ [OCP](https://github.com/CadQuery/OCP) bindings) is **LGPL-2.1**.