NopSCADlib/tests/belts.scad

79 lines
2.8 KiB
OpenSCAD
Raw Normal View History

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/>.
//
include <../core.scad>
include <../vitamins/pulleys.scad>
use <../vitamins/insert.scad>
2019-06-08 17:10:47 -04:00
use <../utils/layout.scad>
module belt_test() {
p2 = [-75, -50];
p3 = [-75, 100];
p4 = [75, 100];
2020-11-14 04:40:37 -05:00
p5 = [75 + pulley_pr(GT2x20ob_pulley) - pulley_pr(GT2x16_plain_idler), +pulley_pr(GT2x16_plain_idler)];
p6 = [-75 + pulley_pr(GT2x20ob_pulley) + pulley_pr(GT2x16_plain_idler), -pulley_pr(GT2x16_plain_idler)];
2019-06-08 17:10:47 -04:00
2020-11-14 04:40:37 -05:00
module pulleys(flip = false) {
translate(p2) rotate([0, flip ? 180 : 0, 0]) pulley_assembly(GT2x20ob_pulley);
translate(p3) pulley_assembly(GT2x20_toothed_idler);
translate(p4) pulley_assembly(GT2x20_toothed_idler);
translate(p5) {
pulley = GT2x16_toothed_idler;
screw = find_screw(hs_cs_cap, pulley_bore(pulley));
insert = screw_insert(screw);
2019-06-08 17:10:47 -04:00
2020-11-20 03:46:17 -05:00
hflip(flip) {
2020-11-14 04:40:37 -05:00
pulley_assembly(pulley);
translate_z(pulley_height(pulley) + pulley_offset(pulley) + screw_head_depth(screw, pulley_bore(pulley)))
screw(screw, 20);
2019-06-08 17:10:47 -04:00
2020-11-14 04:40:37 -05:00
translate_z(pulley_offset(pulley) - insert_length(insert))
vflip()
insert(insert);
}
}
translate(p6) pulley_assembly(GT2x16_plain_idler);
2019-06-08 17:10:47 -04:00
}
2020-11-14 04:40:37 -05:00
path = [ [p5.x, p5.y, pulley_pr(GT2x16_plain_idler)],
2019-06-08 17:10:47 -04:00
[p6.x, p6.y, -pulley_pr(GT2x16_plain_idler)],
[p2.x, p2.y, pulley_pr(GT2x20ob_pulley)],
[p3.x, p3.y, pulley_pr(GT2x20ob_pulley)],
[p4.x, p4.y, pulley_pr(GT2x20ob_pulley)]
];
2020-11-14 04:40:37 -05:00
2019-06-08 17:10:47 -04:00
belt = GT2x6;
belt(belt, path, 80, [0, 0]);
2020-11-14 04:40:37 -05:00
pulleys();
2020-11-14 12:18:08 -05:00
translate_z(20)
2020-11-14 04:40:37 -05:00
hflip() {
belt(belt, path, 80, [0, 0], belt_colour = grey(90), tooth_colour = grey(50));
pulleys(flip=true);
}
2019-06-08 17:10:47 -04:00
2020-11-14 12:18:08 -05:00
translate([-25, 0, 10])
2019-06-08 17:10:47 -04:00
layout([for(b = belts) belt_width(b)], 10)
rotate([0, 90, 0])
belt(belts[$i], [[0, 0, 20], [0, 1, 20]], belt_colour = $i%2==0 ? grey(90) : grey(20), tooth_colour = $i%2==0 ? grey(70) : grey(50));
2019-06-08 17:10:47 -04:00
}
if($preview)
belt_test();