Add parametric light switch plate models

Converted STL files to parametric OpenSCAD:
- blank.scad: Blank cover plate
- switch.scad: Single toggle switch
- outlet.scad: Duplex outlet
- switch-switch.scad: Double toggle (2-gang)
- gfci-paddle-switch.scad: Decora/GFCI paddle switch
- gfci-paddle-switch-extended.scad: Custom 153x230mm oversized plate

All plates feature:
- Print-optimized orientation (front face at Z=0, no overhangs)
- Beveled edges matching original design
- Back recess for electrical box fit
- Round screw holes
- BOSL2 library for clean geometry

Includes 2D template (SVG) for paper test-fit printing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2025-12-20 17:42:15 -06:00
parent 32596c8cbb
commit 93d5b0f102
8 changed files with 771 additions and 0 deletions

92
light-switches/blank.scad Normal file
View File

@ -0,0 +1,92 @@
// Blank Wall Plate (No Openings)
// Standard single-gang blank cover plate
// Parametric OpenSCAD model
include <BOSL2/std.scad>
/* [Plate Dimensions] */
plate_width = 83.64; // mm - X dimension
plate_height = 126.64; // mm - Y dimension
plate_thickness = 5.0; // mm - Z dimension
/* [Bevel Settings] */
bevel_inset = 1.82; // mm - how much smaller bottom is per side
/* [Recess Settings] */
recess_enabled = true;
recess_depth = 2.0; // mm - depth of recess (from bottom)
recess_inset = 8.0; // mm - inset from outer edge
/* [Screw Holes] */
screw_holes_enabled = true;
screw_hole_diameter = 5.0; // mm - diameter of screw hole
screw_hole_spacing = 100.0; // mm - distance between hole centers
/* [Corner Rounding] */
plate_corner_radius = 3.0; // mm
/* [Resolution] */
$fn = 64;
// ============================================
// CALCULATED VALUES
// ============================================
bottom_width = plate_width - (bevel_inset * 2);
bottom_height = plate_height - (bevel_inset * 2);
recess_width = plate_width - (recess_inset * 2);
recess_height = plate_height - (recess_inset * 2);
// ============================================
// MODULES
// ============================================
module plate_body() {
// Flipped for printing: front face (larger) at Z=0, back (smaller) at Z=5
// This eliminates overhang on beveled edges
prismoid(
size1 = [plate_width, plate_height], // front face (larger) at bottom
size2 = [bottom_width, bottom_height], // back face (smaller) at top
h = plate_thickness,
rounding = plate_corner_radius,
anchor = BOTTOM
);
}
module back_recess() {
if (recess_enabled) {
recess_rounding = max(0.5, plate_corner_radius - recess_inset/4);
// Recess now at top (Z=5) since plate is flipped for printing
translate([0, 0, plate_thickness - recess_depth - 0.01])
prismoid(
size1 = [recess_width, recess_height],
size2 = [recess_width, recess_height],
h = recess_depth + 0.02,
rounding = recess_rounding,
anchor = BOTTOM
);
}
}
module screw_holes() {
if (screw_holes_enabled) {
for (y_pos = [screw_hole_spacing/2, -screw_hole_spacing/2]) {
translate([0, y_pos, -0.1])
cylinder(h = plate_thickness + 0.2, d = screw_hole_diameter);
}
}
}
// ============================================
// MAIN ASSEMBLY
// ============================================
module blank_plate() {
difference() {
plate_body();
back_recess();
screw_holes();
}
}
blank_plate();

View File

@ -0,0 +1,26 @@
// 2D projection for paper test fit
// Print this at 100% scale (no scaling)
include <BOSL2/std.scad>
plate_width = 153.0;
plate_height = 230.0;
plate_corner_radius = 3.0;
opening_width = 34.0;
opening_height = 67.0;
opening_corner_radius = 2.0;
// Screw holes - same spacing as original
screw_hole_diameter = 5.0;
screw_hole_spacing = 83.3;
$fn = 64;
difference() {
rect([plate_width, plate_height], rounding=plate_corner_radius);
rect([opening_width, opening_height], rounding=opening_corner_radius);
translate([0, screw_hole_spacing/2])
circle(d=screw_hole_diameter);
translate([0, -screw_hole_spacing/2])
circle(d=screw_hole_diameter);
}

View File

