skills/ carries the SKILL.md files; scripts/import_skills.py runs inside the VM via turnstone's own storage layer (SKILL.md parser + risk scanner) so rows match what the console admin API would write. Server must be restarted after import (stale WAL snapshot).
69 lines
2.7 KiB
Markdown
69 lines
2.7 KiB
Markdown
---
|
|
name: 3d-modeling-openscad
|
|
description: Generate parametric 3D models using OpenSCAD script
|
|
license: WTFPL
|
|
compatibility: opencode
|
|
metadata:
|
|
audience: makers, engineers, designers
|
|
workflow: 3d-modeling
|
|
---
|
|
|
|
## What I do
|
|
|
|
- Write `.scad` files using OpenSCAD syntax (primitives, transformations, CSG).
|
|
- Create parametric models using modules, functions, and variables.
|
|
- Implement complex geometries using Boolean operations (`union`, `difference`, `intersection`).
|
|
- Apply modifiers like `$fn` for smoothness or `center` for alignment.
|
|
- Create scripts for procedural 3D design.
|
|
- **Execute a Visual Verification Loop**:
|
|
- Render `.scad` to `.png` using the OpenSCAD CLI.
|
|
- Use the `read` tool to inspect the rendered image.
|
|
- Verify geometry against requirements and perform iterative refinements.
|
|
|
|
## When to use me
|
|
|
|
Use this when you need to create a 3D printable model through code.
|
|
Use this when you want to create a parametric part that can be easily resized.
|
|
Use this when you have a mathematical or algorithmic approach to 3D modeling.
|
|
|
|
## Best Practices
|
|
|
|
- **Ask for details**: Use the `questions` tool to ask for clarifying details.
|
|
- For example: What aspects of the model should be parameterized?
|
|
|
|
## Boolean subtractions
|
|
**Avoid 3D boolean subtractions**. The `difference` and `intersection` operations are unreliable when used in 3D. Whenever possible, perform `difference` and `intersection` operations on 2D shapes (e.g., `circle`, `square`) before using `linear_extrude` to create 3D volumes. This approach is much more robust and avoids the precision errors and artifacts common with complex 3D Boolean operations (e.g., when creating a tube or a hollow cylinder).
|
|
|
|
Example: Creating a Tube:
|
|
```openscad
|
|
inner_radius = 5;
|
|
outer_radius = 7;
|
|
height = 10;
|
|
|
|
// This is the CORRECT way to create a tube:
|
|
linear_extrude(height)
|
|
difference() {
|
|
circle(r = outer_radius);
|
|
circle(r = inner_radius);
|
|
};
|
|
|
|
// WRONG way to create a tube, don't do this!!! `difference` on 3d objects should be avoided!
|
|
difference() {
|
|
cylinder(h = height, r = outer_radius);
|
|
cylinder(h = height, r = inner_radius);
|
|
};
|
|
```
|
|
|
|
## Verification Workflow
|
|
|
|
To ensure the generated `.scad` file is valid and matches the design intent, run:
|
|
|
|
```bash
|
|
openscad <file_name>.scad -o <file_name>.render.png
|
|
```
|
|
|
|
**Purpose:**
|
|
1. **Syntax Check**: If the command fails, the script contains errors that must be fixed.
|
|
2. **Visual Validation**: Use the `read` tool on the resulting `.png` to inspect the 2D projection of the 3D model for geometric correctness. **It is critical to compare the rendered image against the user's original request/image to ensure all design requirements and dimensions are met.**
|
|
```
|