b123D-positioning 1.0.0__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.
@@ -0,0 +1,13 @@
1
+ # nix package
2
+ .direnv/
3
+
4
+ # Python-generated files
5
+ __pycache__/
6
+ *.py[oc]
7
+ build/
8
+ dist/
9
+ wheels/
10
+ *.egg-info
11
+
12
+ # Virtual environments
13
+ .venv
@@ -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.
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: b123D-positioning
3
+ Version: 1.0.0
4
+ Summary: `build123d` ergonomic selector methods
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: build123d>=0.11.0
8
+ Description-Content-Type: text/markdown
9
+
10
+ # b123d_positioning
11
+
12
+ An extension for `build123d` that installs ergonomic methods for face, edge and vertex selection, e.g. `object.vertices().top_front_left()`.
13
+
14
+ ## Usage
15
+
16
+ Importing the module automatically monkey-patches the `build123d.ShapeList` class. Your standard objects will immediately possess the new functionality.
17
+
18
+ ```python
19
+ import b123d_positioning
20
+ from build123d import Box
21
+
22
+ base = Box(10, 10, 10)
23
+
24
+ # Extract a single vertex
25
+ top_left_corner = base.vertices().top_left()
26
+
27
+ # Extract a group of edges
28
+ top_edges = base.edges().all_top()
29
+
30
+ # Extract a face by size
31
+ biggest_face = base.faces().largest()
32
+
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Spatial Selectors
38
+
39
+ Spatial selectors filter shapes based on their bounding box centers relative to the global 3D coordinate system.
40
+
41
+ ### API Grammar
42
+
43
+ The naming convention strictly follows standard CAD axes:
44
+
45
+ * **Z-Axis:** `bottom` / `top`
46
+ * **Y-Axis:** `front` / `back`
47
+ * **X-Axis:** `left` / `right`
48
+
49
+ Methods can target a single axis or chain up to three dimensions (e.g., `bottom_front_left()`).
50
+
51
+ ### Singular vs. Grouped
52
+
53
+ | Prefix | Behavior | Return Type | Examples |
54
+ | --- | --- | --- | --- |
55
+ | *(None)* | Returns the **single** shape at the absolute extreme of the specified vector. | `Shape` | `top()`, `bottom_back()`, `top_front_right()` |
56
+ | `all_` | Returns a **subset** (group) of shapes sharing the specified extreme boundary. | `ShapeList` | `all_top()`, `all_bottom_back()`, `all_top_front_right()` |
57
+
58
+ ### Ambiguity Warnings
59
+ If you use a singular selector (e.g., `.left()`) on a dimension where multiple shapes share the exact same extreme coordinate (like the 4 left-most vertices of a 3D box), `b123d_positioning` will emit a `UserWarning`. It will still return a single arbitrary shape to prevent crashing your script, but alerts you that the selection is mathematically ambiguous. To resolve the warning, switch to an `all_` prefix or use a fully constrained 2D/3D selector.
60
+
61
+ ## Dimensional Selectors
62
+
63
+ Sorts the `ShapeList` based on physical size properties (`.length` for Edges, `.area` for Faces, and `.volume` for Solids).
64
+
65
+ | Method | Description |
66
+ | --- | --- |
67
+ | `largest()` | Returns the single largest shape in the list. |
68
+ | `smallest()` | Returns the single smallest shape in the list. |
69
+
70
+ *Note: Dimensional selectors will raise a `ValueError` if used on `Vertex` objects, as they are dimensionless.*
71
+
72
+ ---
73
+
74
+ ## Technical Notes
75
+
76
+ * **Evaluation Engine:** Under the hood, spatial selectors rely on standard `build123d` bounding box centers. Singular selectors chain `group_by` operations for intermediate axes and conclude with a `sort_by` operation to extract the exact shape. (i.e. `top_front_left` will retrieve the Z-most group, then Y-least group of those, then sort and pull out the X-least instance). Grouped (`all_`) selectors exclusively use `group_by` to return subsets.
@@ -0,0 +1,67 @@
1
+ # b123d_positioning
2
+
3
+ An extension for `build123d` that installs ergonomic methods for face, edge and vertex selection, e.g. `object.vertices().top_front_left()`.
4
+
5
+ ## Usage
6
+
7
+ Importing the module automatically monkey-patches the `build123d.ShapeList` class. Your standard objects will immediately possess the new functionality.
8
+
9
+ ```python
10
+ import b123d_positioning
11
+ from build123d import Box
12
+
13
+ base = Box(10, 10, 10)
14
+
15
+ # Extract a single vertex
16
+ top_left_corner = base.vertices().top_left()
17
+
18
+ # Extract a group of edges
19
+ top_edges = base.edges().all_top()
20
+
21
+ # Extract a face by size
22
+ biggest_face = base.faces().largest()
23
+
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Spatial Selectors
29
+
30
+ Spatial selectors filter shapes based on their bounding box centers relative to the global 3D coordinate system.
31
+
32
+ ### API Grammar
33
+
34
+ The naming convention strictly follows standard CAD axes:
35
+
36
+ * **Z-Axis:** `bottom` / `top`
37
+ * **Y-Axis:** `front` / `back`
38
+ * **X-Axis:** `left` / `right`
39
+
40
+ Methods can target a single axis or chain up to three dimensions (e.g., `bottom_front_left()`).
41
+
42
+ ### Singular vs. Grouped
43
+
44
+ | Prefix | Behavior | Return Type | Examples |
45
+ | --- | --- | --- | --- |
46
+ | *(None)* | Returns the **single** shape at the absolute extreme of the specified vector. | `Shape` | `top()`, `bottom_back()`, `top_front_right()` |
47
+ | `all_` | Returns a **subset** (group) of shapes sharing the specified extreme boundary. | `ShapeList` | `all_top()`, `all_bottom_back()`, `all_top_front_right()` |
48
+
49
+ ### Ambiguity Warnings
50
+ If you use a singular selector (e.g., `.left()`) on a dimension where multiple shapes share the exact same extreme coordinate (like the 4 left-most vertices of a 3D box), `b123d_positioning` will emit a `UserWarning`. It will still return a single arbitrary shape to prevent crashing your script, but alerts you that the selection is mathematically ambiguous. To resolve the warning, switch to an `all_` prefix or use a fully constrained 2D/3D selector.
51
+
52
+ ## Dimensional Selectors
53
+
54
+ Sorts the `ShapeList` based on physical size properties (`.length` for Edges, `.area` for Faces, and `.volume` for Solids).
55
+
56
+ | Method | Description |
57
+ | --- | --- |
58
+ | `largest()` | Returns the single largest shape in the list. |
59
+ | `smallest()` | Returns the single smallest shape in the list. |
60
+
61
+ *Note: Dimensional selectors will raise a `ValueError` if used on `Vertex` objects, as they are dimensionless.*
62
+
63
+ ---
64
+
65
+ ## Technical Notes
66
+
67
+ * **Evaluation Engine:** Under the hood, spatial selectors rely on standard `build123d` bounding box centers. Singular selectors chain `group_by` operations for intermediate axes and conclude with a `sort_by` operation to extract the exact shape. (i.e. `top_front_left` will retrieve the Z-most group, then Y-least group of those, then sort and pull out the X-least instance). Grouped (`all_`) selectors exclusively use `group_by` to return subsets.
@@ -0,0 +1,263 @@
1
+ """
2
+ Extends Build123d ShapeLists with spatial and dimensional selection shortcuts,
3
+ allowing natural and more ergonomic selectors
4
+
5
+ Usage:
6
+ import b123d_positioning
7
+ # ShapeList is patched globally upon import.
8
+ """
9
+
10
+ from typing import Any
11
+ import warnings
12
+ from build123d import ShapeList, Axis, Vertex, Edge, Face, Solid
13
+
14
+ FIRST = 0
15
+ LAST = -1
16
+
17
+
18
+ def _get_size(shape: Any) -> float:
19
+ """
20
+ Evaluates the physical size of a shape dynamically based on its class type.
21
+
22
+ Args:
23
+ shape (Any): A build123d Edge, Face, or Solid.
24
+
25
+ Returns:
26
+ float: The length, area, or volume of the shape.
27
+
28
+ Raises:
29
+ ValueError: If the shape is dimensionless (e.g., a Vertex) or unsupported.
30
+ """
31
+ match shape:
32
+ case Edge():
33
+ return shape.length
34
+ case Face():
35
+ return shape.area
36
+ case Solid():
37
+ return shape.volume
38
+ case _:
39
+ raise ValueError(
40
+ f"Size operations not supported for {type(shape).__name__}."
41
+ )
42
+
43
+
44
+ def _select(
45
+ shapes: ShapeList, *directives: tuple[Axis, int], group: bool = False
46
+ ) -> Any:
47
+ """
48
+ Core engine for spatial selections.
49
+
50
+ Args:
51
+ shapes (ShapeList): The list of shapes to filter.
52
+ directives (tuple[Axis, int]): A sequence of Axis and Index (FIRST/LAST) instructions.
53
+ single (bool):
54
+ If True, uses sort_by for the final directive to return a single shape.
55
+ If False, uses group_by for all directives to return a grouped ShapeList.
56
+
57
+ Returns:
58
+ Any: A single Shape (if single=True) or a ShapeList (if single=False).
59
+ """
60
+ if not shapes:
61
+ return shapes
62
+
63
+ result = shapes
64
+ for i, (axis, idx) in enumerate(directives):
65
+ groups = result.group_by(axis)
66
+ extreme_group = groups[idx]
67
+
68
+ if not group and i == len(directives) - 1:
69
+ if len(extreme_group) > 1:
70
+ warnings.warn(
71
+ f"Ambiguous selection: You asked for a single shape, but the current geometry "
72
+ f"makes this ambiguous ({len(extreme_group)} shapes share this exact boundary). "
73
+ f"Returning an arbitrary shape. To fix this, use an 'all_' prefix to select the "
74
+ f"entire group, or chain more axes (e.g., 'top_left()') to narrow it down.",
75
+ UserWarning,
76
+ stacklevel=3
77
+ )
78
+ # Return a single shape from the tied group (mimics default OCCT fallback)
79
+ return extreme_group[idx]
80
+ else:
81
+ # Continue filtering the subset
82
+ result = extreme_group
83
+
84
+ return result
85
+
86
+
87
+ def largest(self: ShapeList) -> Any:
88
+ """Returns the largest shape in the list based on length, area, or volume."""
89
+ return sorted(self, key=_get_size)[LAST] if self else self
90
+
91
+
92
+ def smallest(self: ShapeList) -> Any:
93
+ """Returns the smallest shape in the list based on length, area, or volume."""
94
+ return sorted(self, key=_get_size)[FIRST] if self else self
95
+
96
+
97
+ ShapeList.largest = largest
98
+ ShapeList.smallest = smallest
99
+
100
+
101
+ # ==========================================
102
+ # SPATIAL EXPLICIT INTERFACE
103
+ # ==========================================
104
+ # Z-Axis: bottom (FIRST), top (LAST)
105
+ # Y-Axis: front (FIRST), back (LAST)
106
+ # X-Axis: left (FIRST), right (LAST)
107
+
108
+ # --- 1D Shortcuts (Single Axis) ---
109
+ ShapeList.bottom = lambda self: _select(self, (Axis.Z, FIRST))
110
+ ShapeList.all_bottom = lambda self: _select(self, (Axis.Z, FIRST), group=True)
111
+
112
+ ShapeList.top = lambda self: _select(self, (Axis.Z, LAST))
113
+ ShapeList.all_top = lambda self: _select(self, (Axis.Z, LAST), group=True)
114
+
115
+ ShapeList.front = lambda self: _select(self, (Axis.Y, FIRST))
116
+ ShapeList.all_front = lambda self: _select(self, (Axis.Y, FIRST), group=True)
117
+
118
+ ShapeList.back = lambda self: _select(self, (Axis.Y, LAST))
119
+ ShapeList.all_back = lambda self: _select(self, (Axis.Y, LAST), group=True)
120
+
121
+ ShapeList.left = lambda self: _select(self, (Axis.X, FIRST))
122
+ ShapeList.all_left = lambda self: _select(self, (Axis.X, FIRST), group=True)
123
+
124
+ ShapeList.right = lambda self: _select(self, (Axis.X, LAST))
125
+ ShapeList.all_right = lambda self: _select(self, (Axis.X, LAST), group=True)
126
+
127
+
128
+ # --- 2D Shortcuts (Double Axis) ---
129
+ ShapeList.bottom_front = lambda self: _select(
130
+ self, (Axis.Z, FIRST), (Axis.Y, FIRST)
131
+ )
132
+ ShapeList.all_bottom_front = lambda self: _select(
133
+ self, (Axis.Z, FIRST), (Axis.Y, FIRST), group=True
134
+ )
135
+
136
+ ShapeList.bottom_back = lambda self: _select(
137
+ self, (Axis.Z, FIRST), (Axis.Y, LAST)
138
+ )
139
+ ShapeList.all_bottom_back = lambda self: _select(
140
+ self, (Axis.Z, FIRST), (Axis.Y, LAST), group=True
141
+ )
142
+
143
+ ShapeList.bottom_left = lambda self: _select(
144
+ self, (Axis.Z, FIRST), (Axis.X, FIRST)
145
+ )
146
+ ShapeList.all_bottom_left = lambda self: _select(
147
+ self, (Axis.Z, FIRST), (Axis.X, FIRST), group=True
148
+ )
149
+
150
+ ShapeList.bottom_right = lambda self: _select(
151
+ self, (Axis.Z, FIRST), (Axis.X, LAST)
152
+ )
153
+ ShapeList.all_bottom_right = lambda self: _select(
154
+ self, (Axis.Z, FIRST), (Axis.X, LAST), group=True
155
+ )
156
+
157
+ ShapeList.top_front = lambda self: _select(
158
+ self, (Axis.Z, LAST), (Axis.Y, FIRST)
159
+ )
160
+ ShapeList.all_top_front = lambda self: _select(
161
+ self, (Axis.Z, LAST), (Axis.Y, FIRST), group=True
162
+ )
163
+
164
+ ShapeList.top_back = lambda self: _select(self, (Axis.Z, LAST), (Axis.Y, LAST))
165
+ ShapeList.all_top_back = lambda self: _select(
166
+ self, (Axis.Z, LAST), (Axis.Y, LAST), group=True
167
+ )
168
+
169
+ ShapeList.top_left = lambda self: _select(self, (Axis.Z, LAST), (Axis.X, FIRST))
170
+ ShapeList.all_top_left = lambda self: _select(
171
+ self, (Axis.Z, LAST), (Axis.X, FIRST), group=True
172
+ )
173
+
174
+ ShapeList.top_right = lambda self: _select(self, (Axis.Z, LAST), (Axis.X, LAST))
175
+ ShapeList.all_top_right = lambda self: _select(
176
+ self, (Axis.Z, LAST), (Axis.X, LAST), group=True
177
+ )
178
+
179
+ ShapeList.front_left = lambda self: _select(
180
+ self, (Axis.Y, FIRST), (Axis.X, FIRST)
181
+ )
182
+ ShapeList.all_front_left = lambda self: _select(
183
+ self, (Axis.Y, FIRST), (Axis.X, FIRST), group=True
184
+ )
185
+
186
+ ShapeList.front_right = lambda self: _select(
187
+ self, (Axis.Y, FIRST), (Axis.X, LAST)
188
+ )
189
+ ShapeList.all_front_right = lambda self: _select(
190
+ self, (Axis.Y, FIRST), (Axis.X, LAST), group=True
191
+ )
192
+
193
+ ShapeList.back_left = lambda self: _select(
194
+ self, (Axis.Y, LAST), (Axis.X, FIRST)
195
+ )
196
+ ShapeList.all_back_left = lambda self: _select(
197
+ self, (Axis.Y, LAST), (Axis.X, FIRST), group=True
198
+ )
199
+
200
+ ShapeList.back_right = lambda self: _select(
201
+ self, (Axis.Y, LAST), (Axis.X, LAST)
202
+ )
203
+ ShapeList.all_back_right = lambda self: _select(
204
+ self, (Axis.Y, LAST), (Axis.X, LAST), group=True
205
+ )
206
+
207
+
208
+ # --- 3D Shortcuts (Triple Axis) ---
209
+ ShapeList.bottom_front_left = lambda self: _select(
210
+ self, (Axis.Z, FIRST), (Axis.Y, FIRST), (Axis.X, FIRST)
211
+ )
212
+ ShapeList.all_bottom_front_left = lambda self: _select(
213
+ self, (Axis.Z, FIRST), (Axis.Y, FIRST), (Axis.X, FIRST), group=True
214
+ )
215
+
216
+ ShapeList.bottom_front_right = lambda self: _select(
217
+ self, (Axis.Z, FIRST), (Axis.Y, FIRST), (Axis.X, LAST)
218
+ )
219
+ ShapeList.all_bottom_front_right = lambda self: _select(
220
+ self, (Axis.Z, FIRST), (Axis.Y, FIRST), (Axis.X, LAST), group=True
221
+ )
222
+
223
+ ShapeList.bottom_back_left = lambda self: _select(
224
+ self, (Axis.Z, FIRST), (Axis.Y, LAST), (Axis.X, FIRST)
225
+ )
226
+ ShapeList.all_bottom_back_left = lambda self: _select(
227
+ self, (Axis.Z, FIRST), (Axis.Y, LAST), (Axis.X, FIRST), group=True
228
+ )
229
+
230
+ ShapeList.bottom_back_right = lambda self: _select(
231
+ self, (Axis.Z, FIRST), (Axis.Y, LAST), (Axis.X, LAST)
232
+ )
233
+ ShapeList.all_bottom_back_right = lambda self: _select(
234
+ self, (Axis.Z, FIRST), (Axis.Y, LAST), (Axis.X, LAST), group=True
235
+ )
236
+
237
+ ShapeList.top_front_left = lambda self: _select(
238
+ self, (Axis.Z, LAST), (Axis.Y, FIRST), (Axis.X, FIRST)
239
+ )
240
+ ShapeList.all_top_front_left = lambda self: _select(
241
+ self, (Axis.Z, LAST), (Axis.Y, FIRST), (Axis.X, FIRST), group=True
242
+ )
243
+
244
+ ShapeList.top_front_right = lambda self: _select(
245
+ self, (Axis.Z, LAST), (Axis.Y, FIRST), (Axis.X, LAST)
246
+ )
247
+ ShapeList.all_top_front_right = lambda self: _select(
248
+ self, (Axis.Z, LAST), (Axis.Y, FIRST), (Axis.X, LAST), group=True
249
+ )
250
+
251
+ ShapeList.top_back_left = lambda self: _select(
252
+ self, (Axis.Z, LAST), (Axis.Y, LAST), (Axis.X, FIRST)
253
+ )
254
+ ShapeList.all_top_back_left = lambda self: _select(
255
+ self, (Axis.Z, LAST), (Axis.Y, LAST), (Axis.X, FIRST), group=True
256
+ )
257
+
258
+ ShapeList.top_back_right = lambda self: _select(
259
+ self, (Axis.Z, LAST), (Axis.Y, LAST), (Axis.X, LAST)
260
+ )
261
+ ShapeList.all_top_back_right = lambda self: _select(
262
+ self, (Axis.Z, LAST), (Axis.Y, LAST), (Axis.X, LAST), group=True
263
+ )
@@ -0,0 +1,23 @@
1
+ [project]
2
+ name = "b123D-positioning"
3
+ version = "1.0.0"
4
+ description = "`build123d` ergonomic selector methods"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ dependencies = [
8
+ "build123d>=0.11.0",
9
+ ]
10
+
11
+ [dependency-groups]
12
+ dev = [
13
+ "pytest>=7.0.0",
14
+ ]
15
+
16
+ [build-system]
17
+ requires = ["hatchling"]
18
+ build-backend = "hatchling.build"
19
+
20
+ [tool.hatch.build]
21
+ include = [
22
+ "b123d_positioning.py"
23
+ ]