@ -0,0 +1,53 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="154mm" height="230mm" viewBox="-77 -115 154 230" xmlns="http://www.w3.org/2000/svg" version="1.1">
<title>OpenSCAD Model</title>
<path d="
M 73.794,114.986 L 74.0853,114.942 L 74.3708,114.871 L 74.648,114.772 L 74.9142,114.646 L 75.1667,114.494
L 75.4032,114.319 L 75.6213,114.121 L 75.819,113.903 L 75.9944,113.667 L 76.1458,113.414 L 76.2716,113.148
L 76.3708,112.871 L 76.4424,112.585 L 76.4855,112.294 L 76.5,112 L 76.5,-112 L 76.4855,-112.294
L 76.4424,-112.585 L 76.3708,-112.871 L 76.2716,-113.148 L 76.1458,-113.414 L 75.9944,-113.667 L 75.819,-113.903
L 75.6213,-114.121 L 75.4032,-114.319 L 75.1667,-114.494 L 74.9142,-114.646 L 74.648,-114.772 L 74.3708,-114.871
L 74.0853,-114.942 L 73.794,-114.986 L 73.5,-115 L -73.5,-115 L -73.794,-114.986 L -74.0853,-114.942
L -74.3708,-114.871 L -74.648,-114.772 L -74.9142,-114.646 L -75.1667,-114.494 L -75.4032,-114.319 L -75.6213,-114.121
L -75.819,-113.903 L -75.9944,-113.667 L -76.1458,-113.414 L -76.2716,-113.148 L -76.3708,-112.871 L -76.4424,-112.585
L -76.4855,-112.294 L -76.5,-112 L -76.5,112 L -76.4855,112.294 L -76.4424,112.585 L -76.3708,112.871
L -76.2716,113.148 L -76.1458,113.414 L -75.9944,113.667 L -75.819,113.903 L -75.6213,114.121 L -75.4032,114.319
L -75.1667,114.494 L -74.9142,114.646 L -74.648,114.772 L -74.3708,114.871 L -74.0853,114.942 L -73.794,114.986
L -73.5,115 L 73.5,115 z
M -0.245041,-39.162 L -0.487717,-39.198 L -0.725708,-39.2576 L -0.956696,-39.3403 L -1.17848,-39.4452 L -1.38892,-39.5713
L -1.58597,-39.7175 L -1.76776,-39.8822 L -1.93253,-40.064 L -2.07866,-40.2611 L -2.20479,-40.4715 L -2.30969,-40.6933
L -2.39235,-40.9243 L -2.45195,-41.1623 L -2.48796,-41.405 L -2.5,-41.65 L -2.48796,-41.895 L -2.45195,-42.1377
L -2.39235,-42.3757 L -2.30969,-42.6067 L -2.20479,-42.8285 L -2.07866,-43.0389 L -1.93253,-43.236 L -1.76776,-43.4178
L -1.58597,-43.5825 L -1.38892,-43.7287 L -1.17848,-43.8548 L -0.956696,-43.9597 L -0.725708,-44.0423 L -0.487717,-44.102
L -0.245041,-44.138 L 0,-44.15 L 0.245041,-44.138 L 0.487717,-44.102 L 0.725708,-44.0423 L 0.956696,-43.9597
L 1.17848,-43.8548 L 1.38892,-43.7287 L 1.58597,-43.5825 L 1.76776,-43.4178 L 1.93253,-43.236 L 2.07866,-43.0389
L 2.20479,-42.8285 L 2.30969,-42.6067 L 2.39235,-42.3757 L 2.45195,-42.1377 L 2.48796,-41.895 L 2.5,-41.65
L 2.48796,-41.405 L 2.45195,-41.1623 L 2.39235,-40.9243 L 2.30969,-40.6933 L 2.20479,-40.4715 L 2.07866,-40.2611
L 1.93253,-40.064 L 1.76776,-39.8822 L 1.58597,-39.7175 L 1.38892,-39.5713 L 1.17848,-39.4452 L 0.956696,-39.3403
L 0.725708,-39.2576 L 0.487717,-39.198 L 0.245041,-39.162 L 0,-39.15 z
M -15,33.5 L -15.196,33.4904 L -15.3902,33.4616 L -15.5806,33.4139 L -15.7654,33.3477 L -15.9428,33.2638
L -16.1111,33.1629 L -16.2688,33.046 L -16.4142,32.9142 L -16.546,32.7688 L -16.6629,32.6111 L -16.7638,32.4428
L -16.8477,32.2654 L -16.9139,32.0806 L -16.9616,31.8902 L -16.9904,31.696 L -17,31.5 L -17,-31.5
L -16.9904,-31.696 L -16.9616,-31.8902 L -16.9139,-32.0806 L -16.8477,-32.2654 L -16.7638,-32.4428 L -16.6629,-32.6111
L -16.546,-32.7688 L -16.4142,-32.9142 L -16.2688,-33.046 L -16.1111,-33.1629 L -15.9428,-33.2638 L -15.7654,-33.3477
L -15.5806,-33.4139 L -15.3902,-33.4616 L -15.196,-33.4904 L -15,-33.5 L 15,-33.5 L 15.196,-33.4904
L 15.3902,-33.4616 L 15.5806,-33.4139 L 15.7654,-33.3477 L 15.9428,-33.2638 L 16.1111,-33.1629 L 16.2688,-33.046
L 16.4142,-32.9142 L 16.546,-32.7688 L 16.6629,-32.6111 L 16.7638,-32.4428 L 16.8477,-32.2654 L 16.9139,-32.0806
L 16.9616,-31.8902 L 16.9904,-31.696 L 17,-31.5 L 17,31.5 L 16.9904,31.696 L 16.9616,31.8902
L 16.9139,32.0806 L 16.8477,32.2654 L 16.7638,32.4428 L 16.6629,32.6111 L 16.546,32.7688 L 16.4142,32.9142
L 16.2688,33.046 L 16.1111,33.1629 L 15.9428,33.2638 L 15.7654,33.3477 L 15.5806,33.4139 L 15.3902,33.4616
L 15.196,33.4904 L 15,33.5 z
M -0.245041,44.138 L -0.487717,44.102 L -0.725708,44.0423 L -0.956696,43.9597 L -1.17848,43.8548 L -1.38892,43.7287
L -1.58597,43.5825 L -1.76776,43.4178 L -1.93253,43.236 L -2.07866,43.0389 L -2.20479,42.8285 L -2.30969,42.6067
L -2.39235,42.3757 L -2.45195,42.1377 L -2.48796,41.895 L -2.5,41.65 L -2.48796,41.405 L -2.45195,41.1623
L -2.39235,40.9243 L -2.30969,40.6933 L -2.20479,40.4715 L -2.07866,40.2611 L -1.93253,40.064 L -1.76776,39.8822
L -1.58597,39.7175 L -1.38892,39.5713 L -1.17848,39.4452 L -0.956696,39.3403 L -0.725708,39.2576 L -0.487717,39.198
L -0.245041,39.162 L 0,39.15 L 0.245041,39.162 L 0.487717,39.198 L 0.725708,39.2576 L 0.956696,39.3403
L 1.17848,39.4452 L 1.38892,39.5713 L 1.58597,39.7175 L 1.76776,39.8822 L 1.93253,40.064 L 2.07866,40.2611
L 2.20479,40.4715 L 2.30969,40.6933 L 2.39235,40.9243 L 2.45195,41.1623 L 2.48796,41.405 L 2.5,41.65
L 2.48796,41.895 L 2.45195,42.1377 L 2.39235,42.3757 L 2.30969,42.6067 L 2.20479,42.8285 L 2.07866,43.0389
L 1.93253,43.236 L 1.76776,43.4178 L 1.58597,43.5825 L 1.38892,43.7287 L 1.17848,43.8548 L 0.956696,43.9597
L 0.725708,44.0423 L 0.487717,44.102 L 0.245041,44.138 L 0,44.15 z
" stroke="black" fill="none" stroke-width="0.5"/>
</svg>

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -0,0 +1,114 @@
// GFCI Paddle Switch Plate - Extended Size
// Custom oversized plate with centered paddle opening
// Opening and screw holes remain in original position
include <BOSL2/std.scad>
/* [Plate Dimensions] */
// Extended plate dimensions
plate_width = 153.0; // mm - X dimension (was 83.64)
plate_height = 230.0; // mm - Y dimension (was 126.64)
plate_thickness = 5.0; // mm - Z dimension
/* [Bevel Settings] */
bevel_inset = 1.82; // mm - how much smaller bottom is per side
/* [Recess Settings] */
recess_enabled = true;
recess_depth = 2.0; // mm - depth of recess (from bottom)
recess_inset = 8.0; // mm - inset from outer edge
/* [Paddle Opening] */
// Rectangular opening for paddle switch (same as standard plate)
opening_width = 34.0; // mm - width of opening
opening_height = 67.0; // mm - height of opening
/* [Corner Rounding] */
plate_corner_radius = 3.0; // mm
opening_corner_radius = 2.0; // mm
/* [Screw Holes] */
screw_holes_enabled = true;
screw_hole_diameter = 4.0; // mm
screw_hole_spacing = 83.3; // mm - distance between screw holes (unchanged)
/* [Resolution] */
$fn = 64;
// ============================================
// CALCULATED VALUES
// ============================================
bottom_width = plate_width - (bevel_inset * 2);
bottom_height = plate_height - (bevel_inset * 2);
recess_width = plate_width - (recess_inset * 2);
recess_height = plate_height - (recess_inset * 2);
// ============================================
// MODULES
// ============================================
module plate_body() {
// Flipped for printing: front face (larger) at Z=0, back (smaller) at Z=5
// This eliminates overhang on beveled edges
prismoid(
size1 = [plate_width, plate_height], // front face (larger) at bottom
size2 = [bottom_width, bottom_height], // back face (smaller) at top
h = plate_thickness,
rounding = plate_corner_radius,
anchor = BOTTOM
);
}
module back_recess() {
if (recess_enabled) {
recess_rounding = max(0.5, plate_corner_radius - recess_inset/4);
// Recess now at top (Z=5) since plate is flipped for printing
translate([0, 0, plate_thickness - recess_depth - 0.01])
prismoid(
size1 = [recess_width, recess_height],
size2 = [recess_width, recess_height],
h = recess_depth + 0.02,
rounding = recess_rounding,
anchor = BOTTOM
);
}
}
// 2D paddle opening shape (simple rectangle with rounded corners)
module paddle_opening_2d() {
rect([opening_width, opening_height], rounding=opening_corner_radius);
}
module paddle_opening_3d() {
translate([0, 0, -0.1])
linear_extrude(height = plate_thickness + 0.2)
paddle_opening_2d();
}
module screw_holes() {
if (screw_holes_enabled) {
// Top screw hole
translate([0, screw_hole_spacing/2, -0.1])
cylinder(h = plate_thickness + 0.2, d = screw_hole_diameter);
// Bottom screw hole
translate([0, -screw_hole_spacing/2, -0.1])
cylinder(h = plate_thickness + 0.2, d = screw_hole_diameter);
}
}
// ============================================
// MAIN ASSEMBLY
// ============================================
module gfci_paddle_plate_extended() {
difference() {
plate_body();
back_recess();
paddle_opening_3d();
screw_holes();
}
}
gfci_paddle_plate_extended();

