step-stl-print-repair
Skill0 starsChanged 17 days agoMITView on GitHub
Repair and regenerate print-ready STL files from STEP/CAD sources, with FreeCAD/Gmsh tessellation sweeps, Blender 3D Print Toolbox validation, visual inspection, and explicit handling of smooth fillet/rounded-surface artifacts.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- buzzer-audio-previewSkill
- cvm-imagegenSkill
- docs-no-revision-markersSkill
- dst-dedicated-serverSkill
- firmware-display-previewSkill
- git-remote-troubleshootSkill
- git-syncSkill
- linux-server-initSkill
- markdown-doc-styleSkill
- tavily-hikari-infraSkill
- xp-infraSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. About 0 are common, 21 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈21
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill when the user provides STEP/STL files for 3D printing, asks to repair STL service errors, regenerate STL from STEP, improve …
- Distinctive: line 20
Prefer the original STEP/CAD source over repairing a bad STL.
- Distinctive: line 22
Never trust global remesh/MeshFix as a final answer without visual comparison.
- Distinctive: line 23
Do not assume "finer is cleaner." Smaller tessellation parameters can introduce zero-area faces, intersections, or thin faces.
- Distinctive: line 30
Check source paths, modification times, and existing output times.
- Distinctive: line 31
Use exact files from the current user request.
- Distinctive: line 34
Import STEP with FreeCAD.
- Distinctive: line 36
If STEP is invalid, report that the source CAD needs repair before STL work.
- Distinctive: line 44
Use binary STL conversion to keep large Gmsh outputs manageable.
- Distinctive: line 47
Use Blender 3D Print Toolbox batch checks.
- Distinctive: line 48
Treat these as hard failures unless there is a documented reason:
- Distinctive: line 57
If FreeCAD output has a few obvious non-manifold sliver triangles:
- Distinctive: line 58
Prefer local deletion of only the non-manifold sliver faces.
- Distinctive: line 61
Avoid MeshFix/global remesh unless the user accepts geometry reconstruction risk.
- Distinctive: line 62
If local deletion causes visible discontinuity, reject that candidate and switch tessellation strategy.
- Distinctive: line 73
If a finer candidate fails checks, record that and use the next clean candidate.
- Distinctive: line 85
Use bundled scripts when available:
- Distinctive: line 100
Do not depend on only one tool.
- Distinctive: line 104
Start with print-tolerance-aware values, then sweep:
- Distinctive: line 108
Stop tightening when checks start failing or file size becomes impractical.
- Very specific: line 109
If 0.10 mm or finer creates zero/intersect faces, do not use it just because it looks smoother.
- Distinctive: line 121
Keep the final response short and concrete:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
STEP/STL Print Repair
Use this skill when the user provides STEP/STL files for 3D printing, asks to repair STL service errors, regenerate STL from STEP, improve mesh precision, or fix visible artifacts around fillets/rounded openings.
Runtime and output boundary
All five domain scripts retain Python because they call FreeCAD/Blender application APIs or the official Gmsh binding directly. Run them in the matching application Python environment on a supported Linux/macOS installation; Bun is not a production prerequisite and no TS launcher is added. FreeCAD needs FreeCAD, Import, Part, Mesh and MeshPart; Gmsh needs its Python gmsh module/native library; Blender needs its bundled bpy/mathutils, with the 3D Print Toolbox extension for batch checks. A system Python installation alone does not provide these interfaces. See the application invocation notes below.
For the smallest meshing example, configure CAD_PYTHON as a Python executable with the Gmsh binding, then run "$CAD_PYTHON" scripts/gmsh_step_to_stl.py /path/to/model.step /path/to/fresh-output/model.stl --mesh-size 0.25 --report /path/to/fresh-output/report.json from this Skill. The scripts read selected geometry and write STL, JSON or rendered image outputs; matching outputs may be replaced, so use a fresh output directory. They do not modify source CAD or upload models. Blender scripts reset the in-memory scene: launch the documented background/factory-startup process, not an unsaved interactive project. Native applications, plugins and rendering are explicit prerequisites, not automatically installed dependencies.
The helper source smoke under ../git-remote-troubleshoot/tests/helper_sources.test.ts checks source links and retained binding imports only. It does not execute CAD or establish geometry/rendering correctness; application-level evidence is unavailable when those environments are absent.
Core Lessons
- Prefer the original STEP/CAD source over repairing a bad STL.
- Automated mesh checks are necessary but not sufficient. A file can pass checks and still be visibly wrong.
- Never trust global remesh/MeshFix as a final answer without visual comparison. It can pass topology checks while damaging openings, slots, and thin details.
- Do not assume "finer is cleaner." Smaller tessellation parameters can introduce zero-area faces, intersections, or thin faces.
- STL cannot preserve mathematical curve continuity or smooth normals. If a previewer flat-shades triangles, some faceting may remain even with valid dense meshes.
- For true CAD surface continuity, prefer uploading STEP when the print vendor accepts it, or fix the source CAD fillet/tangent continuity.
Default Workflow
- Confirm source freshness
- Check source paths, modification times, and existing output times.
- Use exact files from the current user request; do not mix old similarly named models.
- Inspect STEP geometry
- Import STEP with FreeCAD.
- Record validity, solid/shell counts, face/edge/vertex counts, and dimensions.
- If STEP is invalid, report that the source CAD needs repair before STL work.
- Generate candidate STL meshes
- First try FreeCAD/OpenCascade tessellation for small/simple parts:
- Linear deflection should usually be below the print tolerance.
- Sweep a few linear/angular combinations instead of betting on one value.
- For rounded slots, fillets, or visibly discontinuous surfaces, try Gmsh directly from STEP:
- Gmsh often avoids FreeCAD tessellation slivers and local face deletion.
- Use binary STL conversion to keep large Gmsh outputs manageable.
- First try FreeCAD/OpenCascade tessellation for small/simple parts:
- Validate every candidate
- Use Blender 3D Print Toolbox batch checks.
- Treat these as hard failures unless there is a documented reason:
- Non-manifold edges
- Intersect faces
- Zero faces / zero edges
- Thin faces
- Multiple shells when one body is expected
Overhang Facesis not a mesh-validity failure; it is a print-orientation/support signal.
- Repair conservatively
- If FreeCAD output has a few obvious non-manifold sliver triangles:
- Prefer local deletion of only the non-manifold sliver faces.
- Recheck immediately.
- Visually compare against the raw STEP-derived mesh.
- Avoid MeshFix/global remesh unless the user accepts geometry reconstruction risk.
- If local deletion causes visible discontinuity, reject that candidate and switch tessellation strategy.
- If FreeCAD output has a few obvious non-manifold sliver triangles:
- Visual inspection is mandatory for user-facing geometry
- Render or inspect the target feature, especially user-marked regions.
- Compare raw candidate, repaired candidate, and alternate mesher candidate.
- Reject candidates that are topologically valid but visibly damage or distort the design.
- Choose the final
- Pick the finest candidate that is both:
- topologically clean, and
- visually acceptable in the relevant region.
- If a finer candidate fails checks, record that and use the next clean candidate.
- Pick the finest candidate that is both:
- Deliver with proof
- Final output path(s).
- Source STEP path(s) and modification time if relevant.
- Mesher and parameters.
- Whether any local repair was applied.
- Blender check summary and machine-readable report path.
- Dimensions, vertex count, face count, shell count.
Tool Preference
Use bundled scripts when available:
scripts/freecad_step_to_stl.py: STEP -> STL with FreeCAD tessellation.scripts/gmsh_step_to_stl.py: STEP -> STL with Gmsh surface mesh.scripts/blender_stl_to_binary.py: ASCII STL -> compact binary STL.scripts/blender_stl_check_batch.py: Blender 3D Print Toolbox validation report.scripts/blender_stl_preview.py: quick rendered preview for visual comparison.
Environment notes:
- FreeCAD scripts may need
PYTHONPATH=/Applications/FreeCAD.app/Contents/Resources/lib /Applications/FreeCAD.app/Contents/Resources/bin/python ...on macOS. - Gmsh scripts require a Python environment with the
gmshmodule, or use a project venv that already has it installed. - Blender validation requires the official 3D Print Toolbox add-on/extension to be installed or enabled. In Blender 5.x this is typically the
print3d_toolboxextension; older Blender installs may exposeobject_print3d_utils. Do not assume a plain Blender install is enough. - Blender scripts should be run through Blender, e.g.
blender --background --factory-startup --python <script> -- <args>.
Do not depend on only one tool. FreeCAD, Gmsh, Blender, and the print vendor's preview can disagree; use the disagreement to identify whether the issue is topology, tessellation, shading, or source CAD continuity.
Parameter Heuristics
- Start with print-tolerance-aware values, then sweep:
- FreeCAD linear deflection:
0.08-0.15 mmfor small enclosure parts. - FreeCAD angular deflection:
0.50-0.70 rad; smaller angles may improve curves but can introduce bad faces. - Gmsh mesh size:
0.40 -> 0.25 -> 0.15 -> 0.12 mmfor rounded enclosure features.
- FreeCAD linear deflection:
- Stop tightening when checks start failing or file size becomes impractical.
- If
0.10 mmor finer creates zero/intersect faces, do not use it just because it looks smoother.
Decision Rules From Experience
- Clean but visibly wrong: reject. Automated checks are not enough.
- FreeCAD local sliver deletion breaks smoothness: switch to Gmsh from STEP; do not keep deleting/patching.
- Gmsh is clean but preview still shows triangle facets: try a smaller mesh size, then explain STL limitations.
- Very smooth preview required: recommend STEP upload if accepted, or source CAD cleanup for tangent-continuous fillets.
- Print service reports errors but Blender is clean: still inspect visually and, if possible, test an alternate mesher. Services may run their own repair pipeline.
Final Response Contract
Keep the final response short and concrete:
- Say whether the final STL was regenerated or repaired.
- Link the final file(s).
- Include a compact validation table.
- State the selected mesher and parameters.
- State any rejected option only if it explains a tradeoff, e.g. "
0.10 mmwas rejected because it produced zero-area faces."
Example validation table:
| File | Non-manifold | Intersections | Zero faces | Thin faces | Shells |
| model.stl | 0 | 0 | 0 | 0 | 1 |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

