cyclecad 3.2.0 → 3.4.0

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 (65) hide show
  1. package/DOCKER-SETUP-VERIFICATION.md +399 -0
  2. package/DOCKER-TESTING.md +463 -0
  3. package/FUSION360_MODULES.md +478 -0
  4. package/FUSION_MODULES_README.md +352 -0
  5. package/INTEGRATION_SNIPPETS.md +608 -0
  6. package/KILLER-FEATURES-DELIVERY.md +469 -0
  7. package/MODULES_SUMMARY.txt +337 -0
  8. package/QUICK_REFERENCE.txt +298 -0
  9. package/README-DOCKER-TESTING.txt +438 -0
  10. package/app/index.html +23 -10
  11. package/app/js/fusion-help.json +1808 -0
  12. package/app/js/help-module-v3.js +1096 -0
  13. package/app/js/killer-features-help.json +395 -0
  14. package/app/js/killer-features.js +1508 -0
  15. package/app/js/modules/fusion-assembly.js +842 -0
  16. package/app/js/modules/fusion-cam.js +785 -0
  17. package/app/js/modules/fusion-data.js +814 -0
  18. package/app/js/modules/fusion-drawing.js +844 -0
  19. package/app/js/modules/fusion-inspection.js +756 -0
  20. package/app/js/modules/fusion-render.js +774 -0
  21. package/app/js/modules/fusion-simulation.js +986 -0
  22. package/app/js/modules/fusion-sketch.js +1044 -0
  23. package/app/js/modules/fusion-solid.js +1095 -0
  24. package/app/js/modules/fusion-surface.js +949 -0
  25. package/app/tests/FUSION_TEST_SUITE.md +266 -0
  26. package/app/tests/README.md +77 -0
  27. package/app/tests/TESTING-CHECKLIST.md +177 -0
  28. package/app/tests/TEST_SUITE_SUMMARY.txt +236 -0
  29. package/app/tests/brep-live-test.html +848 -0
  30. package/app/tests/docker-integration-test.html +811 -0
  31. package/app/tests/fusion-all-tests.html +670 -0
  32. package/app/tests/fusion-assembly-tests.html +461 -0
  33. package/app/tests/fusion-cam-tests.html +421 -0
  34. package/app/tests/fusion-simulation-tests.html +421 -0
  35. package/app/tests/fusion-sketch-tests.html +613 -0
  36. package/app/tests/fusion-solid-tests.html +529 -0
  37. package/app/tests/index.html +453 -0
  38. package/app/tests/killer-features-test.html +509 -0
  39. package/app/tests/run-tests.html +874 -0
  40. package/app/tests/step-import-live-test.html +1115 -0
  41. package/app/tests/test-agent-v3.html +93 -696
  42. package/architecture-dashboard.html +1970 -0
  43. package/docs/API-REFERENCE.md +1423 -0
  44. package/docs/BREP-LIVE-TEST-GUIDE.md +453 -0
  45. package/docs/DEVELOPER-GUIDE-v3.md +795 -0
  46. package/docs/DOCKER-QUICK-TEST.md +376 -0
  47. package/docs/FUSION-FEATURES-GUIDE.md +2513 -0
  48. package/docs/FUSION-TUTORIAL.md +1203 -0
  49. package/docs/INFRASTRUCTURE-GUIDE-INDEX.md +327 -0
  50. package/docs/KEYBOARD-SHORTCUTS.md +402 -0
  51. package/docs/KILLER-FEATURES-INTEGRATION.md +412 -0
  52. package/docs/KILLER-FEATURES-SUMMARY.md +424 -0
  53. package/docs/KILLER-FEATURES-TUTORIAL.md +784 -0
  54. package/docs/KILLER-FEATURES.md +562 -0
  55. package/docs/QUICK-REFERENCE.md +282 -0
  56. package/docs/README-v3-DOCS.md +274 -0
  57. package/docs/TUTORIAL-v3.md +1190 -0
  58. package/docs/architecture-dashboard.html +1970 -0
  59. package/docs/architecture-v3.html +1038 -0
  60. package/linkedin-post-v3.md +58 -0
  61. package/package.json +1 -1
  62. package/scripts/dev-setup.sh +338 -0
  63. package/scripts/docker-health-check.sh +159 -0
  64. package/scripts/integration-test.sh +311 -0
  65. package/scripts/test-docker.sh +515 -0