View File

@ -0,0 +1,141 @@
// GFCI Paddle Switch Plate
// Parametric recreation of standard Decora/GFCI wall plate
// Rebuilt from STL analysis - fully editable
include <BOSL2/std.scad>
/* [Plate Dimensions] */
// Overall plate dimensions (at top surface)
plate_width = 83.64; // mm - X dimension
plate_height = 126.64; // mm - Y dimension
plate_thickness = 5.0; // mm - Z dimension
/* [Bevel Settings] */
// Bevel creates the tapered edge (top wider than bottom)
bevel_inset = 1.82; // mm - how much smaller bottom is per side
bevel_height = 3.0; // mm - height of beveled section (from top)
/* [Recess Settings] */
// Back recess that fits over electrical box
recess_enabled = true;
recess_depth = 2.0; // mm - depth of recess (from bottom)
recess_inset = 8.0; // mm - inset from outer edge on each side
/* [Paddle Opening] */
// Rectangular opening for paddle switch
opening_width = 34.0; // mm - width of opening
opening_height = 67.0; // mm - height of opening
/* [Corner Rounding] */
plate_corner_radius = 3.0; // mm - outer corner radius
opening_corner_radius = 2.0; // mm - opening corner radius
/* [Screw Holes] */
screw_holes_enabled = true;
screw_hole_diameter = 4.0; // mm
screw_hole_spacing = 83.3; // mm - distance between screw holes (center to center)
/* [Resolution] */
$fn = 64; // smoothness for curves
// ============================================
// CALCULATED VALUES
// ============================================
// Bottom dimensions (smaller due to bevel)
bottom_width = plate_width - (bevel_inset * 2);
bottom_height = plate_height - (bevel_inset * 2);
// Recess dimensions
recess_width = plate_width - (recess_inset * 2);
recess_height = plate_height - (recess_inset * 2);
// ============================================
// MODULES
// ============================================
// Main plate body with beveled edges
module plate_body() {
// Flipped for printing: front face (larger) at Z=0, back (smaller) at Z=5
// This eliminates overhang on beveled edges
prismoid(
size1 = [plate_width, plate_height], // front face (larger) at bottom
size2 = [bottom_width, bottom_height], // back face (smaller) at top
h = plate_thickness,
rounding = plate_corner_radius,
anchor = BOTTOM
);
}
// Back recess for electrical box fit
module back_recess() {
if (recess_enabled) {
recess_rounding = max(0.5, plate_corner_radius - recess_inset/4);
// Recess now at top (Z=5) since plate is flipped for printing
translate([0, 0, plate_thickness - recess_depth - 0.01])
prismoid(
size1 = [recess_width, recess_height],
size2 = [recess_width, recess_height],
h = recess_depth + 0.02,
rounding = recess_rounding,
anchor = BOTTOM
);
}
}
// 2D paddle opening shape (simple rectangle with rounded corners)
module paddle_opening_2d() {
rect([opening_width, opening_height], rounding=opening_corner_radius);
}
// 3D paddle opening (for subtraction)
module paddle_opening_3d() {
translate([0, 0, -0.1])
linear_extrude(height = plate_thickness + 0.2)
paddle_opening_2d();
}
// Screw holes
module screw_holes() {
if (screw_holes_enabled) {
// Top screw hole
translate([0, screw_hole_spacing/2, -0.1])
cylinder(h = plate_thickness + 0.2, d = screw_hole_diameter);
// Bottom screw hole
translate([0, -screw_hole_spacing/2, -0.1])
cylinder(h = plate_thickness + 0.2, d = screw_hole_diameter);
}
}
// ============================================
// MAIN ASSEMBLY
// ============================================
module gfci_paddle_plate() {
difference() {
plate_body();
back_recess();
paddle_opening_3d();
screw_holes();
}
}
// Render the plate
gfci_paddle_plate();
// ============================================
// PREVIEW HELPERS (uncomment to debug)
// ============================================
// Preview just the 2D opening shape:
// paddle_opening_2d();
// Preview the opening position:
// #paddle_opening_3d();
// Preview cross-section (cut in half):
// difference() {
// gfci_paddle_plate();
// translate([0, -100, -1]) cube([200, 200, 20]);
// }

