sand3d 1.6.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 (61) hide show
  1. sand3d-1.6.1/LICENSE +202 -0
  2. sand3d-1.6.1/PKG-INFO +166 -0
  3. sand3d-1.6.1/README.md +150 -0
  4. sand3d-1.6.1/pyproject.toml +31 -0
  5. sand3d-1.6.1/setup.cfg +4 -0
  6. sand3d-1.6.1/src/sand3d/__init__.py +118 -0
  7. sand3d-1.6.1/src/sand3d/_core.py +319 -0
  8. sand3d-1.6.1/src/sand3d/_guard.py +181 -0
  9. sand3d-1.6.1/src/sand3d/assembly.py +194 -0
  10. sand3d-1.6.1/src/sand3d/edit.py +1387 -0
  11. sand3d-1.6.1/src/sand3d/frames.py +851 -0
  12. sand3d-1.6.1/src/sand3d/joints.py +723 -0
  13. sand3d-1.6.1/src/sand3d/materials.py +190 -0
  14. sand3d-1.6.1/src/sand3d/meshfile.py +72 -0
  15. sand3d-1.6.1/src/sand3d/parts/__init__.py +5 -0
  16. sand3d-1.6.1/src/sand3d/parts/gear.py +42 -0
  17. sand3d-1.6.1/src/sand3d/parts/turned.py +83 -0
  18. sand3d-1.6.1/src/sand3d/profile.py +947 -0
  19. sand3d-1.6.1/src/sand3d/solids.py +1118 -0
  20. sand3d-1.6.1/src/sand3d/urdf.py +457 -0
  21. sand3d-1.6.1/src/sand3d/usd.py +274 -0
  22. sand3d-1.6.1/src/sand3d.egg-info/PKG-INFO +166 -0
  23. sand3d-1.6.1/src/sand3d.egg-info/SOURCES.txt +59 -0
  24. sand3d-1.6.1/src/sand3d.egg-info/dependency_links.txt +1 -0
  25. sand3d-1.6.1/src/sand3d.egg-info/requires.txt +6 -0
  26. sand3d-1.6.1/src/sand3d.egg-info/top_level.txt +1 -0
  27. sand3d-1.6.1/tests/test_arguments.py +140 -0
  28. sand3d-1.6.1/tests/test_bbox.py +147 -0
  29. sand3d-1.6.1/tests/test_copy.py +131 -0
  30. sand3d-1.6.1/tests/test_cutlery.py +53 -0
  31. sand3d-1.6.1/tests/test_determinism.py +71 -0
  32. sand3d-1.6.1/tests/test_edits.py +108 -0
  33. sand3d-1.6.1/tests/test_errors.py +227 -0
  34. sand3d-1.6.1/tests/test_examples.py +39 -0
  35. sand3d-1.6.1/tests/test_export_joints.py +372 -0
  36. sand3d-1.6.1/tests/test_export_meshes.py +108 -0
  37. sand3d-1.6.1/tests/test_export_usd.py +331 -0
  38. sand3d-1.6.1/tests/test_fillet.py +227 -0
  39. sand3d-1.6.1/tests/test_frame_lists.py +62 -0
  40. sand3d-1.6.1/tests/test_frames.py +118 -0
  41. sand3d-1.6.1/tests/test_golden.py +46 -0
  42. sand3d-1.6.1/tests/test_in_plane.py +64 -0
  43. sand3d-1.6.1/tests/test_joints.py +363 -0
  44. sand3d-1.6.1/tests/test_local.py +115 -0
  45. sand3d-1.6.1/tests/test_loop.py +50 -0
  46. sand3d-1.6.1/tests/test_material.py +222 -0
  47. sand3d-1.6.1/tests/test_mirror.py +48 -0
  48. sand3d-1.6.1/tests/test_nothing_cut.py +68 -0
  49. sand3d-1.6.1/tests/test_on.py +94 -0
  50. sand3d-1.6.1/tests/test_origin.py +76 -0
  51. sand3d-1.6.1/tests/test_partial_at.py +126 -0
  52. sand3d-1.6.1/tests/test_parts.py +61 -0
  53. sand3d-1.6.1/tests/test_patterns.py +276 -0
  54. sand3d-1.6.1/tests/test_pose.py +274 -0
  55. sand3d-1.6.1/tests/test_profile.py +219 -0
  56. sand3d-1.6.1/tests/test_regressions.py +616 -0
  57. sand3d-1.6.1/tests/test_seat.py +130 -0
  58. sand3d-1.6.1/tests/test_solids.py +237 -0
  59. sand3d-1.6.1/tests/test_station.py +56 -0
  60. sand3d-1.6.1/tests/test_transform.py +102 -0
  61. sand3d-1.6.1/tests/test_units.py +333 -0
