concept-collection / mesh-studio
Remove Sample STEP button; make Random CAD model the primary source button
Jeremy Magland <jmagland@flatironinstitute.org> committed commit 5e048627289d parent bd00eac Browse files
3 changed files+23−39
CLAUDE.mdmodified+7−6View file
@@ -48,9 +48,11 @@ src/abcDataset.ts "Random CAD model" source: fetches index.json from
4848 quality slider is a dimensionless fraction independent of model scale — no
4949 bounding-box computation needed. `retessellate` calls `BRepTools.Clean` first
5050 (in a try/catch) so a finer deflection actually refines.
51-- **The "Sample STEP" button** round-trips a box through `shapeToStep` +
52- `importCadFile` — it exercises the whole STEP export+import pipeline with no
53- bundled asset, and is the quickest end-to-end check of the CAD path.
51+- **The "Random CAD model" button** (primary, top of Sources) downloads a real
52+ ABC-dataset STEP file and runs it through `importCadFile` — the quickest
53+ end-to-end check of the CAD import path (needs network + the abc-step-1000
54+ Pages site). The old "Sample STEP" round-trip button was removed 2026-07-09;
55+ STEP export is still exercised via Export → STEP.
5456
5557 ## Verification
5658
@@ -59,9 +61,8 @@ bundling (including the OCCT wasm asset). Then `npm run dev` and:
5961 - load each primitive; toggle shaded / wireframe / control-net / isocurves;
6062 - drag the resolution slider (faceting should visibly change);
6163 - click a face → the inspector shows degree / poles / knots;
62-- "Sample STEP" and a real uploaded STEP/IGES both render;
63-- "Random CAD model" downloads from abc-step-1000 and renders (needs that
64- Pages site up, and the network);
64+- "Random CAD model" downloads from abc-step-1000 and renders (needs the
65+ network); an uploaded STEP/IGES file renders;
6566 - export OBJ/PLY/STL/NURBS-JSON/STEP.
6667
6768 Not yet deployed to the org Pages site (same procedure as mesh-converter /
README.mdmodified+2−3View file
@@ -27,13 +27,12 @@ extracts those polynomial patches (control points, weights, knots, degree)
2727
2828 - **Built-in primitives** generated in-browser: sphere, torus, cylinder, cone,
2929 box, rounded box (free-form fillet faces), and the classic OCCT "bottle".
30-- **STEP / IGES import**: open a `.step`/`.stp` or `.iges`/`.igs` file — OCCT
31- reads it natively. "Sample STEP" round-trips a box through OCCT's own writer +
32- reader to demonstrate the import path with no bundled file.
3330 - **Random CAD model**: downloads a random real-world model from
3431 [abc-step-1000](https://concept-collection.github.io/abc-step-1000/), a
3532 rehosted slice of the [ABC dataset](https://deep-geometry.github.io/abc-dataset/)
3633 of CAD models (Koch et al., CVPR 2019).
34+- **STEP / IGES import**: open a `.step`/`.stp` or `.iges`/`.igs` file — OCCT
35+ reads it natively.
3736
3837 ## Export
3938
src/App.tsxmodified+14−30View file
@@ -9,7 +9,6 @@ import type { OpenCascade, Shape } from './occ/types'
99 import { buildModel, retessellate } from './occ/extract'
1010 import { importCadFile } from './occ/importCad'
1111 import { shapeToStep } from './occ/exportCad'
12-import { makeBox } from './occ/primitives'
1312 import { primitives } from './sources'
1413 import { ABC_DATASET_URL, fetchRandomAbcStep } from './abcDataset'
1514 import { toOBJ, toPLY, toSTL } from './export/meshWriters'
@@ -102,19 +101,6 @@ function App() {
102101 void load(src.build, { kind: 'primitive', label: src.label }, src.id)
103102 }
104103
105- // Round-trips a box through OCCT's STEP writer + reader to exercise the
106- // import pipeline without shipping a bundled file.
107- const loadSampleStep = () => {
108- void load(
109- (oc) => {
110- const bytes = shapeToStep(oc, makeBox(oc))
111- return importCadFile(oc, 'sample.step', bytes).shape
112- },
113- { kind: 'step', label: 'sample.step (generated)' },
114- 'sample',
115- )
116- }
117-
118104 const loadRandomAbc = async () => {
119105 setError(null)
120106 setBusy('downloading')
@@ -210,6 +196,20 @@ function App() {
210196
211197 <section>
212198 <h2>Sources</h2>
199+ <button
200+ className="primary"
201+ onClick={() => void loadRandomAbc()}
202+ disabled={busy !== null}
203+ title="Download a random CAD model from the first 1000 STEP files of the ABC dataset"
204+ >
205+ 🎲 Random CAD model
206+ </button>
207+ <p className="footnote">
208+ Random models are drawn from{' '}
209+ <a href="https://concept-collection.github.io/abc-step-1000/">abc-step-1000</a>, a
210+ rehosted slice of the <a href={ABC_DATASET_URL}>ABC dataset</a> of CAD models (Koch et
211+ al., CVPR 2019).
212+ </p>
213213 <div className="primitive-grid">
214214 {primitives.map((p) => (
215215 <button
@@ -226,23 +226,7 @@ function App() {
226226 <button onClick={() => fileInputRef.current?.click()} disabled={busy !== null}>
227227 Open STEP/IGES…
228228 </button>
229- <button onClick={loadSampleStep} disabled={busy !== null}>
230- Sample STEP
231- </button>
232- <button
233- onClick={() => void loadRandomAbc()}
234- disabled={busy !== null}
235- title="Download a random CAD model from the first 1000 STEP files of the ABC dataset"
236- >
237- Random CAD model
238- </button>
239229 </div>
240- <p className="footnote">
241- Random models are drawn from{' '}
242- <a href="https://concept-collection.github.io/abc-step-1000/">abc-step-1000</a>, a
243- rehosted slice of the <a href={ABC_DATASET_URL}>ABC dataset</a> of CAD models (Koch et
244- al., CVPR 2019).
245- </p>
246230 <input
247231 ref={fileInputRef}
248232 type="file"