117
light-switches/outlet.scad Normal file
View File

@ -0,0 +1,117 @@
// Duplex Outlet Wall Plate
// Standard single-gang duplex receptacle cover
// Parametric OpenSCAD model
include <BOSL2/std.scad>
/* [Plate Dimensions] */
plate_width = 83.64; // mm - X dimension
plate_height = 126.64; // mm - Y dimension
plate_thickness = 5.0; // mm - Z dimension
/* [Bevel Settings] */
bevel_inset = 1.82; // mm - how much smaller bottom is per side
/* [Recess Settings] */
recess_enabled = true;
recess_depth = 2.0; // mm - depth of recess (from bottom)
recess_inset = 8.0; // mm - inset from outer edge
/* [Outlet Opening] */
// Each outlet receptacle opening (oval/rounded rectangle)
outlet_width = 34.0; // mm - width of each outlet opening
outlet_height = 26.0; // mm - height of each outlet opening
outlet_corner_radius = 10.0; // mm - creates rounded/oval shape
outlet_spacing = 39.5; // mm - vertical distance between outlet centers
/* [Screw Hole] */
// Center screw hole between outlets
screw_hole_enabled = true;
screw_hole_diameter = 5.0; // mm
/* [Corner Rounding] */
plate_corner_radius = 3.0; // mm
/* [Resolution] */
$fn = 64;
// ============================================
// CALCULATED VALUES
// ============================================
bottom_width = plate_width - (bevel_inset * 2);
bottom_height = plate_height - (bevel_inset * 2);
recess_width = plate_width - (recess_inset * 2);
recess_height = plate_height - (recess_inset * 2);
// ============================================
// MODULES
// ============================================
module plate_body() {
// Flipped for printing: front face (larger) at Z=0, back (smaller) at Z=5
// This eliminates overhang on beveled edges
prismoid(
size1 = [plate_width, plate_height], // front face (larger) at bottom
size2 = [bottom_width, bottom_height], // back face (smaller) at top
h = plate_thickness,
rounding = plate_corner_radius,
anchor = BOTTOM
);
}
module back_recess() {
if (recess_enabled) {
recess_rounding = max(0.5, plate_corner_radius - recess_inset/4);
// Recess now at top (Z=5) since plate is flipped for printing
translate([0, 0, plate_thickness - recess_depth - 0.01])
prismoid(
size1 = [recess_width, recess_height],
size2 = [recess_width, recess_height],
h = recess_depth + 0.02,
rounding = recess_rounding,
anchor = BOTTOM
);
}
}
// Single outlet opening (rounded rectangle / oval)
module outlet_opening_2d() {
rect([outlet_width, outlet_height], rounding=outlet_corner_radius);
}
// Both outlet openings
module outlet_openings_3d() {
translate([0, 0, -0.1])
linear_extrude(height = plate_thickness + 0.2) {
// Top outlet
translate([0, outlet_spacing/2, 0])
outlet_opening_2d();
// Bottom outlet
translate([0, -outlet_spacing/2, 0])
outlet_opening_2d();
}
}
// Center screw hole
module center_screw_hole() {
if (screw_hole_enabled) {
translate([0, 0, -0.1])
cylinder(h = plate_thickness + 0.2, d = screw_hole_diameter);
}
}
// ============================================
// MAIN ASSEMBLY
// ============================================
module outlet_plate() {
difference() {
plate_body();
back_recess();
outlet_openings_3d();
center_screw_hole();
}
}
outlet_plate();

