b3dkit 0.1.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.
Files changed (53) hide show
  1. b3dkit-0.1.0/.coverage +0 -0
  2. b3dkit-0.1.0/.coveragerc +6 -0
  3. b3dkit-0.1.0/.gitignore +170 -0
  4. b3dkit-0.1.0/.vscode/settings.json +17 -0
  5. b3dkit-0.1.0/LICENSE +7 -0
  6. b3dkit-0.1.0/PKG-INFO +54 -0
  7. b3dkit-0.1.0/README.md +28 -0
  8. b3dkit-0.1.0/build.bat +44 -0
  9. b3dkit-0.1.0/build.sh +44 -0
  10. b3dkit-0.1.0/docs/Makefile +20 -0
  11. b3dkit-0.1.0/docs/antichamfer.md +64 -0
  12. b3dkit-0.1.0/docs/ball_socket.md +79 -0
  13. b3dkit-0.1.0/docs/basic_shapes.md +305 -0
  14. b3dkit-0.1.0/docs/bolt_fittings.md +214 -0
  15. b3dkit-0.1.0/docs/click_fit.md +7 -0
  16. b3dkit-0.1.0/docs/conf.py +124 -0
  17. b3dkit-0.1.0/docs/dovetail.md +81 -0
  18. b3dkit-0.1.0/docs/dovetail.png +0 -0
  19. b3dkit-0.1.0/docs/hexwall.md +50 -0
  20. b3dkit-0.1.0/docs/high_top_slide_box.md +218 -0
  21. b3dkit-0.1.0/docs/index.md +1 -0
  22. b3dkit-0.1.0/docs/point.md +95 -0
  23. b3dkit-0.1.0/docs/slide_box.md +285 -0
  24. b3dkit-0.1.0/docs/twist_snap.md +69 -0
  25. b3dkit-0.1.0/docs/twist_snap.png +0 -0
  26. b3dkit-0.1.0/mkdocs.yml +32 -0
  27. b3dkit-0.1.0/mkdocs_new.yml +29 -0
  28. b3dkit-0.1.0/pyproject.toml +49 -0
  29. b3dkit-0.1.0/readthedocs.yaml +16 -0
  30. b3dkit-0.1.0/src/b3dkit/__init__.py +10 -0
  31. b3dkit-0.1.0/src/b3dkit/antichamfer.py +79 -0
  32. b3dkit-0.1.0/src/b3dkit/ball_socket.py +177 -0
  33. b3dkit-0.1.0/src/b3dkit/basic_shapes.py +397 -0
  34. b3dkit-0.1.0/src/b3dkit/bolt_fittings.py +351 -0
  35. b3dkit-0.1.0/src/b3dkit/click_fit.py +78 -0
  36. b3dkit-0.1.0/src/b3dkit/dovetail.py +1338 -0
  37. b3dkit-0.1.0/src/b3dkit/hexwall.py +102 -0
  38. b3dkit-0.1.0/src/b3dkit/high_top_slide_box.py +504 -0
  39. b3dkit-0.1.0/src/b3dkit/point.py +196 -0
  40. b3dkit-0.1.0/src/b3dkit/slide_box.py +210 -0
  41. b3dkit-0.1.0/src/b3dkit/twist_snap.py +302 -0
  42. b3dkit-0.1.0/tests/conftest.py +14 -0
  43. b3dkit-0.1.0/tests/test_antichamfer.py +426 -0
  44. b3dkit-0.1.0/tests/test_ball_socket.py +249 -0
  45. b3dkit-0.1.0/tests/test_basic_shapes.py +237 -0
  46. b3dkit-0.1.0/tests/test_bolt_fittings.py +538 -0
  47. b3dkit-0.1.0/tests/test_click_fit.py +37 -0
  48. b3dkit-0.1.0/tests/test_dovetail.py +374 -0
  49. b3dkit-0.1.0/tests/test_hexwall.py +30 -0
  50. b3dkit-0.1.0/tests/test_high_top_slide_box.py +347 -0
  51. b3dkit-0.1.0/tests/test_point.py +144 -0
  52. b3dkit-0.1.0/tests/test_slide_box.py +37 -0
  53. b3dkit-0.1.0/tests/test_twist_snap.py +46 -0
