OpenSCAD development workflow with screenshot validation for openscad
This skill guides the iterative development of OpenSCAD geometry with built-in validation through screenshot comparison.
This is the mandatory workflow for ALL OpenSCAD code changes:
User Request
ā
Create/Modify .scad file
ā
Take Screenshot (mcp_urdf_take_screenshot)
ā
Does it match user requirements? āāā YES ā Done ā
ā NO
Analyze discrepancies
ā
Can I fix it automatically? āāā YES ā Modify .scad and loop back
ā NO
Ask user for clarification
Do NOT assume OpenSCAD is installed locally. The MCP Server has an embedded OpenSCAD renderer that provides all needed functionality:
mcp_urdf_take_screenshot() - Renders the current filemcp_urdf_take_screenshot_by_filename() - Renders a specific file This means you can validate OpenSCAD changes without requiring the user to install anything locally. All geometry validation happens through the MCP Server's embedded renderer.
When comparing a screenshot with user requirements, evaluate:
The MCP Server provides the ONLY rendering pipeline needed. Use these tools exclusively for validation:
Use: mcp_urdf_take_screenshot_by_filename()
When: You want to preview a specific SCAD file
Returns: Screenshot of that file's rendered geometry
Rendering: Handled by MCP Server's embedded OpenSCAD renderer
Example workflow:
1. Create/edit shell.scad
2. Take screenshot to verify it rendered
3. If wrong, modify and take another screenshot
4. Repeat until correct
Use: mcp_urdf_take_screenshot()
When: You're actively editing and want quick validation
Returns: Screenshot of current workspace file being edited
Rendering: Handled by MCP Server's embedded OpenSCAD renderer
No local OpenSCAD installation required. All rendering happens through the MCP Server.
User: "Make the cylinder 20mm taller"
1. Modify the height parameter: height = 50 (was 30)
2. Take screenshot
3. Compare: Is it proportionally taller? Does it look right?
4. If YES ā Done
5. If NO ā Adjust parameter and retry
User: "Add a cutout for a sensor mount in the center"
1. Create geometry for the cutout (dimensions from spec)
2. Add it to a difference() operation
3. Take screenshot
4. Check:
- Position: Is it centered correctly? ā/ā
- Size: Does it look like the right size? ā/ā
- Integration: Does it cut cleanly? ā/ā
5. If any ā, adjust parameters:
- Wrong position? ā Adjust translate() values
- Wrong size? ā Adjust cube/cylinder dimensions
- Integration problem? ā Review boolean operation
6. Take another screenshot and verify
7. Repeat until all checks pass
User: "Position multiple parts with proper spacing"
1. Create part placement code
2. Take screenshot
3. Verify checklist:
- Part A positioned correctly? ā/ā
- Part B positioned correctly? ā/ā
- Spacing between parts adequate? ā/ā
- Overall alignment correct? ā/ā
4. For each ā:
- Adjust positioning parameters (translate/rotate)
- Take new screenshot
- Verify that specific issue
5. Iterate on each issue independently
Check:
Fix: Adjust positioning or visibility, take screenshot
Check:
Fix: Update parameter values, take screenshot
Check:
Fix: Review operation, adjust geometry, take screenshot
Check:
Fix: Adjust $fn value, take screenshot
User: "Create a mounting bracket with a 3Ć3 grid of mounting holes spaced 20mm apart"
// mounting_bracket.scad
// 3Ć3 grid of M3 mounting holes, 20mm spacing
module mounting_hole() {
// M3 hole: 3.2mm diameter
circle(r=1.6);
}
module bracket() {
// Mounting plate with 9 holes
difference() {
// Base plate
cube([80, 80, 5]);
// Hole grid: 3 rows Ć 3 columns
for (row = [0:2]) {
for (col = [0:2]) {
translate([col * 20 + 10, row * 20 + 10, -1])
linear_extrude(7)
mounting_hole();
}
}
}
}
bracket();
Take screenshot ā Check layout visually
Result: Layout looks off - holes too close to edges
// Shift hole positions inward
for (row = [0:2]) {
for (col = [0:2]) {
translate([col * 20 + 12, row * 20 + 12, -1]) // Changed from 10 to 12
linear_extrude(7)
mounting_hole();
}
}
Take screenshot ā Better! Edges look balanced
module bracket() {
difference() {
union() {
// Base plate
cube([80, 80, 5]);
// Corner reinforcement
for (x = [5, 75], y = [5, 75]) {
translate([x, y, 0])
cylinder(h=10, r=4);
}
}
// Hole grid (same as before)
for (row = [0:2]) {
for (col = [0:2]) {
translate([col * 20 + 12, row * 20 + 12, -1])
linear_extrude(7)
mounting_hole();
}
}
// Center mounting point
translate([40, 40, 0])
cylinder(h=5, r=2.5);
}
}
Take screenshot ā Verify reinforcement looks good, mounting point is clear
Compare screenshot with requirements:
Result: Ready for use!
Ask the user when:
Always include in clarification request:
This skill is designed to work with any OpenSCAD project. When working on specific projects:
For every OpenSCAD change:
1. Edit file (.scad)
2. Take screenshot (mcp_urdf_take_screenshot or mcp_urdf_take_screenshot_by_filename)
3. Compare with requirements
4. If wrong:
- Analyze what's incorrect
- Modify code to fix
- Go to step 2
5. If unclear to user:
- Document current state
- Explain discrepancy
- Ask specific clarification question
6. If correct:
- Document the solution
- Move to next task
mcp_urdf_take_screenshot() - Screenshot current active filemcp_urdf_take_screenshot_by_filename(parameters) - Screenshot specific fileread_file() - Reference existing code and specsā Take a screenshot immediately after any code change ā Compare screenshots systematically against requirements ā Make small, targeted changes and verify each one ā Document what the screenshot shows vs. what was requested ā Attempt multiple approaches before asking for help ā Reference project specs and constraints in verification ā Keep iterating until the screenshot matches requirements
ā Make large changes and hope they work ā Skip screenshot validation ā Assume positioning is correct without visual verification ā Ask user to check something you can screenshot yourself ā Give up after one attempt when the output is wrong ā Ignore component integration issues in screenshots
This skill enforces a tight feedback loop for OpenSCAD development:
This approach ensures OpenSCAD geometry is developed correctly with visual validation at every step, enabling confident, iterative design workflows.