View File

@ -0,0 +1,119 @@
// Double Toggle Switch Wall Plate
// Standard 2-gang toggle switch cover
// Parametric OpenSCAD model
include <BOSL2/std.scad>
/* [Plate Dimensions] */
// 2-gang plate is wider than single-gang
plate_width = 126.64; // mm - X dimension (2-gang width)
plate_height = 126.64; // mm - Y dimension
plate_thickness = 5.0; // mm - Z dimension
/* [Bevel Settings] */
bevel_inset = 1.82; // mm - how much smaller bottom is per side
/* [Recess Settings] */
recess_enabled = true;
recess_depth = 2.0; // mm - depth of recess (from bottom)
recess_inset = 8.0; // mm - inset from outer edge
/* [Switch Openings] */
switch_width = 11.0; // mm - width of each toggle slot
switch_height = 67.0; // mm - height of each toggle slot
switch_corner_radius = 4.0; // mm - rounding at ends
switch_spacing = 45.0; // mm - horizontal distance between switch centers
/* [Screw Holes] */
screw_holes_enabled = true;
screw_hole_diameter = 5.0; // mm - diameter of screw hole
screw_hole_spacing = 96.0; // mm - distance between hole centers
/* [Corner Rounding] */
plate_corner_radius = 3.0; // mm
/* [Resolution] */
$fn = 64;
// ============================================
// CALCULATED VALUES
// ============================================
bottom_width = plate_width - (bevel_inset * 2);
bottom_height = plate_height - (bevel_inset * 2);
recess_width = plate_width - (recess_inset * 2);
recess_height = plate_height - (recess_inset * 2);
// ============================================
// MODULES
// ============================================
module plate_body() {
// Flipped for printing: front face (larger) at Z=0, back (smaller) at Z=5
// This eliminates overhang on beveled edges
prismoid(
size1 = [plate_width, plate_height], // front face (larger) at bottom
size2 = [bottom_width, bottom_height], // back face (smaller) at top
h = plate_thickness,
rounding = plate_corner_radius,
anchor = BOTTOM
);
}
module back_recess() {
if (recess_enabled) {
recess_rounding = max(0.5, plate_corner_radius - recess_inset/4);
// Recess now at top (Z=5) since plate is flipped for printing
translate([0, 0, plate_thickness - recess_depth - 0.01])
prismoid(
size1 = [recess_width, recess_height],
size2 = [recess_width, recess_height],
h = recess_depth + 0.02,
rounding = recess_rounding,
anchor = BOTTOM
);
}
}
// Single toggle switch slot
module switch_opening_2d() {
rect([switch_width, switch_height], rounding=switch_corner_radius);
}
// Both switch openings
module switch_openings_3d() {
translate([0, 0, -0.1])
linear_extrude(height = plate_thickness + 0.2) {
// Left switch
translate([-switch_spacing/2, 0, 0])
switch_opening_2d();
// Right switch
translate([switch_spacing/2, 0, 0])
switch_opening_2d();
}
}
// Screw holes (top and bottom)
module screw_holes() {
if (screw_holes_enabled) {
for (y_pos = [screw_hole_spacing/2, -screw_hole_spacing/2]) {
translate([0, y_pos, -0.1])
cylinder(h = plate_thickness + 0.2, d = screw_hole_diameter);
}
}
}
// ============================================
// MAIN ASSEMBLY
// ============================================
module switch_switch_plate() {
difference() {
plate_body();
back_recess();
switch_openings_3d();
screw_holes();
}
}
switch_switch_plate();