@@ -0,0 +1,453 @@
1
+ # B-Rep Live Test Guide — OpenCascade.js WASM + Three.js
2
+
3
+ **File location:** `/app/tests/brep-live-test.html`
4
+
5
+ **Status:** Live testing tool for B-Rep (Boundary Representation) geometry operations using OpenCascade.js WASM binary and Three.js visualization.
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ This test page downloads the full OpenCascade.js WASM library (~50MB) directly in the browser and runs real B-Rep geometry operations (primitives, boolean operations, fillets, tessellation) with live 3D visualization.
12
+
13
+ ### Key Features:
14
+ - **Live WASM Loading** — Downloads OpenCascade.js WASM with progress bar
15
+ - **14 Test Categories** — Primitives (5), Operations (6), Analysis (3)
16
+ - **Real B-Rep Geometry** — Not meshes or approximations — actual topological shapes
17
+ - **Tessellation Pipeline** — `BRepMesh_IncrementalMesh` → triangle extraction → Three.js rendering
18
+ - **Interactive Testing** — Click tests individually or run all
19
+ - **Real-time Stats** — FPS, triangle count, vertex count, operation time
20
+ - **Dark Theme UI** — VS Code-style sidebar, viewport, and log panel
21
+
22
+ ---
23
+
24
+ ## How to Run
25
+
26
+ ### Option 1: Local Browser
27
+ ```bash
28
+ cd ~/cyclecad
29
+ # Open in browser (needs HTTPS for Web APIs):
30
+ python -m http.server 8000
31
+ # Navigate to: https://localhost:8000/app/tests/brep-live-test.html
32
+ # (or http://localhost:8000 for test purposes)
33
+ ```
34
+
35
+ ### Option 2: GitHub Pages
36
+ ```bash
37
+ # After pushing to repo:
38
+ https://vvlars-cmd.github.io/cyclecad/app/tests/brep-live-test.html
39
+ ```
40
+
41
+ ### What to Expect:
42
+ 1. **Page loads** — Header shows "WASM: Loading..." with progress bar
43
+ 2. **WASM downloads** — ~50MB download (1-3 minutes on typical connection)
44
+ 3. **Initialization** — OpenCascade.js factory function instantiated with WASM binary
45
+ 4. **Ready state** — "Run All Tests" button enables, status shows "Ready"
46
+ 5. **Click any test** or **Click "Run All Tests"**
47
+ 6. **3D viewport** shows rendered geometry
48
+ 7. **Log panel** shows timing and geometry stats
49
+
50
+ ---
51
+
52
+ ## Test Categories
53
+
54
+ ### Primitives (5 tests)
55
+ Tests basic shape creation from OpenCascade.js WASM APIs.
56
+
57
+ | Test | API | What It Validates |
58
+ |------|-----|-------------------|
59
+ | **Box** | `BRepPrimAPI_MakeBox_3(100, 50, 30)` | Basic rectangular solid creation |
60
+ | **Cylinder** | `BRepPrimAPI_MakeCylinder_2(25, 60)` | Circular solid with radius and height |
61
+ | **Sphere** | `BRepPrimAPI_MakeSphere_1(30)` | Spherical solid with radius |
62
+ | **Cone** | `BRepPrimAPI_MakeCone_3(20, 5, 50)` | Tapered solid, two radii + height |
63
+ | **Torus** | `BRepPrimAPI_MakeTorus_3(30, 8)` | Doughnut shape, major and minor radius |
64
+
65
+ **Expected results:** All should tessellate into 1,000–5,000 triangles and render in blue.
66
+
67
+ ---
68
+
69
+ ### Operations (6 tests)
70
+ Tests edge and boolean operations on B-Rep shapes.
71
+
72
+ | Test | API | What It Validates |
73
+ |------|-----|-------------------|
74
+ | **Fillet** | `BRepFilletAPI_MakeFillet` + edge iterator | Smooth all edges of a box with 5mm radius |
75
+ | **Chamfer** | `BRepFilletAPI_MakeChamfer` + edge iterator | Beveled edges of a box with 3mm chamfer |
76
+ | **Union** | `BRepAlgoAPI_Fuse(box, cylinder)` | Boolean sum — combines two solids |
77
+ | **Cut** | `BRepAlgoAPI_Cut(box, cylinder)` | Boolean subtraction — removes cylinder from box |
78
+ | **Intersect** | `BRepAlgoAPI_Common(box, sphere)` | Boolean intersection — overlapping region only |
79
+ | **Extrude** | `BRepPrimAPI_MakePrism(face, direction)` | Extrude a 2D face into 3D solid |
80
+
81
+ **Expected results:**
82
+ - **Fillet/Chamfer:** Edges round/bevel smoothly
83
+ - **Union:** Two shapes merge into one
84
+ - **Cut:** Cylindrical hole through box
85
+ - **Intersect:** Partial overlap of box and sphere
86
+ - **Extrude:** Face extruded 50mm in Z direction
87
+
88
+ ---
89
+
90
+ ### Analysis (3 tests)
91
+ Tests topological analysis and mass properties.
92
+
93
+ | Test | API | What It Validates |
94
+ |------|-----|-------------------|
95
+ | **Mass Properties** | `BRepGProp_GProps` (volume + area) | Volume and surface area calculation |
96
+ | **Edge Count** | `TopExp_Explorer(shape, TopAbs_EDGE)` | Topological iterator counts edges |
97
+ | **Face Count** | `TopExp_Explorer(shape, TopAbs_FACE)` | Topological iterator counts faces |
98
+
99
+ **Expected results:**
100
+ - **Mass:** Box (100×50×30) = 150,000 mm³, area = 22,000 mm²
101
+ - **Edges:** Box = 12 edges (rectangular solid)
102
+ - **Faces:** Box = 6 faces (rectangular solid)
103
+
104
+ ---
105
+
106
+ ## UI Layout
107
+
108
+ ```
109
+ ┌────────────────────────────────────────────────────────────────┐
110
+ │ B-Rep Live Test — OpenCascade.js WASM + Three.js │
111
+ │ [WASM: 100%] [Run All Tests] │
112
+ ├──────────────┬──────────────────────────────────────────────────┤
113
+ │ Tests (14) │ 3D Viewport │
114
+ │ [Run All] │ ┌────────────────────────────────────────────┐ │
115
+ │ │ │ │ │
116
+ │ ✓ Box │ │ [Blue Box — tessellated] │ │
117
+ │ ✓ Cylinder │ │ │ │
118
+ │ ✓ Fillet │ │ FPS: 60 │ │
119
+ │ ✕ Union │ │ Triangles: 8,423 │ │
120
+ │ ⏳ Cut │ │ Vertices: 4,521 │ │
121
+ │ │ │ Operation: Fillet (box + 5mm edges) │ │
122
+ │ │ └────────────────────────────────────────────┘ │
123
+ ├──────────────┴──────────────────────────────────────────────────┤
124
+ │ [14:32:15] Box: 45.3ms, 2834 triangles │
125
+ │ [14:32:16] Cylinder: 28.1ms, 1204 triangles │
126
+ │ [14:32:17] Fillet: 89.2ms, 4521 triangles │
127
+ │ [14:32:18] Union: FAILED — BRepAlgoAPI_Fuse not found │
128
+ └────────────────────────────────────────────────────────────────┘
129
+ ```
130
+
131
+ ### Sidebar (Left)
132
+ - **Test List** — All 14 tests grouped by category
133
+ - **Status Indicators:**
134
+ - `—` = Pending (not yet run)
135
+ - `⟳` = Running (in progress)
136
+ - `✓` = Passed (green border, time shown)
137
+ - `✕` = Failed (red border, time shown)
138
+ - **Click to run individual test**
139
+
140
+ ### Viewport (Center/Right)
141
+ - **3D view** of current geometry
142
+ - **OrbitControls** — left-click drag to rotate, right-click drag to pan, scroll to zoom
143
+ - **Grid floor** for reference
144
+ - **Stats overlay** (top-right):
145
+ - FPS (frames per second)
146
+ - Triangle count
147
+ - Vertex count
148
+ - Current operation name
149
+
150
+ ### Footer (Bottom)
151
+ - **Log panel** with timestamps
152
+ - Shows operation names, timings, and results
153
+ - Color-coded: green = success, red = error, yellow = warning
154
+ - Auto-scrolls to latest entry
155
+
156
+ ---
157
+
158
+ ## Understanding the Tests
159
+
160
+ ### Tessellation Pipeline
161
+
162
+ Each geometry operation follows this pipeline:
163
+
164
+ ```
165
+ 1. Create B-Rep Shape (OCP API)
166
+ └─ BRepPrimAPI_MakeBox, BRepAlgoAPI_Fuse, etc.
167
+
168
+ 2. Mesh the Shape
169
+ └─ BRepMesh_IncrementalMesh(shape, linearDeflection=0.1)
170
+
171
+ 3. Extract Triangles
172
+ └─ TopExp_Explorer → iterate faces → BRep_Tool.Triangulation
173
+ └─ Each face yields nodes[] and triangles[]
174
+
175
+ 4. Build Three.js Geometry
176
+ └─ BufferGeometry with vertices, indices, normals
177
+
178
+ 5. Render
179
+ └─ MeshStandardMaterial (blue, metallic)
180
+ └─ Fit camera to bounding box
181
+ ```
182
+
183
+ ### Deflection Parameter
184
+ - **`linearDeflection = 0.1`** — Controls mesh coarseness
185
+ - Smaller = finer mesh (more triangles, slower)
186
+ - Larger = coarser mesh (fewer triangles, faster)
187
+ - **0.1** is good balance for visualization
188
+
189
+ ---
190
+
191
+ ## Adding New Tests
192
+
193
+ ### Step 1: Add Test Definition
194
+ In the `tests` array at the top of the script:
195
+
196
+ ```javascript
197
+ const tests = [
198
+ // ... existing tests ...
199
+ { id: 'mytest', name: 'My Test (description)', category: 'NewCategory' },
200
+ ];
201
+ ```
202
+
203
+ ### Step 2: Add Test Implementation
204
+ In the `runTest()` function, add an `else if` block:
205
+
206
+ ```javascript
207
+ else if (testId === 'mytest') {
208
+ // Create B-Rep shape using OCP API
209
+ const shape = new oc.BRepPrimAPI_MakeSomething(...).Shape();
210
+
211
+ // Tessellate
212
+ const tessData = tessellateShape(shape);
213
+ if (!tessData) throw new Error('Tessellation failed');
214
+
215
+ // Render
216
+ const { triangleCount, vertexCount } = renderGeometry(tessData.vertices, tessData.indices);
217
+
218
+ // Log result
219
+ const elapsed = performance.now() - startTime;
220
+ log(`${test.name}: ${elapsed.toFixed(1)}ms, ${triangleCount} triangles`, 'success');
221
+ updateTestStatus(testId, 'passed', elapsed);
222
+ }
223
+ ```
224
+
225
+ ### Step 3: Find the Right OCP API
226
+ Consult OpenCascade.js documentation or OCCT source:
227
+
228
+ **Common patterns:**
229
+ - `new oc.BRepPrimAPI_MakeSomething(params).Shape()`
230
+ - `new oc.BRepAlgoAPI_Operation(shape1, shape2).Shape()`
231
+ - `new oc.BRepFilletAPI_Make*(shape).Add(...).Shape()`
232
+
233
+ **Overload naming:**
234
+ - `_1`, `_2`, `_3` suffixes = different parameter combinations
235
+ - Try variants if one doesn't work
236
+
237
+ **Example — Finding overloads for Box:**
238
+ ```javascript
239
+ // Try these in order:
240
+ new oc.BRepPrimAPI_MakeBox_1(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax)
241
+ new oc.BRepPrimAPI_MakeBox_2(aCorner, aX, aY, aZ) // position + dimensions
242
+ new oc.BRepPrimAPI_MakeBox_3(aX, aY, aZ) // origin (0,0,0) + dimensions
243
+ ```
244
+
245
+ ---
246
+
247
+ ## Troubleshooting
248
+
249
+ ### WASM Download Fails
250
+ **Error:** `Failed to fetch WASM: 404`
251
+
252
+ **Cause:** CDN URL changed or WASM file moved
253
+
254
+ **Fix:** Update `CDN_BASE` in the script:
255
+ ```javascript
256
+ const CDN_BASE = 'https://cdn.jsdelivr.net/npm/opencascade.js@2.0.0-beta.b5ff984/dist/';
257
+ ```
258
+
259
+ Verify latest beta version:
260
+ ```bash
261
+ npm view opencascade.js dist-tags
262
+ ```
263
+
264
+ ---
265
+
266
+ ### WASM Hangs During Load
267
+ **Error:** Page freezes, no progress update
268
+
269
+ **Cause:** WASM is very large (~50MB) and browser tab may become unresponsive
270
+
271
+ **Fix:** Wait 1-3 minutes. Check network tab in DevTools (F12 → Network). If nothing is downloading, refresh and try again.
272
+
273
+ ---
274
+
275
+ ### Test Shows "Tessellation Failed"
276
+ **Error:** Operation creates shape but tessellation returns null
277
+
278
+ **Cause:** Shape has no faces or bad topology
279
+
280
+ **Fix:**
281
+ 1. Check operation result with `TopExp_Explorer` to count faces
282
+ 2. Verify linear deflection is reasonable (0.05–1.0)
283
+ 3. Some operations may require `ShapeUpgrade_ShapeFix`
284
+
285
+ **Code to debug:**
286
+ ```javascript
287
+ const faceExplorer = new oc.TopExp_Explorer(shape, oc.TopAbs_ShapeEnum.TopAbs_FACE);
288
+ let faceCount = 0;
289
+ while (faceExplorer.More()) {
290
+ faceCount++;
291
+ faceExplorer.Next();
292
+ }
293
+ console.log('Face count:', faceCount);
294
+ ```
295
+
296
+ ---
297
+
298
+ ### Test Fails: "BRepSomethingAPI Not Found"
299
+ **Error:** `new oc.BRepSomethingAPI_MakeThing is not a function`
300
+
301
+ **Cause:** API doesn't exist in this version of OpenCascade.js or wrong overload
302
+
303
+ **Fix:**
304
+ 1. Check spelling (case-sensitive)
305
+ 2. Try `_1`, `_2`, `_3` overloads
306
+ 3. Some APIs may not be bound in WASM yet
307
+
308
+ **Workaround:** Simplify the test or use alternative API:
309
+ ```javascript
310
+ // Instead of complex operation, use primitive
311
+ const shape = new oc.BRepPrimAPI_MakeSphere_1(30).Shape();
312
+ ```
313
+
314
+ ---
315
+
316
+ ### Viewport Shows Black Screen
317
+ **Error:** Nothing renders, no error in log
318
+
319
+ **Cause:** Camera positioned inside mesh
320
+
321
+ **Fix:** Already handled by auto-fit logic:
322
+ ```javascript
323
+ const bbox = new THREE.Box3().setFromObject(currentMesh);
324
+ const size = bbox.getSize(new THREE.Vector3());
325
+ const maxDim = Math.max(size.x, size.y, size.z);
326
+ let cameraZ = Math.abs(maxDim / 2 / Math.tan(fov / 2)) * 1.5;
327
+ camera.position.z = cameraZ;
328
+ ```
329
+
330
+ If still black, check console (F12 → Console) for errors.
331
+
332
+ ---
333
+
334
+ ## Performance Notes
335
+
336
+ ### Expected Timings (on modern machine)
337
+ - **Primitives:** 10–50ms per shape
338
+ - **Fillet/Chamfer:** 50–150ms (depends on edge count)
339
+ - **Boolean ops:** 20–100ms (depends on complexity)
340
+ - **Tessellation:** 5–30ms (included in total)
341
+ - **Rendering:** 1–5ms per frame (60 FPS target)
342
+
343
+ ### Memory Usage
344
+ - **WASM binary:** ~50MB (loaded once)
345
+ - **Per shape:** 1–10MB depending on tessellation detail
346
+
347
+ ---
348
+
349
+ ## API Reference — Common OCP Methods
350
+
351
+ ### Primitive Creation
352
+ ```javascript
353
+ new oc.BRepPrimAPI_MakeBox_3(sizeX, sizeY, sizeZ)
354
+ new oc.BRepPrimAPI_MakeCylinder_2(radius, height)
355
+ new oc.BRepPrimAPI_MakeSphere_1(radius)
356
+ new oc.BRepPrimAPI_MakeCone_3(radius1, radius2, height)
357
+ new oc.BRepPrimAPI_MakeTorus_3(majorRadius, minorRadius)
358
+ ```
359
+
360
+ ### Boolean Operations
361
+ ```javascript
362
+ new oc.BRepAlgoAPI_Fuse(shape1, shape2) // Union
363
+ new oc.BRepAlgoAPI_Cut(shape1, shape2) // Subtraction
364
+ new oc.BRepAlgoAPI_Common(shape1, shape2) // Intersection
365
+ ```
366
+
367
+ ### Edge/Face Operations
368
+ ```javascript
369
+ new oc.BRepFilletAPI_MakeFillet(shape) // Fillet edges
370
+ new oc.BRepFilletAPI_MakeChamfer(shape) // Chamfer edges
371
+ makeFillet.Add(radius, edge) // Add edge to fillet
372
+ ```
373
+
374
+ ### Tessellation
375
+ ```javascript
376
+ new oc.BRepMesh_IncrementalMesh(shape, deflection)
377
+ oc.BRep_Tool.Triangulation(face) // Get mesh data from face
378
+ ```
379
+
380
+ ### Topology Iteration
381
+ ```javascript
382
+ new oc.TopExp_Explorer(shape, shapeType) // shapeType: TopAbs_EDGE, TopAbs_FACE, etc.
383
+ explorer.More() // Check if more elements
384
+ explorer.Current() // Get current element
385
+ explorer.Next() // Move to next
386
+ ```
387
+
388
+ ### Properties
389
+ ```javascript
390
+ new oc.GProp_GProps()
391
+ oc.BRepGProp.VolumeProperties(shape, props)
392
+ oc.BRepGProp.SurfaceProperties(shape, props)
393
+ props.Mass() // Get mass (volume or area)
394
+ ```
395
+
396
+ ---
397
+
398
+ ## Debugging Tips
399
+
400
+ ### Enable Console Logging
401
+ Open browser DevTools (F12) and check the **Console** tab for:
402
+ - WASM download progress
403
+ - Initialization messages
404
+ - Operation timings
405
+ - Error messages from OCP API
406
+
407
+ ### Check Network Tab
408
+ **F12 → Network** to see:
409
+ - `opencascade.full.js` (404KB, should complete in <1s)
410
+ - `opencascade.full.wasm` (50MB, should complete in 1–3 minutes depending on connection)
411
+
412
+ ### Inspect 3D Geometry
413
+ In browser console, access globals:
414
+ ```javascript
415
+ // Inspect scene
416
+ console.log(window.scene);
417
+ console.log(window.currentMesh);
418
+
419
+ // Check geometry stats
420
+ console.log(window.currentMesh.geometry);
421
+ console.log(window.currentMesh.geometry.attributes.position.count);
422
+ ```
423
+
424
+ ---
425
+
426
+ ## Next Steps
427
+
428
+ ### Integration with cycleCAD
429
+ This test page validates that OpenCascade.js WASM works in the browser. Next:
430
+
431
+ 1. **Integrate into cycleCAD app** — Add real B-Rep operations to `operations.js`
432
+ 2. **STEP import** — Use `occt-import-js` or OpenCascade.js to read STEP files
433
+ 3. **Export** — Implement STEP/IGES/BREP export via OCP API
434
+
435
+ ### Known Limitations
436
+ - Some advanced OCP APIs may not be bound in WASM
437
+ - Very large shapes (100k+ faces) may be slow
438
+ - Linear deflection can be adjusted per operation
439
+ - No constraint solving (2D sketch → 3D part)
440
+
441
+ ---
442
+
443
+ ## References
444
+
445
+ - **OpenCascade.js**: https://github.com/donalffons/opencascade.js
446
+ - **OCCT API Docs**: https://dev.opencascade.org/doc/refman/latest/html/
447
+ - **Three.js r170**: https://threejs.org/docs/
448
+ - **BRepMesh Guide**: https://dev.opencascade.org/doc/refman/latest/html/class_b_rep_mesh___incremental_mesh.html
449
+
450
+ ---
451
+
452
+ **Last updated:** 2026-03-31
453
+ **Status:** Ready for testing and extension