1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-28 00:40:39 +02:00

add center param

This commit is contained in:
Justin Lin
2019-09-26 08:10:38 +08:00
parent 1be93b3bb1
commit 55400c9d2c

View File

@@ -1,4 +1,4 @@
module joint_T(shaft_r, shaft_h, t_leng, ring_thickness, spacing) { module joint_T(shaft_r, shaft_h, t_leng, ring_thickness, spacing = 0.5, center = false) {
ring_r = shaft_r + spacing + ring_thickness; ring_r = shaft_r + spacing + ring_thickness;
module joint_ring() { module joint_ring() {
hollow_out(ring_thickness) hollow_out(ring_thickness)
@@ -6,13 +6,20 @@ module joint_T(shaft_r, shaft_h, t_leng, ring_thickness, spacing) {
} }
ring_height = shaft_h / 3 - spacing; ring_height = shaft_h / 3 - spacing;
linear_extrude(ring_height) joint_ring();
translate([0, 0, shaft_h - ring_height]) translate(center ? [0, 0, -shaft_h / 2] : [0, 0, 0]) {
linear_extrude(ring_height) joint_ring(); linear_extrude(ring_height)
joint_ring();
translate([t_leng / 2, 0, shaft_h / 2])
translate([0, 0, shaft_h - ring_height])
linear_extrude(ring_height)
joint_ring();
translate([t_leng / 2, 0, shaft_h / 2])
linear_extrude(shaft_h / 3, center = true) linear_extrude(shaft_h / 3, center = true)
square([t_leng, shaft_r * 2], center = true); square([t_leng, shaft_r * 2], center = true);
linear_extrude(shaft_h) circle(shaft_r); linear_extrude(shaft_h)
circle(shaft_r);
}
} }