2019-06-08 17:10:47 -04:00
|
|
|
//
|
|
|
|
// NopSCADlib Copyright Chris Palmer 2018
|
|
|
|
// nop.head@gmail.com
|
|
|
|
// hydraraptor.blogspot.com
|
|
|
|
//
|
|
|
|
// This file is part of NopSCADlib.
|
|
|
|
//
|
|
|
|
// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the
|
|
|
|
// GNU General Public License as published by the Free Software Foundation, either version 3 of
|
|
|
|
// the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License along with NopSCADlib.
|
|
|
|
// If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
//! Solid state relays.
|
|
|
|
//
|
2020-02-29 12:52:36 -05:00
|
|
|
include <../utils/core/core.scad>
|
2019-06-08 17:10:47 -04:00
|
|
|
|
|
|
|
function ssr_part(type) = type[1]; //! Description
|
|
|
|
function ssr_length(type) = type[2]; //! Length
|
|
|
|
function ssr_width(type) = type[3]; //! Width
|
|
|
|
function ssr_height(type) = type[4]; //! Height
|
|
|
|
function ssr_base_t(type) = type[5]; //! Thickness of metal base
|
|
|
|
function ssr_hole_d(type) = type[6]; //! Screw hole diameter
|
|
|
|
function ssr_hole_pitch(type) = type[7]; //! Difference between screw centres
|
|
|
|
function ssr_slot_w(type) = type[8]; //! Width of the screw slot in the body
|
|
|
|
|
|
|
|
module ssr_hole_positions(type) //! Place children at the screw positions
|
|
|
|
for(end = [-1, 1])
|
|
|
|
translate([end * ssr_hole_pitch(type) / 2, 0])
|
|
|
|
children();
|
|
|
|
|
|
|
|
module ssr(type) { //! Draw specified SSR
|
|
|
|
vitamin(str("ssr(", type[0], "): Solid state relay ", ssr_part(type)));
|
|
|
|
|
|
|
|
l = ssr_length(type);
|
|
|
|
w = ssr_width(type);
|
|
|
|
t = ssr_base_t(type);
|
|
|
|
h = ssr_height(type);
|
|
|
|
|
2020-03-29 15:18:57 -04:00
|
|
|
color("silver") linear_extrude(t) difference() {
|
2019-06-08 17:10:47 -04:00
|
|
|
square([l, w], center = true);
|
|
|
|
|
|
|
|
ssr_hole_positions(type)
|
|
|
|
circle(d = ssr_hole_d(type));
|
|
|
|
}
|
|
|
|
color([242/255, 236/255, 220/255])
|
|
|
|
translate_z(t)
|
2020-03-29 15:18:57 -04:00
|
|
|
linear_extrude(h - t) difference() {
|
2019-06-08 17:10:47 -04:00
|
|
|
square([l, w], center = true);
|
|
|
|
|
|
|
|
for(end = [-1, 1])
|
|
|
|
hull() {
|
|
|
|
translate([end * ssr_hole_pitch(type) / 2, 0])
|
|
|
|
circle(d = ssr_slot_w(type));
|
|
|
|
|
|
|
|
translate([end * ssr_hole_pitch(type), 0])
|
|
|
|
circle(d = ssr_slot_w(type));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
use <screw.scad>
|
|
|
|
use <nut.scad>
|
|
|
|
use <washer.scad>
|
|
|
|
|
|
|
|
module ssr_assembly(type, screw, thickness) { //! Assembly with fasteners in place
|
2021-01-15 13:12:37 -05:00
|
|
|
screw_length = screw_length(screw, thickness + ssr_base_t(type), 2, nyloc = true);
|
2019-06-08 17:10:47 -04:00
|
|
|
|
|
|
|
ssr(type);
|
|
|
|
|
|
|
|
ssr_hole_positions(type) {
|
|
|
|
translate_z(ssr_base_t(type))
|
2021-01-15 13:12:37 -05:00
|
|
|
nut_and_washer(screw_nut(screw), true);
|
2019-06-08 17:10:47 -04:00
|
|
|
|
|
|
|
translate_z(-thickness)
|
|
|
|
vflip()
|
|
|
|
screw_and_washer(screw, screw_length);
|
|
|
|
}
|
|
|
|
}
|