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

Merge branch 'screw_socket_visibility' of https://github.com/martinbudden/NopSCADlib into martinbudden-screw_socket_visibility

This commit is contained in:
Chris Palmer
2021-11-13 18:11:05 +00:00

View File

@@ -129,6 +129,7 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
head_t = rad / 5; head_t = rad / 5;
head_height = head_rad + head_t; head_height = head_rad + head_t;
color(colour) {
rotate_extrude() rotate_extrude()
difference() { difference() {
polygon([[0, 0], [head_rad, 0], [head_rad, -head_t], [0, -head_height]]); polygon([[0, 0], [head_rad, 0], [head_rad, -head_t], [0, -head_height]]);
@@ -145,6 +146,10 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
children(); children();
} }
} }
color(colour * 0.9)
translate_z(-socket_depth)
cylinder(h=2 * eps, r=socket_rad, $fn = 6);
}
explode(length + 10) { explode(length + 10) {
if(head_type == hs_cap) { if(head_type == hs_cap) {
@@ -160,6 +165,9 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
} }
} }
color(colour * 0.9)
translate_z(head_height - socket_depth)
cylinder(h=2 * eps, r=socket_rad, $fn = 6);
shaft(); shaft();
} }
if(head_type == hs_grub) { if(head_type == hs_grub) {
@@ -179,6 +187,9 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
translate_z(-length) translate_z(-length)
cylinder(r = r, h = length - socket_depth); cylinder(r = r, h = length - socket_depth);
} }
color(colour * 0.8)
translate_z(head_height - socket_depth)
cylinder(h=2 * eps, r=socket_rad, $fn = 6);
} }
if(head_type == hs_hex) { if(head_type == hs_hex) {
color(colour) color(colour)
@@ -207,6 +218,9 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
square([socket_width, 2 * socket_rad], center = true); square([socket_width, 2 * socket_rad], center = true);
} }
} }
color(colour * 0.9)
translate_z(head_height - socket_depth)
cylinder(h=2 * eps, r=socket_rad + eps);
shaft(); shaft();
} }
@@ -234,6 +248,9 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
circle(socket_rad, $fn = 6); circle(socket_rad, $fn = 6);
} }
} }
color(colour * 0.9)
translate_z(head_height - socket_depth)
cylinder(h=2 * eps, r=socket_rad, $fn = 6);
shaft(); shaft();
} }
@@ -241,7 +258,6 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
socket_rad = 0.6 * head_rad; socket_rad = 0.6 * head_rad;
socket_depth = 0.3 * head_rad; socket_depth = 0.3 * head_rad;
socket_width = 1; socket_width = 1;
color(colour)
cs_head(socket_rad, socket_depth) { cs_head(socket_rad, socket_depth) {
square([2 * socket_rad, socket_width], center = true); square([2 * socket_rad, socket_width], center = true);
square([socket_width, 2 * socket_rad], center = true); square([socket_width, 2 * socket_rad], center = true);
@@ -251,7 +267,6 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
} }
if(head_type == hs_cs_cap) { if(head_type == hs_cs_cap) {
color(colour)
cs_head(socket_rad, socket_depth) cs_head(socket_rad, socket_depth)
circle(socket_rad, $fn = 6); circle(socket_rad, $fn = 6);