openscad-collision-detection
Detects and visualizes geometric intersections in OpenSCAD models using built-in techniques (intersection(), debug modifiers), BOSL2 utilities (debug_this, ghost), and reusable collision check patterns. Use when checking drawer clearances, door swing interference, shelf spacing, hinge collisions, or any geometric overlap in woodworking projects. Triggers on "check collision", "detect interference", "drawer clearance", "door swing", "check overlap", "assembly interference", or "fits in cabinet". Works with .scad files, woodworkers-lib patterns, BOSL2 attachments, and OpenSCAD 2025 Manifold engine.
What this skill does
# OpenSCAD Collision Detection
Detect and visualize geometric intersections in OpenSCAD models for woodworking and assembly validation.
## Quick Start
Add collision checking to any OpenSCAD model in 3 steps:
```openscad
// 1. Create reusable checker module
module check_collision(show_overlap=true) {
if (show_overlap) {
color("red", 0.8) intersection() {
children(0);
children(1);
}
}
%children(0); // Ghost first object
children(1); // Solid second object
}
// 2. Apply to your objects
check_collision() {
drawer(); // Moving part
cabinet_interior(); // Fixed structure
}
// 3. Preview (F5) - red regions show collisions
```
**Result:** Transparent reference geometry + solid moving part + red overlap visualization.
## Table of Contents
1. [When to Use This Skill](#1-when-to-use-this-skill)
2. [What This Skill Does](#2-what-this-skill-does)
3. [Core Techniques](#3-core-techniques)
4. [Reusable Patterns](#4-reusable-patterns)
5. [Woodworking Scenarios](#5-woodworking-scenarios)
6. [Debugging Workflow](#6-debugging-workflow)
7. [Supporting Files](#7-supporting-files)
8. [Expected Outcomes](#8-expected-outcomes)
9. [Integration Points](#9-integration-points)
10. [Requirements](#10-requirements)
11. [Red Flags to Avoid](#11-red-flags-to-avoid)
## When to Use This Skill
### Explicit Triggers
- "Check collision between drawer and cabinet"
- "Detect interference in door swing"
- "Verify clearance for shelf spacing"
- "Show overlaps in assembly"
- "Check if drawer fits in cabinet"
- "Door hinge collision check"
- "Workbench against wall clearance"
### Implicit Triggers
- Designing cabinets with drawers
- Creating furniture assemblies
- Planning room layouts with furniture placement
- Validating mechanical clearances
- Debugging "won't fit" issues
- Testing parametric designs with varying dimensions
### Debugging Scenarios
- Drawer won't close (hits back panel)
- Door hits adjacent object when opening
- Shelf spacing too tight for items
- Hinge cup interferes with door panel
- Workbench depth exceeds available space
- Parametric model generates invalid dimensions
## What This Skill Does
Provides systematic approach to collision detection:
1. **Visualize intersections** using `intersection()` to reveal overlap volumes
2. **Ghost reference geometry** using `%` modifier for transparent context
3. **Highlight collisions** with color coding (red = problem, yellow = clearance)
4. **Measure clearances** with echo statements and visual indicators
5. **Create reusable patterns** for common woodworking scenarios
6. **Integrate with project libraries** (woodworkers-lib, BOSL2, labels.scad)
7. **Validate assemblies** before fabrication or room layout
## Core Techniques
### intersection() - Reveal Overlaps
Returns geometry only where objects overlap:
```openscad
// Show collision volume
color("red") intersection() {
drawer();
cabinet_interior();
}
// If result has volume → collision exists
```
### Debug Modifiers
| Modifier | Effect | Use Case |
|----------|--------|----------|
| `%` | Transparent (ghost) | Show reference geometry |
| `#` | Highlight (red) | Emphasize specific object |
| `!` | Show only | Isolate object for testing |
| `*` | Disable | Temporarily hide geometry |
```openscad
%cabinet_interior(); // Ghost
#drawer(); // Highlight
```
### BOSL2 Utilities
```openscad
include <BOSL2/std.scad>
debug_this() drawer(); // Shows bounding box + transparent object
ghost() cabinet(); // Semantic equivalent to %
```
## Reusable Patterns
### Pattern 1: Basic Collision Checker
```openscad
module check_collision(show_overlap=true, overlap_color="red") {
if (show_overlap) {
color(overlap_color, 0.8) intersection() {
children(0);
children(1);
}
}
%children(0); // Ghost first object
children(1); // Solid second object
}
```
**Usage:**
```openscad
check_collision() {
drawer_extended();
cabinet_side_panel();
}
```
### Pattern 2: Clearance Visualization
```openscad
module show_clearance(clearance=2, zones=true) {
// Original objects
%children(0);
children(1);
// Clearance zones
if (zones) {
color("yellow", 0.2)
offset(r=clearance)
projection(cut=false)
children(0);
}
// Collision check
color("red") intersection() {
children(0);
children(1);
}
}
```
### Pattern 3: Conditional Debug Mode
```openscad
DEBUG_COLLISION = true; // Toggle at file top
module conditional_check() {
if (DEBUG_COLLISION) {
color("red") intersection() {
children(0);
children(1);
}
%children(0);
children(1);
} else {
children(0);
children(1);
}
}
```
### Pattern 4: Assembly Interference Check
```openscad
module assembly_check(explode=false) {
spacing = explode ? 50 : 0;
// Check overlaps when assembled (explode=false)
if (!explode) {
color("red", 0.8) intersection() {
children(0);
children(1);
}
}
children(0);
translate([spacing, 0, 0]) children(1);
}
// Usage
assembly_check(explode=$preview) {
cabinet_shell();
drawer_assembly();
}
```
## Woodworking Scenarios
### Drawer Clearance Check
```openscad
include <woodworkers-lib/std.scad>
module drawer_clearance_check(cabinet_dim, drawer_dim, panel=18) {
interior_w = cabinet_dim[0] - 2 * panel;
interior_d = cabinet_dim[1] - panel;
interior_h = cabinet_dim[2] - 2 * panel;
// Ghost cabinet interior
%color("blue", 0.2)
translate([panel, 0, panel])
cube([interior_w, interior_d, interior_h]);
// Show drawer
color("green", 0.5) cube(drawer_dim);
// Highlight collision
color("red") intersection() {
translate([panel, 0, panel]) cube([interior_w, interior_d, interior_h]);
cube(drawer_dim);
}
// Echo clearances
side_clearance = (interior_w - drawer_dim[0]) / 2;
echo(str("Side clearance: ", side_clearance, "mm per side"));
}
```
### Door Swing Interference
```openscad
module door_swing_check(door_width, swing_angle=90, adjacent_pos=500) {
// Door sweep volume
color("yellow", 0.3)
rotate([0, 0, swing_angle])
cube([door_width, 5, 720]);
// Adjacent object
translate([adjacent_pos, 0, 0])
color("green", 0.5)
cube([200, 400, 720]);
// Check interference
color("red") intersection() {
rotate([0, 0, swing_angle]) cube([door_width, 5, 720]);
translate([adjacent_pos, 0, 0]) cube([200, 400, 720]);
}
}
```
### Shelf Spacing Validation
```openscad
module shelf_spacing_check(cabinet_dim, shelf_positions, item_height, panel=18) {
// Draw shelves
for (z = shelf_positions) {
translate([0, 0, z])
%planeBottom([cabinet_dim[0], cabinet_dim[1], panel]);
}
// Check spacing
for (i = [0:len(shelf_positions)-2]) {
spacing = shelf_positions[i+1] - shelf_positions[i] - panel;
if (spacing < item_height) {
echo(str("WARNING: Shelf ", i, " spacing (", spacing,
"mm) < item height (", item_height, "mm)"));
// Highlight insufficient spacing
translate([0, 0, shelf_positions[i] + panel])
color("red", 0.5)
cube([cabinet_dim[0], cabinet_dim[1], spacing]);
}
}
}
```
## Debugging Workflow
Follow this systematic 5-step process:
### Step 1: Isolate Components
```openscad
!drawer(); // Show only drawer (use ! modifier)
```
### Step 2: Ghost Reference Geometry
```openscad
%cabinet_interior();
drawer();
```
### Step 3: Check Intersection
```openscad
color("red") intersection() {
cabinet_interior();
drawer();
}
// No volume = no collision
```
### Step 4: Measure Clearance
```openscad
drawer_width = 764;
interior_width Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.