cyclecad 2.0.1 → 3.0.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.
- package/DELIVERABLES.txt +296 -445
- package/ENHANCEMENT_COMPLETION_REPORT.md +383 -0
- package/ENHANCEMENT_SUMMARY.txt +308 -0
- package/FEATURE_INVENTORY.md +235 -0
- package/FUSION360_FEATURES_SUMMARY.md +452 -0
- package/FUSION360_PARITY_ENHANCEMENTS.md +461 -0
- package/FUSION360_PARITY_SUMMARY.md +520 -0
- package/FUSION360_QUICK_REFERENCE.md +351 -0
- package/IMPLEMENTATION_GUIDE.md +502 -0
- package/INTEGRATION-GUIDE.md +377 -0
- package/MODULES_PHASES_6_7.md +780 -0
- package/MODULE_API_REFERENCE.md +712 -0
- package/MODULE_INVENTORY.txt +264 -0
- package/app/index.html +1345 -4930
- package/app/js/app.js +1312 -514
- package/app/js/brep-kernel.js +1353 -455
- package/app/js/help-module.js +1437 -0
- package/app/js/kernel.js +364 -40
- package/app/js/modules/animation-module.js +1461 -0
- package/app/js/modules/assembly-module.js +47 -3
- package/app/js/modules/cam-module.js +1572 -0
- package/app/js/modules/collaboration-module.js +1615 -0
- package/app/js/modules/constraint-module.js +1266 -0
- package/app/js/modules/data-module.js +1054 -0
- package/app/js/modules/drawing-module.js +54 -8
- package/app/js/modules/formats-module.js +873 -0
- package/app/js/modules/inspection-module.js +1330 -0
- package/app/js/modules/mesh-module-enhanced.js +880 -0
- package/app/js/modules/mesh-module.js +968 -0
- package/app/js/modules/operations-module.js +40 -7
- package/app/js/modules/plugin-module.js +1554 -0
- package/app/js/modules/rendering-module.js +1766 -0
- package/app/js/modules/scripting-module.js +1073 -0
- package/app/js/modules/simulation-module.js +60 -3
- package/app/js/modules/sketch-module.js +2029 -91
- package/app/js/modules/step-module.js +47 -6
- package/app/js/modules/surface-module.js +1040 -0
- package/app/js/modules/version-module.js +1830 -0
- package/app/js/modules/viewport-module.js +95 -8
- package/app/test-agent-v2.html +881 -1316
- package/cycleCAD-Architecture-v2.pptx +0 -0
- package/docs/ARCHITECTURE.html +838 -1408
- package/docs/DEVELOPER-GUIDE.md +1504 -0
- package/docs/TUTORIAL.md +740 -0
- package/package.json +1 -1
- package/~$cycleCAD-Architecture-v2.pptx +0 -0
- package/.github/scripts/cad-diff.js +0 -590
- package/.github/workflows/cad-diff.yml +0 -117
|
@@ -1,17 +1,104 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* @file viewport-module.js
|
|
3
|
+
* @description ViewportModule — Core 3D Rendering Engine for cycleCAD
|
|
4
|
+
* Foundational LEGO block providing Three.js scene, camera, renderer, and 3D interaction.
|
|
5
|
+
* Zero dependencies — this is the bedrock layer that all other modules depend on.
|
|
6
|
+
*
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
* @author cycleCAD Team
|
|
9
|
+
* @license MIT
|
|
10
|
+
* @see {@link https://github.com/vvlars-cmd/cyclecad}
|
|
11
|
+
*
|
|
12
|
+
* @module viewport-module
|
|
13
|
+
* @requires Three.js r170 (loaded globally)
|
|
14
|
+
* @requires OrbitControls from Three.js examples
|
|
4
15
|
*
|
|
5
16
|
* Provides:
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
17
|
+
* - Three.js WebGL renderer (antialias, shadows, high-DPI support)
|
|
18
|
+
* - Perspective camera with preset views (front, back, left, right, top, bottom, isometric)
|
|
19
|
+
* - Lighting setup (3x directional lights + ambient for realistic shadows)
|
|
20
|
+
* - Grid floor with shadow plane
|
|
21
|
+
* - OrbitControls for rotation (left), pan (right), zoom (scroll)
|
|
22
|
+
* - Selection via raycaster + click detection
|
|
23
|
+
* - Fit-to-object camera animation
|
|
24
|
+
* - View management (preset views, custom scale)
|
|
25
|
+
* - Display modes (wireframe, grid toggle, shadow toggle)
|
|
26
|
+
* - High-res screenshot capture
|
|
27
|
+
* - Background color management
|
|
28
|
+
* - Event emissions for part selection/deselection
|
|
29
|
+
*
|
|
30
|
+
* Architecture (Three.js Scene Structure):
|
|
31
|
+
* Scene
|
|
32
|
+
* ├── Lights
|
|
33
|
+
* │ ├── AmbientLight (0.5 intensity)
|
|
34
|
+
* │ ├── DirectionalLight 1 (main, casts shadow)
|
|
35
|
+
* │ ├── DirectionalLight 2 (fill)
|
|
36
|
+
* │ └── DirectionalLight 3 (back)
|
|
37
|
+
* ├── Grid floor (2000x2000 units, 20 divisions)
|
|
38
|
+
* └── User meshes
|
|
39
|
+
* ├── mesh_0 (with shadow, selection tracking)
|
|
40
|
+
* ├── mesh_1
|
|
41
|
+
* └── ...
|
|
42
|
+
*
|
|
43
|
+
* Commands Registered:
|
|
44
|
+
* - viewport.fitAll() - Fit camera to all objects
|
|
45
|
+
* - viewport.fitTo(meshId) - Fit to specific mesh
|
|
46
|
+
* - viewport.setView(name) - Set preset view (front/back/left/right/top/bottom/iso)
|
|
47
|
+
* - viewport.toggleGrid() - Show/hide grid
|
|
48
|
+
* - viewport.toggleWireframe() - Toggle wireframe mode on all meshes
|
|
49
|
+
* - viewport.toggleShadows() - Enable/disable shadow rendering
|
|
50
|
+
* - viewport.addMesh(geometry, material, name) - Add mesh to scene
|
|
51
|
+
* - viewport.removeMesh(meshId) - Remove mesh from scene
|
|
52
|
+
* - viewport.setBackground(color) - Change background color
|
|
53
|
+
* - viewport.screenshot(w, h) - Capture high-res screenshot
|
|
54
|
+
*
|
|
55
|
+
* Events Emitted:
|
|
56
|
+
* - viewport:ready - Viewport fully loaded and ready to use
|
|
57
|
+
* - viewport:resize - Window resized, new dimensions in data
|
|
58
|
+
* - part:selected - Mesh clicked, data includes {meshId, point, face, object}
|
|
59
|
+
* - part:deselected - Clicked on empty area, no geometry at cursor
|
|
60
|
+
*
|
|
61
|
+
* Usage Example:
|
|
62
|
+
* ```javascript
|
|
63
|
+
* import kernel from './kernel.js';
|
|
64
|
+
* import ViewportModule from './modules/viewport-module.js';
|
|
65
|
+
*
|
|
66
|
+
* // Register viewport module
|
|
67
|
+
* kernel.register(ViewportModule);
|
|
11
68
|
*
|
|
12
|
-
*
|
|
69
|
+
* // Activate it (loads Three.js, creates scene, attaches to DOM)
|
|
70
|
+
* await kernel.activate('viewport');
|
|
71
|
+
*
|
|
72
|
+
* // Now viewport is ready
|
|
73
|
+
* await kernel.exec('viewport.setView', {viewName: 'front'});
|
|
74
|
+
*
|
|
75
|
+
* // Listen for selections
|
|
76
|
+
* kernel.on('part:selected', (data) => {
|
|
77
|
+
* console.log('Selected:', data.meshId);
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* // Fit camera to all objects
|
|
81
|
+
* await kernel.exec('viewport.fitAll');
|
|
82
|
+
* ```
|
|
13
83
|
*/
|
|
14
84
|
|
|
85
|
+
/**
|
|
86
|
+
* ViewportModule definition for kernel registration
|
|
87
|
+
*
|
|
88
|
+
* @type {Object}
|
|
89
|
+
* @property {string} id - Module ID ('viewport')
|
|
90
|
+
* @property {string} name - Human-readable name ('3D Viewport')
|
|
91
|
+
* @property {string} version - Semantic version ('1.0.0')
|
|
92
|
+
* @property {string} category - Module category ('engine' — foundational)
|
|
93
|
+
* @property {Array} dependencies - Required modules (empty — no deps)
|
|
94
|
+
* @property {number} memoryEstimate - Estimated memory (30 MB for Three.js + textures)
|
|
95
|
+
* @property {Array} replaces - Modules this replaces (none)
|
|
96
|
+
* @property {Function} load - Async lifecycle: load hook
|
|
97
|
+
* @property {Function} activate - Async lifecycle: activate hook
|
|
98
|
+
* @property {Function} deactivate - Async lifecycle: deactivate hook
|
|
99
|
+
* @property {Function} unload - Async lifecycle: unload hook
|
|
100
|
+
* @property {Object} provides - Exported API (commands and events)
|
|
101
|
+
*/
|
|
15
102
|
const ViewportModule = {
|
|
16
103
|
id: 'viewport',
|
|
17
104
|
name: '3D Viewport',
|