1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-04 14:37:24 +02:00

Fixed tapered PCB spacers.

This commit is contained in:
Chris Palmer
2019-07-25 21:20:41 +01:00
parent be14a52c21
commit 49ee92db8e

View File

@@ -750,14 +750,19 @@ module pcb(type) { //! Draw specified PCB
} }
} }
module pcb_spacer(screw, height, wall = 1.8) { //! Generate STL for PCB spacer module pcb_spacer(screw, height, wall = 1.8, taper = 0) { //! Generate STL for PCB spacer
stl(str("pcb_spacer", round(screw_radius(screw) * 20), round(height * 10))); stl(str("pcb_spacer", round(screw_radius(screw) * 20), round(height * 10), taper ? str("_", taper) : ""));
ir = screw_clearance_radius(screw); ir = screw_clearance_radius(screw);
or = corrected_radius(ir) + wall; or = corrected_radius(ir) + wall;
linear_extrude(height = height) if(height > taper)
poly_ring(or, ir); linear_extrude(height = height - taper)
poly_ring(or, ir);
if(taper)
linear_extrude(height = height)
poly_ring(ir + 2 * extrusion_width, ir);
} }
module pcb_base(type, height, thickness, wall = 2) { //! Generate STL for a base with PCB spacers module pcb_base(type, height, thickness, wall = 2) { //! Generate STL for a base with PCB spacers
@@ -798,12 +803,8 @@ module pcb_assembly(type, height, thickness) { //! Draw PCB assembly with spaces
screw(screw, screw_length); screw(screw, screw_length);
color(pp1_colour) color(pp1_colour)
if(taper) { if(taper)
h2 = max(0, height - 2); pcb_spacer(screw, height, taper = 2);
if(h2)
pcb_spacer(screw, h2);
pcb_spacer(screw, height, 2 * extrusion_width); // Thin as can be at the top because there is no clearance around the holes.
}
else else
pcb_spacer(screw, height); pcb_spacer(screw, height);