b3dkit-0.1.0/.coverage ADDED
Binary file
@@ -0,0 +1,6 @@
1
+ [run]
2
+ omit =
3
+ *test*
4
+ *conftest*
5
+ [report]
6
+ show_missing = True
@@ -0,0 +1,170 @@
1
+ # any test 3d binaries
2
+ *.stl
3
+ *.step
4
+
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ .pybuilder/
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # pyenv
90
+ # For a library or package, you might want to ignore these files since the code is
91
+ # intended to run in multiple environments; otherwise, check them in:
92
+ # .python-version
93
+
94
+ # pipenv
95
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
97
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
98
+ # install all needed dependencies.
99
+ #Pipfile.lock
100
+
101
+ # poetry
102
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
104
+ # commonly ignored for libraries.
105
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106
+ #poetry.lock
107
+
108
+ # pdm
109
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110
+ #pdm.lock
111
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112
+ # in version control.
113
+ # https://pdm.fming.dev/#use-with-ide
114
+ .pdm.toml
115
+
116
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117
+ __pypackages__/
118
+
119
+ # Celery stuff
120
+ celerybeat-schedule
121
+ celerybeat.pid
122
+
123
+ # SageMath parsed files
124
+ *.sage.py
125
+
126
+ # Environments
127
+ .env
128
+ .venv
129
+ env/
130
+ venv/
131
+ ENV/
132
+ env.bak/
133
+ venv.bak/
134
+
135
+ # Spyder project settings
136
+ .spyderproject
137
+ .spyproject
138
+
139
+ # Rope project settings
140
+ .ropeproject
141
+
142
+ # mkdocs documentation
143
+ /site
144
+
145
+ # mypy
146
+ .mypy_cache/
147
+ .dmypy.json
148
+ dmypy.json
149
+
150
+ # Pyre type checker
151
+ .pyre/
152
+
153
+ # pytype static type analyzer
154
+ .pytype/
155
+
156
+ # Cython debug symbols
157
+ cython_debug/
158
+
159
+ # PyCharm
160
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
161
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
162
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
163
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
164
+ #.idea/
165
+
166
+ #VS Code Counter
167
+ .VSCodeCounter/
168
+
169
+ # MacOS desktop files
170
+ **/.DS_Store
@@ -0,0 +1,17 @@
1
+ {
2
+ "python.testing.pytestArgs": [
3
+ "tests"
4
+ ],
5
+ "python.testing.unittestEnabled": false,
6
+ "python.testing.pytestEnabled": true,
7
+ "cSpell.words": [
8
+ "Automatable",
9
+ "dataclass",
10
+ "dataclasses",
11
+ "getcwd",
12
+ "kwargs",
13
+ "partomate",
14
+ "partomatic"
15
+ ],
16
+ "python-envs.pythonProjects": []
17
+ }
b3dkit-0.1.0/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2024 Christopher Litsinger
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
b3dkit-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: b3dkit
3
+ Version: 0.1.0
4
+ Summary: build123d libraries and utilities
5
+ Project-URL: Homepage, https://github.com/x0pherl/b3dkit
6
+ Project-URL: Issues, https://github.com/x0pherl/b3dkit/issues
7
+ Project-URL: Documentation, https://b3dkit.readthedocs.org
8
+ Author: x0pherl
9
+ License-File: LICENSE
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.8
14
+ Requires-Dist: build123d>=0.0.1
15
+ Requires-Dist: ocp-vscode
16
+ Provides-Extra: dev
17
+ Requires-Dist: build; extra == 'dev'
18
+ Requires-Dist: hatchling; extra == 'dev'
19
+ Requires-Dist: pytest; extra == 'dev'
20
+ Requires-Dist: pytest-cov; extra == 'dev'
21
+ Provides-Extra: docs
22
+ Requires-Dist: markdown-include; extra == 'docs'
23
+ Requires-Dist: mkdocs; extra == 'docs'
24
+ Requires-Dist: mkdocs-material; extra == 'docs'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # b3dkit Overview
28
+
29
+ b3dkit is a general purpose library extending some of [build123d](https://github.com/gumyr/build123d)'s Parts and adding handy utility functions.
30
+
31
+ It's grown to include some capabilities not required by that project. Useful components include:
32
+
33
+ - dovetail: Splits a build123d `Part` object into two parts that can easily be slid together with very tight tolerances. Useful when building parts larger than your printer's build volume. This includes a "snugtail" type that is uniquely suited to 3d printing and results in very strong bonds with a high surface area for friction to hold it in place, or glue to bond.
34
+ - click_fit: a tapered profile that allows for better printing & assembly than a simple half Sphere to allow parts to "click" or snap into place when fit together. The extruded shape and the socket are both shaped carefully to allow a mix of easy assembly and good hold.
35
+ - Point: a lightweight X,Y coordinate point object with some geometric functions built into the object.
36
+ - HexWall: builds a field of hexagons with gaps in-between within a given set of bounds.
37
+
38
+ # Documentation
39
+
40
+ Complete developer documentation for b3dkit is maintained in the docs folder and on the [b3dkit documentation](https://b3dkit.readthedocs.io) site.
41
+
42
+ # Fork from fb-lbrary
43
+
44
+ The b3dkit library began as a library specific to [Fender-Bender](https://github.com/x0pherl/fender-bender): a way to externalize and isolate some common utilities, functions, & methods from the project. It has since grown to include many parts and utilities that are not used by fender-bender. As part of a major rewrite to adhere method names and usage to feel more like Build123d native usage, we've forked and renamed the project to b3dkit, to better reflect our current purpose.
45
+
46
+
47
+ # Modifying the Source
48
+ The included source files rely on the build123d library. I recommend following the build123d installation instructions.
49
+
50
+ # Contributing
51
+ Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
52
+
53
+ # License
54
+ This project is licensed under the terms of the [MIT](https://choosealicense.com/licenses/mit/) license
b3dkit-0.1.0/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # b3dkit Overview
2
+
3
+ b3dkit is a general purpose library extending some of [build123d](https://github.com/gumyr/build123d)'s Parts and adding handy utility functions.
4
+
5
+ It's grown to include some capabilities not required by that project. Useful components include:
6
+
7
+ - dovetail: Splits a build123d `Part` object into two parts that can easily be slid together with very tight tolerances. Useful when building parts larger than your printer's build volume. This includes a "snugtail" type that is uniquely suited to 3d printing and results in very strong bonds with a high surface area for friction to hold it in place, or glue to bond.
8
+ - click_fit: a tapered profile that allows for better printing & assembly than a simple half Sphere to allow parts to "click" or snap into place when fit together. The extruded shape and the socket are both shaped carefully to allow a mix of easy assembly and good hold.
9
+ - Point: a lightweight X,Y coordinate point object with some geometric functions built into the object.
10
+ - HexWall: builds a field of hexagons with gaps in-between within a given set of bounds.
11
+
12
+ # Documentation
13
+
14
+ Complete developer documentation for b3dkit is maintained in the docs folder and on the [b3dkit documentation](https://b3dkit.readthedocs.io) site.
15
+
16
+ # Fork from fb-lbrary
17
+
18
+ The b3dkit library began as a library specific to [Fender-Bender](https://github.com/x0pherl/fender-bender): a way to externalize and isolate some common utilities, functions, & methods from the project. It has since grown to include many parts and utilities that are not used by fender-bender. As part of a major rewrite to adhere method names and usage to feel more like Build123d native usage, we've forked and renamed the project to b3dkit, to better reflect our current purpose.
19
+
20
+
21
+ # Modifying the Source
22
+ The included source files rely on the build123d library. I recommend following the build123d installation instructions.
23
+
24
+ # Contributing
25
+ Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
26
+
27
+ # License
28
+ This project is licensed under the terms of the [MIT](https://choosealicense.com/licenses/mit/) license
b3dkit-0.1.0/build.bat ADDED
@@ -0,0 +1,44 @@
1
+ @echo off
2
+ setlocal
3
+
4
+
5
+ SET PROJECT_NAME=b3dkit
6
+
7
+ SET /P PYTEST_CHOSEN=Do you want to run pytest --cov ([Y]/N)?
8
+ IF /I "%PYTEST_CHOSEN%" NEQ "N" GOTO TEST
9
+ GOTO BUILD
10
+
11
+ :TEST
12
+ pytest --cov
13
+
14
+ SET /P PYTEST_CLEAN=Based on the pytest results, proceed with the build? ([Y]/N)?
15
+ IF /I "%PYTEST_CLEAN%" NEQ "N" GOTO BUILD
16
+
17
+ GOTO END
18
+
19
+ :BUILD
20
+ py -m pip uninstall -y %PROJECT_NAME%
21
+ del /F /Q dist\*.*
22
+
23
+ py -m build
24
+ py -m pip install -e .
25
+
26
+ :TESTLOCAL
27
+ python -c "exec(\"from b3dkit import dovetail_subpart, click_fit, Point, shifted_midpoint\nprint(shifted_midpoint(Point(0,0), Point(10,10),0))\")"
28
+
29
+
30
+ SET /P PYPI_UPLOAD=Based on that simple test, upload to pypi? ([Y]/N)?
31
+ IF /I "%PYPI_UPLOAD%" NEQ "N" GOTO UPLOAD
32
+
33
+ GOTO END
34
+
35
+ :UPLOAD
36
+ py -m twine upload dist/*
37
+ py -m pip uninstall -y b3dkit
38
+ py -m pip install b3dkit
39
+ python -c "exec(\"from b3dkit import dovetail_subpart, click_fit, Point, shifted_midpoint\nprint(shifted_midpoint(Point(0,0), Point(10,10),0))\")"
40
+
41
+ ECHO "REMINDER!!! Commit and push git changes!!!"
42
+
43
+ :END
44
+ endlocal
b3dkit-0.1.0/build.sh ADDED
@@ -0,0 +1,44 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ PROJECT_NAME="b3dkit"
6
+ # Define the test command as a variable
7
+ TEST_CMD="from b3dkit import Divot; print(f'Divot test valid?: {Divot().is_valid}')"
8
+ # Define sleep time for PyPI availability
9
+ PYPI_WAIT_TIME=30
10
+
11
+ read -p "Do you want to run pytest --cov ([Y]/N)? " PYTEST_CHOSEN
12
+ PYTEST_CHOSEN=${PYTEST_CHOSEN:-Y}
13
+ if [[ "$PYTEST_CHOSEN" =~ ^[Yy]$ ]]; then
14
+ pytest --cov
15
+ read -p "Based on the pytest results, proceed with the build? ([Y]/N)? " PYTEST_CLEAN
16
+ PYTEST_CLEAN=${PYTEST_CLEAN:-Y}
17
+ if [[ ! "$PYTEST_CLEAN" =~ ^[Yy]$ ]]; then
18
+ echo "Build aborted."
19
+ exit 0
20
+ fi
21
+ fi
22
+
23
+ # Build process
24
+ pip3 uninstall -y "$PROJECT_NAME" || true
25
+ rm -rf dist/*
26
+
27
+ python3 -m build
28
+ pip3 install -e .
29
+
30
+ # # Local testß
31
+ python3 -c "$TEST_CMD"
32
+
33
+ read -p "Based on that simple test, upload to PyPI? ([Y]/N)? " PYPI_UPLOAD
34
+ PYPI_UPLOAD=${PYPI_UPLOAD:-Y}
35
+ if [[ "$PYPI_UPLOAD" =~ ^[Yy]$ ]]; then
36
+ python3 -m twine upload dist/*
37
+ pip3 uninstall -y "$PROJECT_NAME" || true
38
+ sleep $PYPI_WAIT_TIME
39
+ pip3 install "$PROJECT_NAME"
40
+ python3 -c "$TEST_CMD"
41
+ echo "REMINDER!!! Commit and push git changes!!!"
42
+ else
43
+ echo "Upload to PyPI skipped."
44
+ fi
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = .
9
+ BUILDDIR = _build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,64 @@
1
+ # Anti Chamfer Module Documentation
2
+
3
+ ## Overview
4
+
5
+ The `antichamfer` module provides functionality to create anti-chamfers. An anti-chamfer extends outward from a face, similar to a foot or flat crown molding, rather than cutting inward like a traditional chamfer. This is useful for creating bases, flanges, or decorative edges that extend beyond the original part geometry.
6
+
7
+ ## Functions
8
+
9
+ ### anti_chamfer
10
+
11
+ #### arguments
12
+
13
+ - length: the depth of the anti-chamfer (how far to offset inward from the original face)
14
+ - length2: the width of the taper at the bottom (optional, defaults to length if not specified)
15
+ - face: the face or faces to apply the anti-chamfer to (can be a single Face or an iterable of Faces)
16
+
17
+ The function creates a tapered extrusion that extends outward from the specified faces. The taper angle is calculated based on the ratio of length2 to length, creating different bevel profiles depending on these values.
18
+
19
+ ## Usage Notes
20
+
21
+ - When length2 is not specified, the anti-chamfer creates a 45-degree bevel
22
+ - When length2 is smaller than length, the bevel is steeper (more vertical)
23
+ - When length2 is larger than length, the bevel is more gradual (more horizontal)
24
+ - The function automatically handles both single Face objects and collections of faces
25
+
26
+ ## Example
27
+ ```python
28
+ from build123d import (
29
+ Align,
30
+ Axis,
31
+ Box,
32
+ BuildPart,
33
+ Location,
34
+ fillet,
35
+ )
36
+ from b3dkit.antichamfer import anti_chamfer
37
+
38
+ # Create a basic box
39
+ with BuildPart() as base_part:
40
+ Box(20, 20, 10, align=(Align.CENTER, Align.CENTER, Align.MIN))
41
+
42
+ # Apply anti-chamfer to the top face with equal length values (45-degree bevel)
43
+ result = anti_chamfer(
44
+ base_part.faces().filter_by(Axis.Z)[-1], # top face
45
+ 2.0, # length
46
+ 2.0, # length2
47
+
48
+ )
49
+
50
+ # Apply anti-chamfer to multiple faces with different taper
51
+ with BuildPart() as complex_part:
52
+ Box(30, 15, 8)
53
+ fillet(complex_part.edges().filter_by(Axis.Z), 1)
54
+
55
+ # Anti-chamfer on top and bottom faces with steeper taper
56
+ anti_chamfered = anti_chamfer(
57
+ [
58
+ complex_part.faces().filter_by(Axis.Z)[-1], # top
59
+ complex_part.faces().filter_by(Axis.Z)[0] # bottom
60
+ ],
61
+ 1.5, # length
62
+ 0.8, # length2 - Creates steeper angle
63
+ )
64
+ ```
@@ -0,0 +1,79 @@
1
+ # Ball Socket
2
+
3
+ # Ball Socket Joint System Documentation
4
+
5
+ ## Overview
6
+
7
+ The ball socket joint components are designed to create flexible connections between 3D printed parts that require multi-axis rotation. This system consists of two complementary components: a ball mount and a ball socket. The ball mount is a ball attached to a shaft, while the ball socket provides a cavity with flexible walls that grip the ball while allowing smooth rotation.
8
+
9
+ This joint system is particularly useful for creating articulated mechanisms, adjustable brackets, camera mounts, robotic joints, or any application where you need a connection that can rotate freely in multiple directions while maintaining a somewhat secure hold.
10
+
11
+ The `BallMount` and `BallSocket` classes create matched components with built-in tolerances for 3D printing.
12
+
13
+ ## Classes
14
+
15
+ ### BallMount
16
+
17
+ Part Object: BallMount
18
+
19
+ Creates a mounting point for a BallSocket, defined by the radius of the ball.
20
+
21
+ ## Arguments
22
+
23
+ - `ball_radius` (float): The radius of the spherical ball in millimeters. This determines the overall size of the joint system and must match the ball_radius used for the corresponding ball_socket.
24
+ - `rotation` (RotationLike, optional): angles to rotate about axes. Defaults to (0, 0, 0)
25
+ - `align` (Align | tuple[Align, Align, Align] | None, optional): align MIN, CENTER,
26
+ or MAX of object. Defaults to (Align.CENTER, Align.CENTER, Align.CENTER)
27
+ - `mode` (Mode, optional): combine mode. Defaults to Mode.ADD
28
+
29
+
30
+ ### BallSocket
31
+
32
+ Part Object: BallMount
33
+
34
+ Creates a ball socket component for a ball-and-socket joint system, defined by the ball radius, wall_thickness, and tolerance.
35
+
36
+ ## Arguments
37
+
38
+ - `ball_radius` (float): The radius of the spherical ball that will be inserted into this socket, in millimeters. Must match the ball_radius of the corresponding ball_mount for proper fit.
39
+ - `wall_thickness` (float, default=2): The thickness of the socket walls in millimeters. Affects both strength and flexibility. Thicker walls provide more strength but may reduce flexibility. Recommended range: 1.5-3mm.
40
+ - `tolerance` (float, default=0.1): Additional clearance around the ball in millimeters. Positive values create looser fits, negative values create tighter fits. Typical range: 0.05-0.2mm.
41
+ - `rotation` (RotationLike, optional): angles to rotate about axes. Defaults to (0, 0, 0)
42
+ - `align` (Align | tuple[Align, Align, Align] | None, optional): align MIN, CENTER,
43
+ or MAX of object. Defaults to (Align.CENTER, Align.CENTER, Align.CENTER)
44
+ - `mode` (Mode, optional): combine mode. Defaults to Mode.ADD
45
+
46
+
47
+ ## Example Usage
48
+
49
+ ```python
50
+ from b3dkit.ball_socket import BallMount, BallSocket
51
+
52
+ # Create a basic ball joint system with 15mm radius
53
+ mount = BallMount(15.0)
54
+ socket = BallSocket(15.0)
55
+
56
+ # Create a tighter-fitting joint with thicker walls
57
+ precision_mount = BallMount(12.0)
58
+ precision_socket = BallSocket(
59
+ ball_radius=12.0,
60
+ wall_thickness=2.5,
61
+ tolerance=0.05
62
+ )
63
+
64
+ # Create a looser joint for easy assembly
65
+ loose_mount = BallMount(10.0)
66
+ loose_socket = BallSocket(
67
+ ball_radius=10.0,
68
+ wall_thickness=2.0,
69
+ tolerance=0.15
70
+ )
71
+
72
+ # For heavy-duty applications
73
+ heavy_duty_mount = BallMount(20.0)
74
+ heavy_duty_socket = BallSocket(
75
+ ball_radius=20.0,
76
+ wall_thickness=4.0,
77
+ tolerance=0.1
78
+ )
79
+ ```