fdmguard 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.
- fdmguard-0.1.0/.github/workflows/ci.yml +37 -0
- fdmguard-0.1.0/.github/workflows/release.yml +42 -0
- fdmguard-0.1.0/.gitignore +9 -0
- fdmguard-0.1.0/CHANGELOG.md +19 -0
- fdmguard-0.1.0/LICENSE +202 -0
- fdmguard-0.1.0/PKG-INFO +339 -0
- fdmguard-0.1.0/README.md +313 -0
- fdmguard-0.1.0/docs/DESIGN.md +301 -0
- fdmguard-0.1.0/docs/PRIOR_ART.md +78 -0
- fdmguard-0.1.0/docs/insertion_sweep.png +0 -0
- fdmguard-0.1.0/examples/make_examples.py +25 -0
- fdmguard-0.1.0/examples/make_figures.py +86 -0
- fdmguard-0.1.0/examples/run_examples.sh +52 -0
- fdmguard-0.1.0/examples/tradeoff_block.yaml +79 -0
- fdmguard-0.1.0/pyproject.toml +48 -0
- fdmguard-0.1.0/skills/fdmguard/SKILL.md +133 -0
- fdmguard-0.1.0/src/fdmguard/__init__.py +6 -0
- fdmguard-0.1.0/src/fdmguard/__main__.py +5 -0
- fdmguard-0.1.0/src/fdmguard/cli.py +286 -0
- fdmguard-0.1.0/src/fdmguard/geometry.py +137 -0
- fdmguard-0.1.0/src/fdmguard/holes.py +102 -0
- fdmguard-0.1.0/src/fdmguard/insertion.py +380 -0
- fdmguard-0.1.0/src/fdmguard/necks.py +108 -0
- fdmguard-0.1.0/src/fdmguard/stability.py +147 -0
- fdmguard-0.1.0/src/fdmguard/strips.py +135 -0
- fdmguard-0.1.0/src/fdmguard/synthetic.py +175 -0
- fdmguard-0.1.0/src/fdmguard/tradeoff.py +250 -0
- fdmguard-0.1.0/tests/test_checks.py +218 -0
- fdmguard-0.1.0/tests/test_tradeoff_cli.py +212 -0
- fdmguard-0.1.0/uv.lock +1925 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ${{ matrix.os }}
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
os: [ubuntu-latest]
|
|
18
|
+
python: ["3.10", "3.11", "3.12", "3.13"]
|
|
19
|
+
include:
|
|
20
|
+
- os: macos-latest
|
|
21
|
+
python: "3.12"
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
- uses: astral-sh/setup-uv@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python }}
|
|
27
|
+
- run: uv sync
|
|
28
|
+
- name: Lint
|
|
29
|
+
run: |
|
|
30
|
+
uv run ruff check .
|
|
31
|
+
uv run ruff format --check .
|
|
32
|
+
- name: Tests
|
|
33
|
+
run: uv run pytest -q
|
|
34
|
+
- name: Examples (bad cases must fail, fixed cases must pass)
|
|
35
|
+
run: sh examples/run_examples.sh
|
|
36
|
+
- name: Build
|
|
37
|
+
run: uv build
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Runs only when a version tag (v*) is pushed. Publishing uses PyPI trusted publishing: no token is stored here.
|
|
4
|
+
# One-time setup on pypi.org: add a pending publisher for this repository, workflow release.yml, environment pypi.
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags: ["v*"]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v7
|
|
17
|
+
- uses: astral-sh/setup-uv@v10.4.0
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.13"
|
|
20
|
+
- run: uv sync --locked
|
|
21
|
+
- run: uv run pytest -q
|
|
22
|
+
- run: sh examples/run_examples.sh
|
|
23
|
+
- name: Tag matches package version
|
|
24
|
+
run: test "${GITHUB_REF_NAME#v}" = "$(uv run python -c 'import fdmguard; print(fdmguard.__version__)')"
|
|
25
|
+
- run: uv build
|
|
26
|
+
- uses: actions/upload-artifact@v7
|
|
27
|
+
with:
|
|
28
|
+
name: dist
|
|
29
|
+
path: dist/
|
|
30
|
+
|
|
31
|
+
publish:
|
|
32
|
+
needs: build
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
environment: pypi
|
|
35
|
+
permissions:
|
|
36
|
+
id-token: write
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/download-artifact@v8
|
|
39
|
+
with:
|
|
40
|
+
name: dist
|
|
41
|
+
path: dist/
|
|
42
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes are recorded here. Versions follow
|
|
4
|
+
[semantic versioning](https://semver.org/); before 1.0, minor versions may
|
|
5
|
+
change CLI flags and output formats.
|
|
6
|
+
|
|
7
|
+
## 0.1.0 - 2026-11-29
|
|
8
|
+
|
|
9
|
+
First public release (alpha).
|
|
10
|
+
|
|
11
|
+
- Checks: `insertion` (insertion-path sweep with FDM grow and snap allow-list),
|
|
12
|
+
`necks`, `strips`, `holes`, `stability` (bed contact and toppling screen),
|
|
13
|
+
and `tradeoff` (function gates before print metrics; the original geometry
|
|
14
|
+
is always an option).
|
|
15
|
+
- `--json` on every subcommand. Exit codes: 0 PASS, 1 FAIL or nothing
|
|
16
|
+
checked, 2 bad input.
|
|
17
|
+
- Claude Code skill in `skills/fdmguard/`.
|
|
18
|
+
- Synthetic examples and tests for five real failure cases.
|
|
19
|
+
- Design document: `docs/DESIGN.md`.
|
fdmguard-0.1.0/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.
|
fdmguard-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: fdmguard
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Function-first checks for 3D-printed parts: insertion-path sweep, thin necks, thin strips, hole fits, bed-contact stability, and an option trade-off table.
|
|
5
|
+
Project-URL: Homepage, https://github.com/SamKo88927/fdmguard
|
|
6
|
+
Project-URL: Documentation, https://github.com/SamKo88927/fdmguard/blob/main/docs/DESIGN.md
|
|
7
|
+
Project-URL: Issues, https://github.com/SamKo88927/fdmguard/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/SamKo88927/fdmguard/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Sam Ko
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: 3d-printing,agents,assembly,claude-code,dfm,fdm,interference,manifold
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Manufacturing
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Requires-Dist: manifold3d>=3.0
|
|
20
|
+
Requires-Dist: numpy>=1.24
|
|
21
|
+
Requires-Dist: pyyaml>=6.0
|
|
22
|
+
Requires-Dist: scipy>=1.10
|
|
23
|
+
Requires-Dist: shapely>=2.0
|
|
24
|
+
Requires-Dist: trimesh>=4.0
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# fdmguard
|
|
28
|
+
|
|
29
|
+
**A part that prints beautifully but cannot be assembled (or falls over mid-print) is a failed part. Function first, print quality second.**
|
|
30
|
+
|
|
31
|
+
Judge every print choice by **function first** (does it assemble, stay on the
|
|
32
|
+
bed while printing, move, hold, survive handling) and only then by **print quality** (supports, flat faces,
|
|
33
|
+
hole roundness). Every print choice (orientation, splitting into pieces,
|
|
34
|
+
adding joints) is a trade-off. Always include *"keep the original author's
|
|
35
|
+
geometry unchanged"* as an option, compare all options in one table, and let a
|
|
36
|
+
human decide.
|
|
37
|
+
|
|
38
|
+
fdmguard is a small Python CLI/library plus a [Claude Code skill](https://github.com/SamKo88927/fdmguard/blob/main/skills/fdmguard/SKILL.md).
|
|
39
|
+
It stops an AI agent (or a person) from "optimising a 3D-printed part for
|
|
40
|
+
printability" in ways that break the assembly.
|
|
41
|
+
|
|
42
|
+
> Status: alpha. All examples and figures use **synthetic geometry generated in
|
|
43
|
+
> code**. The tolerances are **starting points** for FDM PLA, not measurements of
|
|
44
|
+
> your printer. Nothing here simulates printing.
|
|
45
|
+
|
|
46
|
+
## Where this comes from
|
|
47
|
+
|
|
48
|
+
These four failures happened while adapting an open-source hobby robot for FDM
|
|
49
|
+
PLA printing. Each one passed the checks that were being used at the time.
|
|
50
|
+
|
|
51
|
+
| # | What went wrong | What catches it | Fix |
|
|
52
|
+
|---|---|---|---|
|
|
53
|
+
| 1 | Filament-pin holes drawn at 1.85-1.9 mm for 1.75 mm filament. FDM holes print 0.1-0.3 mm small; the pins did not go in. | `holes` | draw slip-fit pin holes at 2.1 mm; at least 0.4 mm diametral clearance for printed peg-in-hole |
|
|
54
|
+
| 2 | A horizontal split left two regions joined only by a flat strip about 0.5 mm thick and 0.9 mm wide. It snapped in handling. | `necks` (0.7 mm erosion splits it into 2 chunks) | keep every joining section at least about 1.6 mm |
|
|
55
|
+
| 3 | A flat 1.76 mm plate: 51% of its area was 1.6-1.8 mm wide strips, 13% narrower than 1.6 mm, plus a free 12 mm arm. A thickness/erosion check missed it. | `strips` (per-layer 2D opening) | widen strips; report the marginal band too |
|
|
56
|
+
| 4 | **The main one.** To print a one-piece part flat with no supports, it was split in two halves joined by an added keel with screws. The mating pocket was carved only around the **seated** pose (+0.3 mm). The seated pose had zero overlap, every check passed, and the halves printed clean. But moving the part into the pocket along its insertion path hit a 20-24 mm long, 0.4-0.7 mm undercut rim. It could not be assembled, and forcing it breaks PLA. The original one-piece design dropped in cleanly except for two small intentional snap tabs. | `insertion` | sweep the moving part along its path (grown about 0.1 mm for FDM, 0.25 mm steps). Every step must show zero overlap except named, small snap regions. Cut pockets with the swept volume. |
|
|
57
|
+
|
|
58
|
+
Also from failure 4: the original design had zero clearance on two seat faces.
|
|
59
|
+
Seated pockets need about +0.2-0.25 mm per side for FDM.
|
|
60
|
+
|
|
61
|
+
A fifth failure came later: a 54 mm tall one-piece part was oriented
|
|
62
|
+
"diagonally" because that orientation had the least support (2.8%). Its
|
|
63
|
+
first-layer bed contact was only 0.5 mm², so it would likely topple or detach.
|
|
64
|
+
The same part standing on a face had 127 mm² of contact, a rounder bearing bore
|
|
65
|
+
(axis vertical) and 21.5% support, and that was the right choice. `stability`
|
|
66
|
+
catches this.
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
*Synthetic block-into-pocket pair. The seated-only pocket has 0 mm³ overlap at
|
|
71
|
+
the seated pose, so a seated check passes, but the 22 mm rim interferes over
|
|
72
|
+
13 mm of travel. The pocket cut by the swept volume has 0 overlap at every
|
|
73
|
+
step. The 8 mm snap tab overlaps only inside its declared allowed region.*
|
|
74
|
+
|
|
75
|
+
## Install (local, not published)
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
uv sync # or: pip install -e .
|
|
79
|
+
uv run fdmguard --help # or: python -m fdmguard --help
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Python >= 3.10. Dependencies: manifold3d, trimesh, numpy, shapely, scipy, pyyaml.
|
|
83
|
+
|
|
84
|
+
## Checks
|
|
85
|
+
|
|
86
|
+
Exit codes for every command: `0` PASS, `1` FAIL, `2` bad input (missing file,
|
|
87
|
+
open or empty mesh). A bad input is never reported as a pass. Every command
|
|
88
|
+
also accepts `--json` for machine-readable output (for agents and CI).
|
|
89
|
+
|
|
90
|
+
### `insertion`: sweep the real assembly path
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
fdmguard insertion moving_seated.stl fixed.stl [more_fixed.stl ...] \
|
|
94
|
+
--direction=-z --travel 20 --step 0.25 --grow 0.1 \
|
|
95
|
+
[--allow tab:x0,y0,z0,x1,y1,z1] [--max-snap-length 12] [--full] [--json]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- The moving mesh is in its **seated** pose. `--direction` is the motion
|
|
99
|
+
direction during assembly (`x|-x|y|-y|z|-z` or `dx,dy,dz`; write `--direction=-z`
|
|
100
|
+
so the minus sign is not read as an option). The part starts at
|
|
101
|
+
`seated - direction * travel` and moves to seated in `--step` steps; the exact
|
|
102
|
+
seated pose is always the last step.
|
|
103
|
+
- `--grow` models FDM over-size. Default mode `inplane` is the union of the part
|
|
104
|
+
translated by `grow` in 8 directions perpendicular to travel, so the seat stop
|
|
105
|
+
face is not grown. `--grow-mode full` is a true Minkowski sum with a small
|
|
106
|
+
octahedron (experimental: it also grows the stop face, so a seated part
|
|
107
|
+
resting on a floor will report contact).
|
|
108
|
+
- Overlap volume is computed per fixed part with exact mesh booleans
|
|
109
|
+
(manifold3d) and split into *outside* and *inside* allowed snap regions.
|
|
110
|
+
- **PASS** needs: (a) the start pose outside every fixed part's bounding box,
|
|
111
|
+
(b) zero overlap outside allowed regions at every step (1e-3 mm³ noise floor),
|
|
112
|
+
and (c) the overlap inside each allowed region no longer than
|
|
113
|
+
`--max-snap-length` (12 mm) in the plane perpendicular to travel. Length is
|
|
114
|
+
measured per connected piece of overlap, so a long rigid rim still fails
|
|
115
|
+
inside one big "allowed" box or several small tiled boxes. There is no depth
|
|
116
|
+
limit; a warning is printed when the overlap is deeper than
|
|
117
|
+
`--warn-snap-depth` (1.0 mm).
|
|
118
|
+
- The seated-pose-only result is printed next to the path result.
|
|
119
|
+
|
|
120
|
+
Real output on the synthetic pair (bad pocket, then the swept-cut fix; the
|
|
121
|
+
first table is shortened by the tool itself, `--full` prints every step):
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
$ fdmguard insertion examples/out/insert_rim.stl examples/out/socket_seated_only.stl --direction=-z --travel 20
|
|
125
|
+
| step | to go (mm) | socket_seated_only overlap | socket_seated_only outside allowed | socket_seated_only in allowed | ok |
|
|
126
|
+
|---|---|---|---|---|---|
|
|
127
|
+
| 0 | 20.00 | 0.000 | 0.000 | 0.000 | yes |
|
|
128
|
+
| 29 | 12.75 | 4.160 | 4.160 | 0.000 | NO |
|
|
129
|
+
| 30 | 12.50 | 8.320 | 8.320 | 0.000 | NO |
|
|
130
|
+
...
|
|
131
|
+
| 78 | 0.50 | 3.328 | 3.328 | 0.000 | NO |
|
|
132
|
+
| 80 | 0.00 | 0.000 | 0.000 | 0.000 | yes |
|
|
133
|
+
|
|
134
|
+
seated-pose-only check : PASS (outside overlap 0.000 mm^3)
|
|
135
|
+
insertion-path sweep : FAIL (worst step 52 at 7.00 mm to go, outside overlap 49.920 mm^3; 81 steps of 0.25 mm, grow 0.1 mm)
|
|
136
|
+
NOTE: seated pose is clear but the part cannot travel there. Seated-only clearance is not enough.
|
|
137
|
+
|
|
138
|
+
$ fdmguard insertion examples/out/insert_rim.stl examples/out/socket_swept.stl --direction=-z --travel 20
|
|
139
|
+
| step | to go (mm) | socket_swept overlap | socket_swept outside allowed | socket_swept in allowed | ok |
|
|
140
|
+
|---|---|---|---|---|---|
|
|
141
|
+
| 0 | 20.00 | 0.000 | 0.000 | 0.000 | yes |
|
|
142
|
+
| 80 | 0.00 | 0.000 | 0.000 | 0.000 | yes |
|
|
143
|
+
|
|
144
|
+
seated-pose-only check : PASS (outside overlap 0.000 mm^3)
|
|
145
|
+
insertion-path sweep : PASS (no overlap outside allowed regions at any step; 81 steps of 0.25 mm, grow 0.1 mm)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Library helper: `fdmguard.insertion.swept_volume(moving, direction, travel)`
|
|
149
|
+
returns the union of the moving part over the path. Subtract it (grown a
|
|
150
|
+
little) from the fixed part to cut a pocket that admits the real motion.
|
|
151
|
+
|
|
152
|
+
### `necks`: thin joins left by splitting
|
|
153
|
+
|
|
154
|
+
```sh
|
|
155
|
+
fdmguard necks part.stl [--radius 0.7] [--pitch 0.05]
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Erodes each body of the solid by `r` on a voxel grid and counts chunks above
|
|
159
|
+
0.5 mm³. A body that falls apart into several chunks is joined only by a
|
|
160
|
+
section thinner than about `2r` (status `NECK`). A body that vanishes
|
|
161
|
+
completely is reported as `THIN`, not as a pass. Parts with more than one body are noted. Accuracy is
|
|
162
|
+
about half the voxel pitch (0.025 mm by default).
|
|
163
|
+
|
|
164
|
+
### `strips`: narrow strips on each printed layer
|
|
165
|
+
|
|
166
|
+
```sh
|
|
167
|
+
fdmguard strips part.stl [--width 1.6] [--layer 0.2] [--up z] [--band 0.2]
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
For each mid-layer section P, computes the opening `(P shrunk by w/2) grown by w/2`
|
|
171
|
+
with mitre joins (so square corners are not reported as thin). Material outside
|
|
172
|
+
the opening is narrower than `w`. Also reports the marginal band `w .. w+band`,
|
|
173
|
+
because a plate can pass at 1.6 mm and still be mostly 1.6-1.8 mm strips.
|
|
174
|
+
`--up` sets the build direction in the mesh's axes; results depend on it.
|
|
175
|
+
|
|
176
|
+
### `holes`: printed hole size for pins and screws
|
|
177
|
+
|
|
178
|
+
```sh
|
|
179
|
+
fdmguard holes --pin 1.75 # table of recommended sizes
|
|
180
|
+
fdmguard holes --pin 1.75 --fit slip part.stl # also check round holes in a mesh
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
| fit | added to nominal (diametral) | example |
|
|
184
|
+
|---|---|---|
|
|
185
|
+
| press | +0.10 | |
|
|
186
|
+
| slip | +0.35 | 1.75 mm filament pin -> 2.10 mm |
|
|
187
|
+
| peg (printed in printed) | +0.40 | |
|
|
188
|
+
| screw-clearance | +0.60 | M3 -> 3.6 mm |
|
|
189
|
+
| screw-tap (pilot) | -0.20 | M3 -> 2.8 mm |
|
|
190
|
+
|
|
191
|
+
Mesh checking finds circular holes whose axis is along `--up` from layer
|
|
192
|
+
sections (circularity >= 0.9) and flags holes smaller than the recommendation.
|
|
193
|
+
If no round hole is found, the result is "nothing checked" (exit 1), not a pass.
|
|
194
|
+
Calibrate these values with a test print on your own printer.
|
|
195
|
+
|
|
196
|
+
### `stability`: printable without toppling
|
|
197
|
+
|
|
198
|
+
```sh
|
|
199
|
+
fdmguard stability part_in_print_orientation.stl [--up z] [--min-contact 20] [--max-slenderness 10]
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The mesh must be in print orientation. The part is dropped to z = 0, then the
|
|
203
|
+
tool reports first-layer bed contact (sections at z = 0.1 / 0.3 / 0.5 mm),
|
|
204
|
+
height, contact width (short side of the minimum rotated rectangle around the
|
|
205
|
+
first-layer contact), height / contact width, and whether the centre of mass
|
|
206
|
+
(uniform density) is over the contact footprint, with a tip angle.
|
|
207
|
+
|
|
208
|
+
Defaults (conservative, configurable): FAIL if contact < 20 mm², if height /
|
|
209
|
+
contact width > 10, or if the centre of mass is not over the footprint. WARN
|
|
210
|
+
above height / contact width 5 (add a brim). This is a geometric screen. It does
|
|
211
|
+
not model adhesion, nozzle forces, brims, or supports that touch the bed.
|
|
212
|
+
|
|
213
|
+
Real output on the synthetic 54 mm post with an 8 mm bore:
|
|
214
|
+
|
|
215
|
+
```text
|
|
216
|
+
$ fdmguard stability examples/out/post_on_edge.stl
|
|
217
|
+
stability: post_on_edge.stl: up axis z
|
|
218
|
+
height : 48.1 mm
|
|
219
|
+
bed contact z=0.1/0.3/0.5 : 3.2 / 9.6 / 16.0 mm^2 (min 20)
|
|
220
|
+
contact width : 0.20 mm
|
|
221
|
+
height / contact width : 240.4 (warn > 5, fail > 10)
|
|
222
|
+
centre of mass : z 24.0 mm, over base: NO, tip angle -30.3 deg
|
|
223
|
+
-> FAIL
|
|
224
|
+
FAIL: first-layer contact 3.2 mm^2 < 20 mm^2
|
|
225
|
+
FAIL: height / contact width = 240.4 > 10
|
|
226
|
+
FAIL: centre of mass is not over the contact footprint: the part leans out of its base
|
|
227
|
+
|
|
228
|
+
$ fdmguard stability examples/out/post_face_down.stl
|
|
229
|
+
stability: post_face_down.stl: up axis z
|
|
230
|
+
height : 54.0 mm
|
|
231
|
+
bed contact z=0.1/0.3/0.5 : 173.8 / 173.8 / 173.8 mm^2 (min 20)
|
|
232
|
+
contact width : 14.00 mm
|
|
233
|
+
height / contact width : 3.9 (warn > 5, fail > 10)
|
|
234
|
+
centre of mass : z 27.0 mm, over base: yes, tip angle 14.5 deg
|
|
235
|
+
-> PASS
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### `tradeoff`: function gates first, then print metrics
|
|
239
|
+
|
|
240
|
+
```sh
|
|
241
|
+
fdmguard tradeoff options.yaml
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
See [examples/tradeoff_block.yaml](https://github.com/SamKo88927/fdmguard/blob/main/examples/tradeoff_block.yaml). Each option
|
|
245
|
+
lists `insertion`, `necks`, `strips`, `stability` (printable without toppling)
|
|
246
|
+
as `pass`, `fail`, `unknown`, or a check
|
|
247
|
+
spec that fdmguard runs on meshes. It also lists `extra_hardware`,
|
|
248
|
+
`geometry_change` (`none|minor|major`) and print metrics (lower is better).
|
|
249
|
+
|
|
250
|
+
Rules:
|
|
251
|
+
1. A gate that is missing or `unknown` is **UNVERIFIED**, never a pass.
|
|
252
|
+
2. Only options that pass every gate are ranked on print metrics.
|
|
253
|
+
3. The suggestion defaults to the **least-change** passing option. Another
|
|
254
|
+
option replaces it only if it is no worse on function cost (geometry change,
|
|
255
|
+
extra hardware) and at least as good on every print metric and strictly
|
|
256
|
+
better on one.
|
|
257
|
+
4. The file must contain an option with `original: true`. If the original
|
|
258
|
+
fails a gate, the output says so.
|
|
259
|
+
5. The table is always printed. A human decides.
|
|
260
|
+
|
|
261
|
+
Real output (the insertion and stability gates marked as checks were run on
|
|
262
|
+
meshes; the print metrics in the file are illustrative numbers, not slicer
|
|
263
|
+
output). The minimum-support diagonal option is gated out by stability:
|
|
264
|
+
|
|
265
|
+
```text
|
|
266
|
+
| option | insertion | necks | strips | stability | extra hardware | geometry change | function gates | support_pct | hole_error_mm | print_time_min | print rank | suggested |
|
|
267
|
+
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
268
|
+
| original | PASS | PASS | PASS | PASS | 0 | none | PASS | 18 | 0.15 | 95 | 2 | yes |
|
|
269
|
+
| reorient (same geometry) | PASS | PASS | PASS | PASS | 0 | none | PASS | 9 | 0.25 | 100 | 1 | |
|
|
270
|
+
| diagonal, min support | PASS | PASS | PASS | FAIL | 0 | none | FAIL | 3 | 0.3 | 105 | - (gated out) | |
|
|
271
|
+
| split + keel, seated-only pocket | FAIL | PASS | PASS | PASS | 2 | major | FAIL | 0 | 0.1 | 80 | - (gated out) | |
|
|
272
|
+
| split + keel, swept pocket | PASS | PASS | UNVERIFIED | PASS | 2 | major | UNVERIFIED | 0 | 0.1 | 82 | - (gated out) | |
|
|
273
|
+
|
|
274
|
+
Checks run:
|
|
275
|
+
- original: insertion: seated-only PASS, path PASS
|
|
276
|
+
- original: stability: PASS (bed contact 344.2 mm^2, height 24.0 mm, height/width 1.8)
|
|
277
|
+
- diagonal, min support: stability: FAIL (bed contact 5.1 mm^2, height 26.5 mm, height/width 132.6)
|
|
278
|
+
- split + keel, seated-only pocket: insertion: seated-only PASS, path FAIL
|
|
279
|
+
- split + keel, swept pocket: insertion: seated-only PASS, path PASS
|
|
280
|
+
|
|
281
|
+
Recommendation: original
|
|
282
|
+
'original' is the least-change option that passes every function gate. Also passing: reorient (same geometry). They change more or are not better on every print metric. This is a suggestion. Show this table to a human and let them decide.
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Examples and tests
|
|
286
|
+
|
|
287
|
+
```sh
|
|
288
|
+
sh examples/run_examples.sh # writes examples/out/*.stl, runs every check, asserts exit codes
|
|
289
|
+
uv run python examples/make_figures.py
|
|
290
|
+
uv run pytest -q
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
The synthetic cases (`src/fdmguard/synthetic.py`) reproduce each failure and a
|
|
294
|
+
fix: pin holes 1.9 vs 2.1 mm; a split part with a 0.5 x 0.9 mm neck vs a
|
|
295
|
+
1.6 x 2.0 mm neck; a plate with 1.7 / 1.2 mm strips vs 2.4 mm strips; and the
|
|
296
|
+
block-into-pocket pair (seated-only pocket, swept pocket, small snap tab with
|
|
297
|
+
and without an allowed region, a long rim inside an "allowed" box, and zero
|
|
298
|
+
seat clearance); and a 54 mm post balanced on an edge vs standing on a face.
|
|
299
|
+
|
|
300
|
+
## Agent skill
|
|
301
|
+
|
|
302
|
+
Copy `skills/fdmguard/` to `~/.claude/skills/` (or your project's
|
|
303
|
+
`.claude/skills/`). The skill tells the agent when to run the checks, in which
|
|
304
|
+
order, the tolerance defaults, the anti-patterns, and to show the trade-off
|
|
305
|
+
table instead of deciding silently.
|
|
306
|
+
|
|
307
|
+
## Limits
|
|
308
|
+
|
|
309
|
+
- Straight-line insertion only. Rotations or multi-leg paths need several runs.
|
|
310
|
+
- FDM over-size is modelled as a fixed grow. It is not a print or warp simulation.
|
|
311
|
+
- Snap regions are axis-aligned boxes in the fixed parts' frame. The tool
|
|
312
|
+
judges a snap by overlap length only; it does not compute stress or flex.
|
|
313
|
+
- Strips and holes use horizontal layer sections in the chosen up axis.
|
|
314
|
+
- Meshes must be closed manifold solids.
|
|
315
|
+
|
|
316
|
+
See [docs/DESIGN.md](https://github.com/SamKo88927/fdmguard/blob/main/docs/DESIGN.md) for goals, non-goals, key decisions and the roadmap, and
|
|
317
|
+
[docs/PRIOR_ART.md](https://github.com/SamKo88927/fdmguard/blob/main/docs/PRIOR_ART.md) for related tools. The pieces are
|
|
318
|
+
known techniques; this project is a small, focused combination of them.
|
|
319
|
+
|
|
320
|
+
## 繁體中文摘要
|
|
321
|
+
|
|
322
|
+
**印得漂亮但裝不起來、或印到一半倒掉,就是失敗的零件。先顧能用,再顧印得好。** 先看功能(裝得進去、印的時候不會倒、能動、
|
|
323
|
+
夾得住、拿起來不會斷),再看列印品質(支撐、平面、孔圓度)。拆件、換方向、
|
|
324
|
+
加接頭都是取捨。比較時一定要包含「維持原作者幾何不變」這個選項,把所有
|
|
325
|
+
選項放在同一張表,讓人來決定。
|
|
326
|
+
|
|
327
|
+
- `insertion`:沿著實際組裝路徑掃描(零件外擴 0.1 mm、每步 0.25 mm),
|
|
328
|
+
只看最終位置的檢查會漏掉路徑上的倒扣。
|
|
329
|
+
- `necks`:內縮 0.7 mm 後如果裂成多塊,代表有細頸。
|
|
330
|
+
- `strips`:逐層 2D 開運算,找出窄於 1.6 mm 的細條,並回報 1.6–1.8 mm 的邊緣比例。
|
|
331
|
+
- `holes`:1.75 mm 線材銷孔畫 2.1 mm;列印件對列印件至少 0.4 mm 直徑間隙。
|
|
332
|
+
- `stability`:列印方向的貼床面積與高寬比;只看支撐 % 選「斜放」常常會倒。
|
|
333
|
+
- `tradeoff`:功能關卡先過,才比列印指標;預設推薦改動最少的選項。
|
|
334
|
+
|
|
335
|
+
所有範例都是程式產生的合成幾何,公差只是起始值,請用自己的印表機校正。
|
|
336
|
+
|
|
337
|
+
## License
|
|
338
|
+
|
|
339
|
+
Apache-2.0. See [LICENSE](https://github.com/SamKo88927/fdmguard/blob/main/LICENSE).
|