109
light-switches/switch.scad Normal file
View File

@ -0,0 +1,109 @@
// Toggle Switch Wall Plate
// Standard single-gang toggle switch cover
// Parametric OpenSCAD model
include <BOSL2/std.scad>
/* [Plate Dimensions] */
plate_width = 83.64; // mm - X dimension
plate_height = 126.64; // mm - Y dimension
plate_thickness = 5.0; // mm - Z dimension
/* [Bevel Settings] */
bevel_inset = 1.82; // mm - how much smaller bottom is per side
/* [Recess Settings] */
recess_enabled = true;
recess_depth = 2.0; // mm - depth of recess (from bottom)
recess_inset = 8.0; // mm - inset from outer edge
/* [Switch Opening] */
switch_width = 11.0; // mm - width of toggle slot
switch_height = 67.0; // mm - height of toggle slot
switch_corner_radius = 4.0; // mm - rounding at ends
/* [Screw Holes] */
screw_holes_enabled = true;
screw_hole_diameter = 5.0; // mm - diameter of screw hole
screw_hole_spacing = 100.0; // mm - distance between hole centers
/* [Corner Rounding] */
plate_corner_radius = 3.0; // mm
/* [Resolution] */
$fn = 64;
// ============================================
// CALCULATED VALUES
// ============================================
bottom_width = plate_width - (bevel_inset * 2);
bottom_height = plate_height - (bevel_inset * 2);
recess_width = plate_width - (recess_inset * 2);
recess_height = plate_height - (recess_inset * 2);
// ============================================
// MODULES
// ============================================
module plate_body() {
// Flipped for printing: front face (larger) at Z=0, back (smaller) at Z=5
// This eliminates overhang on beveled edges
prismoid(
size1 = [plate_width, plate_height], // front face (larger) at bottom
size2 = [bottom_width, bottom_height], // back face (smaller) at top
h = plate_thickness,
rounding = plate_corner_radius,
anchor = BOTTOM
);
}
module back_recess() {
if (recess_enabled) {
recess_rounding = max(0.5, plate_corner_radius - recess_inset/4);
// Recess now at top (Z=5) since plate is flipped for printing
translate([0, 0, plate_thickness - recess_depth - 0.01])
prismoid(
size1 = [recess_width, recess_height],
size2 = [recess_width, recess_height],
h = recess_depth + 0.02,
rounding = recess_rounding,
anchor = BOTTOM
);
}
}
// Toggle switch slot (rounded rectangle / stadium shape)
module switch_opening_2d() {
rect([switch_width, switch_height], rounding=switch_corner_radius);
}
module switch_opening_3d() {
translate([0, 0, -0.1])
linear_extrude(height = plate_thickness + 0.2)
switch_opening_2d();
}
module screw_holes() {
if (screw_holes_enabled) {
for (y_pos = [screw_hole_spacing/2, -screw_hole_spacing/2]) {
translate([0, y_pos, -0.1])
cylinder(h = plate_thickness + 0.2, d = screw_hole_diameter);
}
}
}
// ============================================
// MAIN ASSEMBLY
// ============================================
module switch_plate() {
difference() {
plate_body();
back_recess();
switch_opening_3d();
screw_holes();
}
}
switch_plate();