sanchousf-ai-toolkit 0.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.
- sanchousf_ai_toolkit-0.2.1/LICENSE +21 -0
- sanchousf_ai_toolkit-0.2.1/PKG-INFO +133 -0
- sanchousf_ai_toolkit-0.2.1/README.md +64 -0
- sanchousf_ai_toolkit-0.2.1/cad/README.md +249 -0
- sanchousf_ai_toolkit-0.2.1/cad/__init__.py +136 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/__init__.py +217 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/analysis/__init__.py +22 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/analysis/printability.py +454 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/bridge/__init__.py +23 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/bridge/bridge.py +1291 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/common/__init__.py +26 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/common/constants.py +30 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/common/progress.py +334 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/geometry/__init__.py +52 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/geometry/enums.py +188 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/geometry/object.py +1294 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/geometry/stl_helper.py +212 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/geometry/transform.py +314 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/io/__init__.py +11 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/io/exporter.py +195 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/modeling/__init__.py +115 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/modeling/assembly.py +491 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/modeling/engineering.py +592 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/modeling/features.py +444 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/modeling/modifiers.py +261 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/modeling/operations.py +510 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/modeling/remesh.py +535 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/modeling/remesh_custom.py +1776 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/modeling/sketch.py +470 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/primitives/__init__.py +44 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/primitives/polyline.py +675 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/primitives/primitives.py +1419 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/primitives/text.py +565 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/rendering/__init__.py +38 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/rendering/camera.py +266 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/rendering/gizmo.py +573 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/rendering/gl_preview.py +650 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/rendering/grid.py +245 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/rendering/image_renderer.py +612 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/rendering/measure.py +325 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/rendering/preview.py +1340 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/scratchpad/__init__.py +12 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/scratchpad/scratchpad.py +568 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/sdf/__init__.py +55 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/sdf/sdf.py +1086 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/sdf/sdf_mesher.py +499 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/spatial/__init__.py +21 -0
- sanchousf_ai_toolkit-0.2.1/cad/core/spatial/raycast.py +275 -0
- sanchousf_ai_toolkit-0.2.1/cad/remesh.py +37 -0
- sanchousf_ai_toolkit-0.2.1/cad/requirements-dev.txt +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/requirements.txt +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/sanchousf_ai_toolkit_cad.egg-info/SOURCES.txt +108 -0
- sanchousf_ai_toolkit-0.2.1/cad/sanchousf_ai_toolkit_cad.egg-info/dependency_links.txt +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/sanchousf_ai_toolkit_cad.egg-info/entry_points.txt +5 -0
- sanchousf_ai_toolkit-0.2.1/cad/sanchousf_ai_toolkit_cad.egg-info/requires.txt +22 -0
- sanchousf_ai_toolkit-0.2.1/cad/sanchousf_ai_toolkit_cad.egg-info/top_level.txt +6 -0
- sanchousf_ai_toolkit-0.2.1/cad/save.py +737 -0
- sanchousf_ai_toolkit-0.2.1/cad/scene/__init__.py +148 -0
- sanchousf_ai_toolkit-0.2.1/cad/scene/base.py +151 -0
- sanchousf_ai_toolkit-0.2.1/cad/scene/loader.py +413 -0
- sanchousf_ai_toolkit-0.2.1/cad/scenes/__init__.py +12 -0
- sanchousf_ai_toolkit-0.2.1/cad/scenes/assembly_demo.py +318 -0
- sanchousf_ai_toolkit-0.2.1/cad/scenes/parametric_demo.py +465 -0
- sanchousf_ai_toolkit-0.2.1/cad/scenes/polyline.py +376 -0
- sanchousf_ai_toolkit-0.2.1/cad/scenes/test.py +784 -0
- sanchousf_ai_toolkit-0.2.1/cad/skills/__init__.py +12 -0
- sanchousf_ai_toolkit-0.2.1/cad/skills/__main__.py +5 -0
- sanchousf_ai_toolkit-0.2.1/cad/skills/cad-tool/SKILL.md +178 -0
- sanchousf_ai_toolkit-0.2.1/cad/skills/cad-tool/references/api_reference.md +251 -0
- sanchousf_ai_toolkit-0.2.1/cad/skills/cad-tool/references/cli_reference.md +133 -0
- sanchousf_ai_toolkit-0.2.1/cad/skills/cad-tool/references/scene_authoring_guide.md +148 -0
- sanchousf_ai_toolkit-0.2.1/cad/skills/install.py +85 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/__init__.py +27 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/bridge.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/camera.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/enums.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/gl_preview.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/image_renderer.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/object.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/polyline.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/preview.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/primitives.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/progress.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/raycast.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/remesh.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/remesh_custom.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/scene.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/scratchpad.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/sdf.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/sdf_mesher.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/stl_helper.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/text.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/utils/transform.py +1 -0
- sanchousf_ai_toolkit-0.2.1/cad/view.py +2155 -0
- sanchousf_ai_toolkit-0.2.1/pyproject.toml +3 -0
- sanchousf_ai_toolkit-0.2.1/sanchousf_ai_toolkit.egg-info/PKG-INFO +133 -0
- sanchousf_ai_toolkit-0.2.1/sanchousf_ai_toolkit.egg-info/SOURCES.txt +101 -0
- sanchousf_ai_toolkit-0.2.1/sanchousf_ai_toolkit.egg-info/dependency_links.txt +1 -0
- sanchousf_ai_toolkit-0.2.1/sanchousf_ai_toolkit.egg-info/entry_points.txt +5 -0
- sanchousf_ai_toolkit-0.2.1/sanchousf_ai_toolkit.egg-info/requires.txt +36 -0
- sanchousf_ai_toolkit-0.2.1/sanchousf_ai_toolkit.egg-info/top_level.txt +1 -0
- sanchousf_ai_toolkit-0.2.1/setup.cfg +4 -0
- sanchousf_ai_toolkit-0.2.1/setup.py +75 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sanchousf
|
|
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,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sanchousf-ai-toolkit
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: AI-Toolkit: Modular CAD, AI, and Engineering Tools
|
|
5
|
+
Author: AI-Toolkit Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Manufacturing
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
19
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
20
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
|
|
21
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
|
|
22
|
+
Classifier: Topic :: Multimedia :: Graphics :: Viewers
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: dearpygui>=1.10.0
|
|
27
|
+
Requires-Dist: numpy>=1.22.0
|
|
28
|
+
Requires-Dist: scipy>=1.9.0
|
|
29
|
+
Requires-Dist: scikit-image>=0.19.0
|
|
30
|
+
Requires-Dist: trimesh>=3.15.0
|
|
31
|
+
Requires-Dist: PyOpenGL>=3.1.5
|
|
32
|
+
Requires-Dist: pillow>=9.0.0
|
|
33
|
+
Requires-Dist: shapely>=2.0.0
|
|
34
|
+
Requires-Dist: manifold3d>=3.0.0
|
|
35
|
+
Requires-Dist: glfw>=2.5.0
|
|
36
|
+
Requires-Dist: matplotlib>=3.5.0
|
|
37
|
+
Requires-Dist: rich>=12.0.0
|
|
38
|
+
Provides-Extra: cad
|
|
39
|
+
Requires-Dist: dearpygui>=1.10.0; extra == "cad"
|
|
40
|
+
Requires-Dist: numpy>=1.22.0; extra == "cad"
|
|
41
|
+
Requires-Dist: scipy>=1.9.0; extra == "cad"
|
|
42
|
+
Requires-Dist: scikit-image>=0.19.0; extra == "cad"
|
|
43
|
+
Requires-Dist: trimesh>=3.15.0; extra == "cad"
|
|
44
|
+
Requires-Dist: PyOpenGL>=3.1.5; extra == "cad"
|
|
45
|
+
Requires-Dist: pillow>=9.0.0; extra == "cad"
|
|
46
|
+
Requires-Dist: shapely>=2.0.0; extra == "cad"
|
|
47
|
+
Requires-Dist: manifold3d>=3.0.0; extra == "cad"
|
|
48
|
+
Requires-Dist: glfw>=2.5.0; extra == "cad"
|
|
49
|
+
Requires-Dist: matplotlib>=3.5.0; extra == "cad"
|
|
50
|
+
Requires-Dist: rich>=12.0.0; extra == "cad"
|
|
51
|
+
Provides-Extra: remesh
|
|
52
|
+
Requires-Dist: pyvista>=0.40.0; extra == "remesh"
|
|
53
|
+
Provides-Extra: dev
|
|
54
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
55
|
+
Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
|
|
56
|
+
Requires-Dist: pyvista>=0.40.0; extra == "dev"
|
|
57
|
+
Requires-Dist: setuptools>=61.0; extra == "dev"
|
|
58
|
+
Requires-Dist: wheel; extra == "dev"
|
|
59
|
+
Dynamic: author
|
|
60
|
+
Dynamic: classifier
|
|
61
|
+
Dynamic: description
|
|
62
|
+
Dynamic: description-content-type
|
|
63
|
+
Dynamic: license
|
|
64
|
+
Dynamic: license-file
|
|
65
|
+
Dynamic: provides-extra
|
|
66
|
+
Dynamic: requires-dist
|
|
67
|
+
Dynamic: requires-python
|
|
68
|
+
Dynamic: summary
|
|
69
|
+
|
|
70
|
+
# AI Toolkit
|
|
71
|
+
|
|
72
|
+
A modular repository of specialized engineering tools, automation workflows, and helper utilities designed for AI agents and human developers.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Toolkits & Modules
|
|
77
|
+
|
|
78
|
+
| Module | Description | Quick Links |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| **[CAD Toolkit](cad/README.md)** | Hardware-accelerated 3D CAD viewer, procedural & parametric modeling engine, CSG operations, Signed Distance Fields (SDF), 3D printability analysis, and AI Agent CollabBridge HTTP/CLI. | [Documentation](cad/README.md) • [Interactive Viewer](cad/README.md#1-launching-the-interactive-3d-viewer) • [AI Bridge](cad/README.md#3-ai-agent-collabbridge-bridgepy) |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Highlights: 3D CAD Toolkit (`cad/`)
|
|
85
|
+
|
|
86
|
+
The **[CAD Toolkit](cad/README.md)** provides a complete 3D modeling and visualization suite built for autonomous AI agents and pair-programming workflows:
|
|
87
|
+
|
|
88
|
+
- **Interactive 3D Viewport**: Fast, cross-platform UI with Dear PyGui and hardware-accelerated OpenGL offscreen rendering with CPU fallback.
|
|
89
|
+
- **AI Agent CollabBridge**: HTTP JSON API & CLI on port `8765` enabling external AI agents to query scene state, inspect geometry, command camera views, adjust live parameters, and export models.
|
|
90
|
+
- **Procedural Modeling**: Parametric primitives, CSG booleans (union, difference, intersection, chamfer, fillet) powered by Manifold3D, assemblies, and exploded views.
|
|
91
|
+
- **Signed Distance Fields (SDF)**: Smooth mathematical CSG blending and high-resolution Marching Cubes meshing.
|
|
92
|
+
- **3D Print Preparation**: Overhang detection, support volume estimation, bed boundary checks (Bambu, Prusa, Ender, Voron), and automatic print orientation optimization.
|
|
93
|
+
- **Automated Testing & CI**: Comprehensive 222-test suite enforcing >=90% code coverage across Linux, Windows, and macOS.
|
|
94
|
+
|
|
95
|
+
For full setup instructions, CLI parameters, and developer guides, refer to the **[CAD Toolkit Documentation](cad/README.md)**.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Repository Structure
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
ai-toolkit/
|
|
103
|
+
├── .github/
|
|
104
|
+
│ └── workflows/
|
|
105
|
+
│ └── cad.yml # Cross-platform GitHub Actions CI for CAD
|
|
106
|
+
├── cad/ # 3D Computer-Aided Design & Procedural Modeling Tool
|
|
107
|
+
│ ├── README.md # In-depth CAD documentation & CLI reference
|
|
108
|
+
│ ├── view.py # Interactive 3D CAD viewer
|
|
109
|
+
│ ├── save.py # Headless scene exporter & snapshot generator
|
|
110
|
+
│ ├── bridge.py # AI Agent CollabBridge client
|
|
111
|
+
│ ├── core/ # Modeling, rendering, SDF, and geometry engine
|
|
112
|
+
│ ├── scenes/ # Demo procedural scenes
|
|
113
|
+
│ ├── scripts/ # Cross-platform environment & setup helpers
|
|
114
|
+
│ ├── ci/ # Tool-specific CI composite action
|
|
115
|
+
│ └── tests/ # 222 unit and integration tests (95% coverage)
|
|
116
|
+
└── LICENSE # Repository license
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Contributing & Development
|
|
122
|
+
|
|
123
|
+
1. Clone the repository:
|
|
124
|
+
```bash
|
|
125
|
+
git clone https://github.com/sanchousf/ai-toolkit.git
|
|
126
|
+
cd ai-toolkit
|
|
127
|
+
```
|
|
128
|
+
2. Navigate to the tool directory (e.g. `cd cad`) and run the setup script:
|
|
129
|
+
- Linux / macOS / Termux: `./setup_dev.sh`
|
|
130
|
+
- Windows: `setup_dev.bat`
|
|
131
|
+
3. Run tests with coverage:
|
|
132
|
+
- Linux / macOS / Termux: `./run_tests.sh`
|
|
133
|
+
- Windows: `run_tests.bat`
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# AI Toolkit
|
|
2
|
+
|
|
3
|
+
A modular repository of specialized engineering tools, automation workflows, and helper utilities designed for AI agents and human developers.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Toolkits & Modules
|
|
8
|
+
|
|
9
|
+
| Module | Description | Quick Links |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| **[CAD Toolkit](cad/README.md)** | Hardware-accelerated 3D CAD viewer, procedural & parametric modeling engine, CSG operations, Signed Distance Fields (SDF), 3D printability analysis, and AI Agent CollabBridge HTTP/CLI. | [Documentation](cad/README.md) • [Interactive Viewer](cad/README.md#1-launching-the-interactive-3d-viewer) • [AI Bridge](cad/README.md#3-ai-agent-collabbridge-bridgepy) |
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Highlights: 3D CAD Toolkit (`cad/`)
|
|
16
|
+
|
|
17
|
+
The **[CAD Toolkit](cad/README.md)** provides a complete 3D modeling and visualization suite built for autonomous AI agents and pair-programming workflows:
|
|
18
|
+
|
|
19
|
+
- **Interactive 3D Viewport**: Fast, cross-platform UI with Dear PyGui and hardware-accelerated OpenGL offscreen rendering with CPU fallback.
|
|
20
|
+
- **AI Agent CollabBridge**: HTTP JSON API & CLI on port `8765` enabling external AI agents to query scene state, inspect geometry, command camera views, adjust live parameters, and export models.
|
|
21
|
+
- **Procedural Modeling**: Parametric primitives, CSG booleans (union, difference, intersection, chamfer, fillet) powered by Manifold3D, assemblies, and exploded views.
|
|
22
|
+
- **Signed Distance Fields (SDF)**: Smooth mathematical CSG blending and high-resolution Marching Cubes meshing.
|
|
23
|
+
- **3D Print Preparation**: Overhang detection, support volume estimation, bed boundary checks (Bambu, Prusa, Ender, Voron), and automatic print orientation optimization.
|
|
24
|
+
- **Automated Testing & CI**: Comprehensive 222-test suite enforcing >=90% code coverage across Linux, Windows, and macOS.
|
|
25
|
+
|
|
26
|
+
For full setup instructions, CLI parameters, and developer guides, refer to the **[CAD Toolkit Documentation](cad/README.md)**.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Repository Structure
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
ai-toolkit/
|
|
34
|
+
├── .github/
|
|
35
|
+
│ └── workflows/
|
|
36
|
+
│ └── cad.yml # Cross-platform GitHub Actions CI for CAD
|
|
37
|
+
├── cad/ # 3D Computer-Aided Design & Procedural Modeling Tool
|
|
38
|
+
│ ├── README.md # In-depth CAD documentation & CLI reference
|
|
39
|
+
│ ├── view.py # Interactive 3D CAD viewer
|
|
40
|
+
│ ├── save.py # Headless scene exporter & snapshot generator
|
|
41
|
+
│ ├── bridge.py # AI Agent CollabBridge client
|
|
42
|
+
│ ├── core/ # Modeling, rendering, SDF, and geometry engine
|
|
43
|
+
│ ├── scenes/ # Demo procedural scenes
|
|
44
|
+
│ ├── scripts/ # Cross-platform environment & setup helpers
|
|
45
|
+
│ ├── ci/ # Tool-specific CI composite action
|
|
46
|
+
│ └── tests/ # 222 unit and integration tests (95% coverage)
|
|
47
|
+
└── LICENSE # Repository license
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Contributing & Development
|
|
53
|
+
|
|
54
|
+
1. Clone the repository:
|
|
55
|
+
```bash
|
|
56
|
+
git clone https://github.com/sanchousf/ai-toolkit.git
|
|
57
|
+
cd ai-toolkit
|
|
58
|
+
```
|
|
59
|
+
2. Navigate to the tool directory (e.g. `cd cad`) and run the setup script:
|
|
60
|
+
- Linux / macOS / Termux: `./setup_dev.sh`
|
|
61
|
+
- Windows: `setup_dev.bat`
|
|
62
|
+
3. Run tests with coverage:
|
|
63
|
+
- Linux / macOS / Termux: `./run_tests.sh`
|
|
64
|
+
- Windows: `run_tests.bat`
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# 3D CAD Toolkit
|
|
2
|
+
|
|
3
|
+
A high-performance, modular 3D Computer-Aided Design (CAD), procedural modeling, and visualization engine engineered for both interactive human workflows and autonomous AI agent collaboration.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Key Features
|
|
8
|
+
|
|
9
|
+
- **Interactive 3D Viewport**:
|
|
10
|
+
- Built with [Dear PyGui](https://github.com/hoffstadt/DearPyGui) for responsive, lightweight cross-platform GUI.
|
|
11
|
+
- Hardware-accelerated OpenGL offscreen rendering with true per-pixel depth buffering (Z-buffer), polygon offset shaded-wireframe overlays, and automatic CPU rasterizer fallback.
|
|
12
|
+
- 3D translation/rotation/scale manipulator gizmos, flying and orbit camera controls, RGB coordinate axes, and build-plate grid.
|
|
13
|
+
- Interactive measurement tools (point-to-point distance, angles, surface area).
|
|
14
|
+
|
|
15
|
+
- **AI Agent CollabBridge (HTTP & CLI)**:
|
|
16
|
+
- Built-in HTTP JSON API (`port 8765`) and CLI (`bridge.py`) designed specifically for AI pair programmers and autonomous agents.
|
|
17
|
+
- Allows external processes to query scene state, select/inspect objects, trigger parametric tweaks, draw temporary 3D debug overlays, and command camera movements in real time without restarting the viewer.
|
|
18
|
+
|
|
19
|
+
- **Procedural & Parametric Modeling**:
|
|
20
|
+
- **Primitives**: Box, Sphere, Cylinder, Capsule, Cone, Torus, Extruded Text, and 3D Polylines.
|
|
21
|
+
- **CSG Operations**: Exact Boolean Union, Difference, Intersection, Chamfer, Fillet, Sweep, and Loft via [Manifold3D](https://github.com/elalish/manifold).
|
|
22
|
+
- **Assembly Management**: Hierarchical object groups, transformation hierarchies, and interactive exploded views.
|
|
23
|
+
|
|
24
|
+
- **Signed Distance Fields (SDF) & Meshing**:
|
|
25
|
+
- Mathematical SDF representation with smooth polynomial CSG blending (`smooth_union`, `smooth_difference`, `smooth_intersection`).
|
|
26
|
+
- High-resolution Marching Cubes and Dual Contouring meshing with integrated quadric mesh decimation/simplification.
|
|
27
|
+
|
|
28
|
+
- **3D Printability Analysis**:
|
|
29
|
+
- Watertight / manifold topology validation.
|
|
30
|
+
- Critical overhang detection and support volume estimation.
|
|
31
|
+
- Build-volume verification against popular printer presets (Bambu Lab, Prusa MK3/MK4, Ender 3, Voron 2.4/350).
|
|
32
|
+
- Automatic print orientation optimization (`--auto-orient`) to minimize support requirements and maximize build-plate contact area.
|
|
33
|
+
|
|
34
|
+
- **Multi-Format Export & Rendering**:
|
|
35
|
+
- **3D Formats**: Binary/ASCII STL, OBJ, PLY, GLB, and DXF.
|
|
36
|
+
- **High-Resolution Snapshots**: Anti-aliased (SSAA 1x/2x/4x) image snapshots in PNG (with alpha transparency), JPEG, WebP, TIFF, and BMP with customizable camera angles and backgrounds.
|
|
37
|
+
|
|
38
|
+
- **Cross-Platform & Headless Compatibility**:
|
|
39
|
+
- Tested and supported across Linux (Ubuntu, Debian, and Android Termux/PRoot), macOS, and Windows.
|
|
40
|
+
- Intelligent OpenGL driver probe and caching system to handle headless virtual machines and software rasterization environments.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Directory Structure
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
cad/
|
|
48
|
+
├── view.py # Main interactive 3D CAD viewer application
|
|
49
|
+
├── save.py # Headless scene exporter, snapshot generator & CLI
|
|
50
|
+
├── bridge.py # CollabBridge CLI for external & AI agent control
|
|
51
|
+
├── remesh.py # Standalone mesh decimation & remeshing tool
|
|
52
|
+
├── requirements.txt # Core runtime dependencies
|
|
53
|
+
├── requirements-dev.txt # Development and testing dependencies
|
|
54
|
+
├── pytest.ini # Pytest configuration (90% coverage enforcement)
|
|
55
|
+
│
|
|
56
|
+
├── core/ # Core engine implementation
|
|
57
|
+
│ ├── analysis/ # 3D printability, overhangs, bed envelopes
|
|
58
|
+
│ ├── bridge/ # HTTP CollabBridge server & protocol
|
|
59
|
+
│ ├── common/ # Global constants and progress reporting
|
|
60
|
+
│ ├── geometry/ # Mesh representations, transforms, STL I/O
|
|
61
|
+
│ ├── io/ # Multi-format mesh exporters (STL, OBJ, GLB, etc.)
|
|
62
|
+
│ ├── modeling/ # CSG booleans, assemblies, sketches, remeshing
|
|
63
|
+
│ ├── primitives/ # Parametric shapes, text, polyline sweeps
|
|
64
|
+
│ ├── rendering/ # OpenGL FBO renderer, DPG viewport, gizmo, camera
|
|
65
|
+
│ ├── scratchpad/ # Temporary geometric canvas for experiments
|
|
66
|
+
│ ├── sdf/ # Mathematical SDF models and Marching Cubes mesher
|
|
67
|
+
│ └── spatial/ # Raycasting, BVH, and screen-space object picking
|
|
68
|
+
│
|
|
69
|
+
├── scenes/ # Ready-to-run procedural scene definitions
|
|
70
|
+
│ ├── assembly_demo.py # Multi-part mechanical assembly with exploded view
|
|
71
|
+
│ ├── parametric_demo.py # Live slider-driven parametric model
|
|
72
|
+
│ ├── polyline.py # Complex 3D swept path demonstrations
|
|
73
|
+
│ └── test.py # 3D primitives, text, and SDF CSG / Gyroid models
|
|
74
|
+
│
|
|
75
|
+
├── scripts/ # Modular helper scripts
|
|
76
|
+
│ ├── env.sh / env.bat # Dynamic virtual environment and path discovery
|
|
77
|
+
│ ├── setup_base.sh/.bat # Unified 5-step installer backend
|
|
78
|
+
│ ├── check_gl.sh # Self-testing OpenGL compatibility probe & cache
|
|
79
|
+
│ └── probe_gl.py # Micro-probe for OpenGL rasterization validation
|
|
80
|
+
│
|
|
81
|
+
├── ci/ # Continuous Integration
|
|
82
|
+
│ └── action.yml # GitHub Actions composite action for CAD
|
|
83
|
+
│
|
|
84
|
+
└── tests/ # Test suite (223 unit & integration tests)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Installation & Setup
|
|
90
|
+
|
|
91
|
+
Automated setup scripts create an isolated `.venv`, upgrade `pip`, install all requirements, and verify core library imports.
|
|
92
|
+
|
|
93
|
+
### Runtime Installation (Users)
|
|
94
|
+
- **Linux / macOS / Termux**:
|
|
95
|
+
```bash
|
|
96
|
+
./setup.sh
|
|
97
|
+
```
|
|
98
|
+
- **Windows**:
|
|
99
|
+
```cmd
|
|
100
|
+
setup.bat
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Developer Installation (Includes Testing & Coverage Tools)
|
|
104
|
+
- **Linux / macOS / Termux**:
|
|
105
|
+
```bash
|
|
106
|
+
./setup_dev.sh
|
|
107
|
+
```
|
|
108
|
+
- **Windows**:
|
|
109
|
+
```cmd
|
|
110
|
+
setup_dev.bat
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Quick Start
|
|
116
|
+
|
|
117
|
+
### 1. Launching the Interactive 3D Viewer
|
|
118
|
+
|
|
119
|
+
**Viewing scenes in your active project folder or custom path (`view.sh` / `view.bat`):**
|
|
120
|
+
```bash
|
|
121
|
+
# By default, discovers scenes in the current terminal directory:
|
|
122
|
+
./view.sh
|
|
123
|
+
|
|
124
|
+
# Or specify a target directory, relative or absolute path, or standalone scene file:
|
|
125
|
+
./view.sh path/to/scenes/
|
|
126
|
+
./view.sh path/to/my_scene.py
|
|
127
|
+
# Windows: view.bat [path]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Running bundled repository example scenes (`run.sh` / `run.bat`):**
|
|
131
|
+
```bash
|
|
132
|
+
./run.sh
|
|
133
|
+
# Windows: run.bat
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Load a specific scene:
|
|
137
|
+
```bash
|
|
138
|
+
./run.sh -s scenes/assembly_demo.py
|
|
139
|
+
./run.sh -s scenes/parametric_demo.py
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Viewport Navigation Controls:
|
|
143
|
+
- **Left Mouse Click / Drag**: Rotate camera around focal point / select objects in pick mode.
|
|
144
|
+
- **Right Mouse Drag**: Pan camera horizontally and vertically.
|
|
145
|
+
- **Mouse Wheel / Scroll**: Zoom in and out.
|
|
146
|
+
- **Toolbar**: Switch between Move, Rotate, Scale, and Measure tools; toggle shaded and wireframe modes; inspect object geometry.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### 2. Headless Scene Exporting & Snapshot Generation (`save.py`)
|
|
151
|
+
|
|
152
|
+
Export a scene directly to binary STL:
|
|
153
|
+
```bash
|
|
154
|
+
./save.sh -s scenes/assembly_demo.py -o output.stl
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Export to OBJ, GLB, or PLY format:
|
|
158
|
+
```bash
|
|
159
|
+
./save.sh -s scenes/parametric_demo.py -e model.glb
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Generate a high-resolution 4K isometric preview image with anti-aliasing:
|
|
163
|
+
```bash
|
|
164
|
+
./save.sh -s scenes/assembly_demo.py -i preview.png --resolution 3840x2160 --cam-ori iso --supersample 4
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Analyze 3D printability and optimize print orientation for a Bambu Lab bed:
|
|
168
|
+
```bash
|
|
169
|
+
./save.sh -s scenes/assembly_demo.py --analyze-print --printer-bed bambu --auto-orient
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Merge scene objects using Smooth Boolean Union (SDF Marching Cubes):
|
|
173
|
+
```bash
|
|
174
|
+
./save.sh -s scenes/assembly_demo.py --sdf-merge smooth_union --sdf-k 3.0 -o merged.stl
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
### 3. AI Agent CollabBridge (`bridge.py`)
|
|
180
|
+
|
|
181
|
+
When `view.py` is running, the viewer hosts an HTTP JSON endpoint on port `8765`. AI agents or terminal users can query and control the application live via `./bridge.sh`:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Check viewer status and active scene
|
|
185
|
+
./bridge.sh status
|
|
186
|
+
|
|
187
|
+
# List all available scenes
|
|
188
|
+
./bridge.sh scenes
|
|
189
|
+
|
|
190
|
+
# Load a new scene dynamically
|
|
191
|
+
./bridge.sh scene scenes/assembly_demo.py
|
|
192
|
+
|
|
193
|
+
# Select an object by name
|
|
194
|
+
./bridge.sh select "BasePlate"
|
|
195
|
+
|
|
196
|
+
# Translate selected object by [+10mm X, 0mm Y, +5mm Z]
|
|
197
|
+
./bridge.sh translate "10,0,5"
|
|
198
|
+
|
|
199
|
+
# Adjust exploded view ratio (0.0 = assembled, 1.0 = exploded)
|
|
200
|
+
./bridge.sh explode 0.5
|
|
201
|
+
|
|
202
|
+
# Request a 3D printability check
|
|
203
|
+
./bridge.sh print-check
|
|
204
|
+
|
|
205
|
+
# Export current viewer model to disk
|
|
206
|
+
./bridge.sh export "exported_model.stl"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### 4. Running Tests & Code Coverage
|
|
212
|
+
|
|
213
|
+
Execute the complete 222-test suite:
|
|
214
|
+
```bash
|
|
215
|
+
./run_tests.sh
|
|
216
|
+
# Windows: run_tests.bat
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
- **Enforced Coverage**: [pytest.ini](pytest.ini) requires a minimum of **90% test coverage** across the `core/` package; test runs below this threshold automatically fail.
|
|
220
|
+
- **Coverage Reports**: HTML reports are generated at `cad/htmlcov/index.html` and XML reports at `cad/coverage.xml`.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## OpenGL Driver Compatibility & Probing
|
|
225
|
+
|
|
226
|
+
In certain virtualized, containerized, or headless environments (e.g. Android PRoot, headless CI runners, or systems without GPU drivers), default OpenGL drivers may trigger errors or lack WGL/GLX support.
|
|
227
|
+
|
|
228
|
+
The toolkit includes an automated driver probe:
|
|
229
|
+
- **Automatic Fallback**: [scripts/check_gl.sh](scripts/check_gl.sh) tests OpenGL rasterization via [scripts/probe_gl.py](scripts/probe_gl.py) and caches the result in `.venv/.gallium_probe`. If default Mesa `llvmpipe` fails, it automatically selects `softpipe`.
|
|
230
|
+
- **Force Re-testing**: Pass `--retest-gl` to any launcher script to re-evaluate the host environment:
|
|
231
|
+
```bash
|
|
232
|
+
./run.sh --retest-gl
|
|
233
|
+
./run_tests.sh --retest-gl
|
|
234
|
+
# Or via check_gl.sh directly:
|
|
235
|
+
./scripts/check_gl.sh --retest
|
|
236
|
+
```
|
|
237
|
+
- **Inspect Status**:
|
|
238
|
+
```bash
|
|
239
|
+
./scripts/check_gl.sh --status
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Continuous Integration
|
|
245
|
+
|
|
246
|
+
Cross-platform CI is configured in [`.github/workflows/cad.yml`](../.github/workflows/cad.yml) and executes on every push and pull request to `main`, `dev/**`, and `release/**`:
|
|
247
|
+
- **Matrix**: Ubuntu 24.04 (with Xvfb), Windows Server 2022, and macOS 14/15 on Python 3.12.
|
|
248
|
+
- **Action**: Uses the self-contained composite action in [ci/action.yml](ci/action.yml).
|
|
249
|
+
- **Artifacts**: Uploads HTML coverage reports on all platforms and submits to Codecov.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""
|
|
2
|
+
AI-Toolkit CAD Package.
|
|
3
|
+
A modular, high-performance 3D CAD engine for parametric modeling, procedural generation,
|
|
4
|
+
signed distance fields, interactive viewport rendering, and dynamic scene authoring.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
__version__ = "0.2.1"
|
|
10
|
+
|
|
11
|
+
# Re-export subpackages
|
|
12
|
+
from . import core
|
|
13
|
+
from . import scene
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# Base scene authoring & dynamic loader
|
|
17
|
+
from .scene.base import BaseScene, EmptyScene, ErrorScene
|
|
18
|
+
from .scene.loader import (
|
|
19
|
+
SceneEntry,
|
|
20
|
+
SceneLoader,
|
|
21
|
+
load_scene_from_file,
|
|
22
|
+
discover_scenes,
|
|
23
|
+
resolve_scene,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Geometry primitives & entities
|
|
27
|
+
from .core.geometry import (
|
|
28
|
+
MeshObject,
|
|
29
|
+
ObjectGroup,
|
|
30
|
+
ObjectsGroup,
|
|
31
|
+
CADPart,
|
|
32
|
+
CADAssembly,
|
|
33
|
+
OriginMode,
|
|
34
|
+
CSGOperation,
|
|
35
|
+
DecimateMethod,
|
|
36
|
+
SimplifierBackend,
|
|
37
|
+
STLHelper,
|
|
38
|
+
)
|
|
39
|
+
from .core.primitives import (
|
|
40
|
+
BoxModel,
|
|
41
|
+
SphereModel,
|
|
42
|
+
CylinderModel,
|
|
43
|
+
CapsuleModel,
|
|
44
|
+
ConeModel,
|
|
45
|
+
TorusModel,
|
|
46
|
+
WedgeModel,
|
|
47
|
+
RegularPrismModel,
|
|
48
|
+
PolylineModel,
|
|
49
|
+
TextModel,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Parametric modeling & operations
|
|
53
|
+
from .core.modeling import (
|
|
54
|
+
WorkPlane,
|
|
55
|
+
Sketch2D,
|
|
56
|
+
ExtrusionModel,
|
|
57
|
+
RevolveModel,
|
|
58
|
+
SweepModel,
|
|
59
|
+
LoftModel,
|
|
60
|
+
linear_pattern,
|
|
61
|
+
circular_pattern,
|
|
62
|
+
mirror_object,
|
|
63
|
+
align_objects,
|
|
64
|
+
FeatureTree,
|
|
65
|
+
MeshSimplifier,
|
|
66
|
+
mesh_boolean,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# Procedural SDF & meshing
|
|
70
|
+
from .core.sdf import (
|
|
71
|
+
SDFModel,
|
|
72
|
+
SDFGroup,
|
|
73
|
+
SDFOps,
|
|
74
|
+
SDFMesher,
|
|
75
|
+
merge_to_sdf_group,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
__all__ = [
|
|
79
|
+
# Metadata
|
|
80
|
+
"__version__",
|
|
81
|
+
# Subpackages
|
|
82
|
+
"core",
|
|
83
|
+
"scene",
|
|
84
|
+
# Scene interfaces & loading
|
|
85
|
+
"BaseScene",
|
|
86
|
+
"EmptyScene",
|
|
87
|
+
"ErrorScene",
|
|
88
|
+
"SceneEntry",
|
|
89
|
+
"SceneLoader",
|
|
90
|
+
"load_scene_from_file",
|
|
91
|
+
"discover_scenes",
|
|
92
|
+
"resolve_scene",
|
|
93
|
+
# Geometry entities & enums
|
|
94
|
+
"MeshObject",
|
|
95
|
+
"ObjectGroup",
|
|
96
|
+
"ObjectsGroup",
|
|
97
|
+
"CADPart",
|
|
98
|
+
"CADAssembly",
|
|
99
|
+
"OriginMode",
|
|
100
|
+
"CSGOperation",
|
|
101
|
+
"DecimateMethod",
|
|
102
|
+
"SimplifierBackend",
|
|
103
|
+
"STLHelper",
|
|
104
|
+
# Primitives
|
|
105
|
+
"BoxModel",
|
|
106
|
+
"SphereModel",
|
|
107
|
+
"CylinderModel",
|
|
108
|
+
"CapsuleModel",
|
|
109
|
+
"ConeModel",
|
|
110
|
+
"TorusModel",
|
|
111
|
+
"WedgeModel",
|
|
112
|
+
"RegularPrismModel",
|
|
113
|
+
"PolylineModel",
|
|
114
|
+
"TextModel",
|
|
115
|
+
# Modeling & operations
|
|
116
|
+
"WorkPlane",
|
|
117
|
+
"Sketch2D",
|
|
118
|
+
"ExtrusionModel",
|
|
119
|
+
"RevolveModel",
|
|
120
|
+
"SweepModel",
|
|
121
|
+
"LoftModel",
|
|
122
|
+
"linear_pattern",
|
|
123
|
+
"circular_pattern",
|
|
124
|
+
"mirror_object",
|
|
125
|
+
"align_objects",
|
|
126
|
+
"FeatureTree",
|
|
127
|
+
"MeshSimplifier",
|
|
128
|
+
"mesh_boolean",
|
|
129
|
+
# SDF
|
|
130
|
+
"SDFModel",
|
|
131
|
+
"SDFGroup",
|
|
132
|
+
"SDFOps",
|
|
133
|
+
"SDFMesher",
|
|
134
|
+
"merge_to_sdf_group",
|
|
135
|
+
]
|
|
136
|
+
|