sand3d-1.6.1/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
sand3d-1.6.1/PKG-INFO ADDED
@@ -0,0 +1,166 @@
1
+ Metadata-Version: 2.4
2
+ Name: sand3d
3
+ Version: 1.6.1
4
+ Summary: 3D modeling in Python, built for LLMs: short programs over Blender's bpy.
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://sand3d.sandflow.ai/
7
+ Project-URL: Documentation, https://sand3d.sandflow.ai/api.html
8
+ Project-URL: Repository, https://github.com/Sandflow-ai/sand3d
9
+ Project-URL: Issues, https://github.com/Sandflow-ai/sand3d/issues
10
+ Requires-Python: !=3.12.*,<3.14,>=3.11
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: bpy<4.6,>=4.5; python_version == "3.11"
14
+ Requires-Dist: bpy<5.3,>=5.2; python_version == "3.13"
15
+ Dynamic: license-file
16
+
17
+ <h1>
18
+ <picture>
19
+ <source media="(prefers-color-scheme: dark)" srcset="docs/readme/sandflow-symbol-white.svg">
20
+ <img src="docs/readme/sandflow-symbol-black.svg" alt="Sandflow" height="26">
21
+ </picture>
22
+ &nbsp;sand3d
23
+ </h1>
24
+
25
+ **3D modeling in Python, built for LLMs.**
26
+
27
+ sand3d is a Python library for writing 3D objects as short programs: profiles, solids,
28
+ edits, frames, joints and assemblies, over Blender's `bpy`. A program says *how* a shape
29
+ is made, part by part and in its own words, so a model writes it in a few hundred tokens
30
+ and a person can read it.
31
+
32
+ <p align="center"><img src="docs/readme/hero.png" alt="Objects written in sand3d" width="830"></p>
33
+
34
+ <p align="center">
35
+ <a href="https://sand3d.sandflow.ai/">Website</a> ·
36
+ <a href="https://sand3d.sandflow.ai/api.html">API for LLMs</a> ·
37
+ <a href="https://sand3d.sandflow.ai/guidelines.html">Writing an assembly</a> ·
38
+ <a href="https://sand3d.sandflow.ai/#export">Export</a> ·
39
+ <a href="https://sand3d.sandflow.ai/#citation">Citation</a>
40
+ </p>
41
+
42
+ <p align="center">
43
+ <a href="LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-793CFF"></a>
44
+ <img alt="Python 3.11 and 3.13" src="https://img.shields.io/badge/python-3.11%20%7C%203.13-121117">
45
+ <img alt="bpy 4.5 and 5.2" src="https://img.shields.io/badge/bpy-4.5%20%7C%205.2-121117">
46
+ <a href="https://github.com/Sandflow-ai/sand3d/actions/workflows/tests.yml"><img alt="tests" src="https://github.com/Sandflow-ai/sand3d/actions/workflows/tests.yml/badge.svg"></a>
47
+ </p>
48
+
49
+ ## Why sand3d
50
+
51
+ <p align="center"><img src="docs/readme/tokens.png" alt="Tokens per part, median: the same part takes 4.0 times sand3d's tokens in Blender Python, 2.3 in CadQuery, 6.0 in FeatureScript, 2.0 in the Articraft SDK" width="830"><br>
52
+ <a href="https://sand3d.sandflow.ai/tokens.html">How it is measured, part by part</a></p>
53
+
54
+ - **Short.** A part takes 2 to 6× fewer tokens than the same part in Blender Python, CadQuery or FeatureScript ([details](https://sand3d.sandflow.ai/tokens.html)).
55
+ - **The whole API fits in a prompt**, about 3,600 tokens ([the API](https://sand3d.sandflow.ai/api.html)).
56
+ - **Named, not computed.** Parts, edges and faces are reached by name, never by hand-computed coordinates.
57
+ - **Deterministic.** The same program builds the same mesh, bit for bit.
58
+
59
+ ## A whole object, part by part
60
+
61
+ <p align="center"><img src="docs/readme/washer.png" alt="A washing machine written in sand3d: its part tree, its four joints, and the three files it exports" width="830"></p>
62
+
63
+ A front-loading washing machine in 38 lines of code ([play it and read it](https://sand3d.sandflow.ai/gallery.html)):
64
+ the cabinet, the drum, the door with its glass and handle, the detergent drawer and the dial,
65
+ each a named part, and four joints that say how they move.
66
+
67
+ ```python
68
+ door = s3d.group("door", ring, glass, handle) # the handle and the glass move with it
69
+ s3d.joint("door_hinge", door, hinge, axis="-Z", range=(0, 143))
70
+ s3d.joint("drum_spin", drum, front.move(0, 400), kind="continuous")
71
+ s3d.joint("drawer_slide", drawer, top_band.move(150), kind="prismatic", axis="+X", range=(0, 200))
72
+ s3d.joint("dial_turn", dial, top_band.move(-150), kind="continuous")
73
+ return s3d.assembly("washing_machine", cab, drum, door, drawer, dial, front=front)
74
+ ```
75
+
76
+ ## Export: GLB, URDF, USD, OBJ, STL
77
+
78
+ One call; the file's extension names the format; lengths in metres.
79
+
80
+ ```python
81
+ s3d.export(machine, "washer.glb") # or .urdf, .usda, .obj, .stl
82
+ ```
83
+
84
+ | format | what it carries | for |
85
+ |---|---|---|
86
+ | **GLB** | meshes, materials, the joints in each node's extras, at the current pose | the web, viewers, game engines |
87
+ | **URDF** | a link per moving part, its joints and their limits, at rest; OBJ meshes beside it | ROS, PyBullet, MuJoCo, Isaac |
88
+ | **USDA** | the same tree in OpenUSD (UsdGeom, UsdPhysics), with the materials | Omniverse, Isaac Sim, USD pipelines |
89
+ | **OBJ**, **STL** | the meshes alone, at the current pose: OBJ Y up, binary STL Z up | any 3D tool, slicers |
90
+
91
+ `.usd`, `.usdc` and `.usdz` come from the `.usda` through USD's own tools (`usdcat`,
92
+ `usdzip`). The scene is also an ordinary Blender scene, for anything else Blender writes.
93
+
94
+ ## Install
95
+
96
+ Python 3.13 (recommended) or 3.11. Blender comes with it, as the `bpy` module: 5.2 LTS on
97
+ Python 3.13, 4.5 LTS on Python 3.11, the two versions the tests run on.
98
+
99
+ ```bash
100
+ pip install sand3d # or, in a uv project: uv add sand3d
101
+ ```
102
+
103
+ `bpy` has no wheel for Python 3.12, nor for Intel Macs from 5.2 on: there, use Python 3.11.
104
+
105
+ ## A first program
106
+
107
+ <img src="docs/readme/bracket.png" alt="The bracket" width="300" align="right">
108
+
109
+ ```python
110
+ import sand3d as s3d
111
+
112
+ def bracket(w=80, d=40, t=6, hole_d=6.6, pitch=50):
113
+ plate = s3d.extrude("plate", s3d.rect(w, d, r=4), t)
114
+ s3d.hole(plate, hole_d, on=s3d.grid(2, 1, pitch, 0))
115
+ s3d.fillet(plate, 1, edges="top")
116
+ return plate
117
+
118
+ s3d.export(bracket(), "bracket.glb")
119
+ ```
120
+
121
+ Millimetres by default. Every verb with code that runs and its render: [the quickstart](https://sand3d.sandflow.ai/quickstart.html);
122
+ objects to play joint by joint: [the gallery](https://sand3d.sandflow.ai/gallery.html); every signature: [the API](https://sand3d.sandflow.ai/api.html).
123
+ The programs themselves: [docs/examples/](docs/examples/) and [programs/](programs/).
124
+
125
+ ## Give it to your LLM
126
+
127
+ Put [docs/api.md](docs/api.md) in the system prompt: the rules of the vocabulary, every
128
+ signature, and worked examples, in about 3 600 tokens; [llms.txt](llms.txt) points a
129
+ model at it. For objects of several parts, [the guidelines](https://sand3d.sandflow.ai/guidelines.html) give
130
+ the eight rules of an assembly program: the plan first, then the details, then the parts.
131
+
132
+ ## What is in it
133
+
134
+ Everything on one flat `s3d.<verb>` surface:
135
+
136
+ | family | verbs |
137
+ |---|---|
138
+ | profiles | `rect` `circle` `slot` `polygon` `poly` `arc` `spline` `superellipse` `text` `offset` `stroke` … (16) |
139
+ | solids and paths | `extrude` `revolve` `sweep` `loft` `wire` `helix` `box` `cylinder` `tube` `sphere` `torus` `dome` … (15) |
140
+ | edits | `cut` `join` `intersect` `split` `hole` `pocket` `fillet` `chamfer` `shell` `dent` … (15) |
141
+ | frames and placement | `Frame` `face` `edge` `bbox` `local` `at` `transform` `grid` `ring` `along` `snap` |
142
+ | articulation | `joint` `pose` `seat` |
143
+ | assembly | `group` `assembly` `attach` `export` `units` `fingerprint` … (8) |
144
+ | parts and materials | `gear` `knurl` `thread` `material` |
145
+
146
+ No category verbs (`chair()`, `table()`): a category is a program written *in* sand3d.
147
+
148
+ ## Citation
149
+
150
+ If you use sand3d in your work, please cite it. `CITATION.cff` holds the same, and GitHub
151
+ shows it as "Cite this repository".
152
+
153
+ ```bibtex
154
+ @misc{sand3d2026,
155
+ author = {Neveu, Thibault and Loy, Andr{\'e}a},
156
+ title = {sand3d},
157
+ year = {2026},
158
+ note = {Version 1.6.1},
159
+ url = {https://github.com/Sandflow-ai/sand3d}
160
+ }
161
+ ```
162
+
163
+ ## Contributing and license
164
+
165
+ How the library is built, tested and versioned: [CONTRIBUTING.md](CONTRIBUTING.md).
166
+ Apache License 2.0: see [LICENSE](LICENSE).
sand3d-1.6.1/README.md ADDED
@@ -0,0 +1,150 @@
1
+ <h1>
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/readme/sandflow-symbol-white.svg">
4
+ <img src="docs/readme/sandflow-symbol-black.svg" alt="Sandflow" height="26">
5
+ </picture>
6
+ &nbsp;sand3d
7
+ </h1>
8
+
9
+ **3D modeling in Python, built for LLMs.**
10
+
11
+ sand3d is a Python library for writing 3D objects as short programs: profiles, solids,
12
+ edits, frames, joints and assemblies, over Blender's `bpy`. A program says *how* a shape
13
+ is made, part by part and in its own words, so a model writes it in a few hundred tokens
14
+ and a person can read it.
15
+
16
+ <p align="center"><img src="docs/readme/hero.png" alt="Objects written in sand3d" width="830"></p>
17
+
18
+ <p align="center">
19
+ <a href="https://sand3d.sandflow.ai/">Website</a> ·
20
+ <a href="https://sand3d.sandflow.ai/api.html">API for LLMs</a> ·
21
+ <a href="https://sand3d.sandflow.ai/guidelines.html">Writing an assembly</a> ·
22
+ <a href="https://sand3d.sandflow.ai/#export">Export</a> ·
23
+ <a href="https://sand3d.sandflow.ai/#citation">Citation</a>
24
+ </p>
25
+
26
+ <p align="center">
27
+ <a href="LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-793CFF"></a>
28
+ <img alt="Python 3.11 and 3.13" src="https://img.shields.io/badge/python-3.11%20%7C%203.13-121117">
29
+ <img alt="bpy 4.5 and 5.2" src="https://img.shields.io/badge/bpy-4.5%20%7C%205.2-121117">
30
+ <a href="https://github.com/Sandflow-ai/sand3d/actions/workflows/tests.yml"><img alt="tests" src="https://github.com/Sandflow-ai/sand3d/actions/workflows/tests.yml/badge.svg"></a>
31
+ </p>
32
+
33
+ ## Why sand3d
34
+
35
+ <p align="center"><img src="docs/readme/tokens.png" alt="Tokens per part, median: the same part takes 4.0 times sand3d's tokens in Blender Python, 2.3 in CadQuery, 6.0 in FeatureScript, 2.0 in the Articraft SDK" width="830"><br>
36
+ <a href="https://sand3d.sandflow.ai/tokens.html">How it is measured, part by part</a></p>
37
+
38
+ - **Short.** A part takes 2 to 6× fewer tokens than the same part in Blender Python, CadQuery or FeatureScript ([details](https://sand3d.sandflow.ai/tokens.html)).
39
+ - **The whole API fits in a prompt**, about 3,600 tokens ([the API](https://sand3d.sandflow.ai/api.html)).
40
+ - **Named, not computed.** Parts, edges and faces are reached by name, never by hand-computed coordinates.
41
+ - **Deterministic.** The same program builds the same mesh, bit for bit.
42
+
43
+ ## A whole object, part by part
44
+
45
+ <p align="center"><img src="docs/readme/washer.png" alt="A washing machine written in sand3d: its part tree, its four joints, and the three files it exports" width="830"></p>
46
+
47
+ A front-loading washing machine in 38 lines of code ([play it and read it](https://sand3d.sandflow.ai/gallery.html)):
48
+ the cabinet, the drum, the door with its glass and handle, the detergent drawer and the dial,
49
+ each a named part, and four joints that say how they move.
50
+
51
+ ```python
52
+ door = s3d.group("door", ring, glass, handle) # the handle and the glass move with it
53
+ s3d.joint("door_hinge", door, hinge, axis="-Z", range=(0, 143))
54
+ s3d.joint("drum_spin", drum, front.move(0, 400), kind="continuous")
55
+ s3d.joint("drawer_slide", drawer, top_band.move(150), kind="prismatic", axis="+X", range=(0, 200))
56
+ s3d.joint("dial_turn", dial, top_band.move(-150), kind="continuous")
57
+ return s3d.assembly("washing_machine", cab, drum, door, drawer, dial, front=front)
58
+ ```
59
+
60
+ ## Export: GLB, URDF, USD, OBJ, STL
61
+
62
+ One call; the file's extension names the format; lengths in metres.
63
+
64
+ ```python
65
+ s3d.export(machine, "washer.glb") # or .urdf, .usda, .obj, .stl
66
+ ```
67
+
68
+ | format | what it carries | for |
69
+ |---|---|---|
70
+ | **GLB** | meshes, materials, the joints in each node's extras, at the current pose | the web, viewers, game engines |
71
+ | **URDF** | a link per moving part, its joints and their limits, at rest; OBJ meshes beside it | ROS, PyBullet, MuJoCo, Isaac |
72
+ | **USDA** | the same tree in OpenUSD (UsdGeom, UsdPhysics), with the materials | Omniverse, Isaac Sim, USD pipelines |
73
+ | **OBJ**, **STL** | the meshes alone, at the current pose: OBJ Y up, binary STL Z up | any 3D tool, slicers |
74
+
75
+ `.usd`, `.usdc` and `.usdz` come from the `.usda` through USD's own tools (`usdcat`,
76
+ `usdzip`). The scene is also an ordinary Blender scene, for anything else Blender writes.
77
+
78
+ ## Install
79
+
80
+ Python 3.13 (recommended) or 3.11. Blender comes with it, as the `bpy` module: 5.2 LTS on
81
+ Python 3.13, 4.5 LTS on Python 3.11, the two versions the tests run on.
82
+
83
+ ```bash
84
+ pip install sand3d # or, in a uv project: uv add sand3d
85
+ ```
86
+
87
+ `bpy` has no wheel for Python 3.12, nor for Intel Macs from 5.2 on: there, use Python 3.11.
88
+
89
+ ## A first program
90
+
91
+ <img src="docs/readme/bracket.png" alt="The bracket" width="300" align="right">
92
+
93
+ ```python
94
+ import sand3d as s3d
95
+
96
+ def bracket(w=80, d=40, t=6, hole_d=6.6, pitch=50):
97
+ plate = s3d.extrude("plate", s3d.rect(w, d, r=4), t)
98
+ s3d.hole(plate, hole_d, on=s3d.grid(2, 1, pitch, 0))
99
+ s3d.fillet(plate, 1, edges="top")
100
+ return plate
101
+
102
+ s3d.export(bracket(), "bracket.glb")
103
+ ```
104
+
105
+ Millimetres by default. Every verb with code that runs and its render: [the quickstart](https://sand3d.sandflow.ai/quickstart.html);
106
+ objects to play joint by joint: [the gallery](https://sand3d.sandflow.ai/gallery.html); every signature: [the API](https://sand3d.sandflow.ai/api.html).
107
+ The programs themselves: [docs/examples/](docs/examples/) and [programs/](programs/).
108
+
109
+ ## Give it to your LLM
110
+
111
+ Put [docs/api.md](docs/api.md) in the system prompt: the rules of the vocabulary, every
112
+ signature, and worked examples, in about 3 600 tokens; [llms.txt](llms.txt) points a
113
+ model at it. For objects of several parts, [the guidelines](https://sand3d.sandflow.ai/guidelines.html) give
114
+ the eight rules of an assembly program: the plan first, then the details, then the parts.
115
+
116
+ ## What is in it
117
+
118
+ Everything on one flat `s3d.<verb>` surface:
119
+
120
+ | family | verbs |
121
+ |---|---|
122
+ | profiles | `rect` `circle` `slot` `polygon` `poly` `arc` `spline` `superellipse` `text` `offset` `stroke` … (16) |
123
+ | solids and paths | `extrude` `revolve` `sweep` `loft` `wire` `helix` `box` `cylinder` `tube` `sphere` `torus` `dome` … (15) |
124
+ | edits | `cut` `join` `intersect` `split` `hole` `pocket` `fillet` `chamfer` `shell` `dent` … (15) |
125
+ | frames and placement | `Frame` `face` `edge` `bbox` `local` `at` `transform` `grid` `ring` `along` `snap` |
126
+ | articulation | `joint` `pose` `seat` |
127
+ | assembly | `group` `assembly` `attach` `export` `units` `fingerprint` … (8) |
128
+ | parts and materials | `gear` `knurl` `thread` `material` |
129
+
130
+ No category verbs (`chair()`, `table()`): a category is a program written *in* sand3d.
131
+
132
+ ## Citation
133
+
134
+ If you use sand3d in your work, please cite it. `CITATION.cff` holds the same, and GitHub
135
+ shows it as "Cite this repository".
136
+
137
+ ```bibtex
138
+ @misc{sand3d2026,
139
+ author = {Neveu, Thibault and Loy, Andr{\'e}a},
140
+ title = {sand3d},
141
+ year = {2026},
142
+ note = {Version 1.6.1},
143
+ url = {https://github.com/Sandflow-ai/sand3d}
144
+ }
145
+ ```
146
+
147
+ ## Contributing and license
148
+
149
+ How the library is built, tested and versioned: [CONTRIBUTING.md](CONTRIBUTING.md).
150
+ Apache License 2.0: see [LICENSE](LICENSE).
@@ -0,0 +1,31 @@
1
+ [project]
2
+ name = "sand3d"
3
+ dynamic = ["version"]
4
+ description = "3D modeling in Python, built for LLMs: short programs over Blender's bpy."
5
+ readme = "README.md"
6
+ # bpy ships one CPython per release line: 4.5 LTS for 3.11, 5.2 LTS for 3.13 (none for 3.12).
7
+ # The two lines the suite runs, each on its Python; 5.0 and 5.1 are left out: untested.
8
+ requires-python = ">=3.11,!=3.12.*,<3.14"
9
+ dependencies = [
10
+ "bpy>=4.5,<4.6; python_version == '3.11'",
11
+ "bpy>=5.2,<5.3; python_version == '3.13'",
12
+ ]
13
+ license = "Apache-2.0"
14
+ license-files = ["LICENSE"]
15
+
16
+ [project.urls]
17
+ Homepage = "https://sand3d.sandflow.ai/"
18
+ Documentation = "https://sand3d.sandflow.ai/api.html"
19
+ Repository = "https://github.com/Sandflow-ai/sand3d"
20
+ Issues = "https://github.com/Sandflow-ai/sand3d/issues"
21
+
22
+ [build-system]
23
+ requires = ["setuptools>=77"]
24
+ build-backend = "setuptools.build_meta"
25
+
26
+ [tool.setuptools.dynamic]
27
+ version = {attr = "sand3d.__version__"}
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
31
+ include = ["sand3d*"]
sand3d-1.6.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+