1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-22 15:13:15 +02:00

Added source code

This commit is contained in:
Chris Palmer
2019-06-08 22:10:47 +01:00
parent d80facf2ca
commit 34a9b0e87b
246 changed files with 18858 additions and 0 deletions

30
tests/annotation.scad Normal file
View File

@@ -0,0 +1,30 @@
//
// 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>
use <../utils/annotation.scad>
module annotations() {
arrow();
translate_z(21)
label("Text", halign = "center", valign = "bottom");
}
if($preview)
annotations();

30
tests/ball_bearings.scad Normal file
View File

@@ -0,0 +1,30 @@
//
// 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/>.
//
use <../utils/layout.scad>
include <../vitamins/ball_bearings.scad>
module ball_bearings()
layout([for(b = ball_bearings) bb_diameter(b)])
ball_bearing(ball_bearings[$i])
bearing_ball(3);
if($preview)
ball_bearings();

41
tests/batteries.scad Normal file
View File

@@ -0,0 +1,41 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/springs.scad>
include <../vitamins/batteries.scad>
module batteries()
layout([for(b = batteries) battery_diameter(b)], 5) let(battery=batteries[$i]) {
battery = batteries[$i];
rotate(-135) // To show Lumintop USB socket and LEDs
battery(battery);
contact = battery_contact(battery);
translate_z(battery_length(battery) / 2 + contact_pos(contact).x)
rotate([0, 180, 0])
battery_contact(contact);
translate_z(-battery_length(battery) / 2 - contact_neg(contact).x)
battery_contact(contact, false);
}
if($preview)
batteries();

74
tests/belts.scad Normal file
View File

@@ -0,0 +1,74 @@
//
// 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/belts.scad>
include <../vitamins/screws.scad>
include <../vitamins/inserts.scad>
include <../vitamins/pulleys.scad>
use <../utils/layout.scad>
module belt_test() {
p1 = [75, -50];
p2 = [-75, -50];
p3 = [-75, 100];
p4 = [75, 100];
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)];
translate(p1) pulley_assembly(GT2x20ob_pulley);
translate(p2) pulley_assembly(GT2x20ob_pulley);
translate(p3) pulley_assembly(GT2x20_toothed_idler);
translate(p4) pulley_assembly(GT2x20_toothed_idler);
translate(p5) {
pulley = GT2x16_plain_idler;
screw = find_screw(hs_cs_cap, pulley_bore(pulley));
insert = screw_insert(screw);
pulley_assembly(pulley);
translate_z(pulley_height(pulley) + pulley_offset(pulley) + screw_head_depth(screw, pulley_bore(pulley)))
screw(screw, 20);
translate_z(pulley_offset(pulley) - insert_length(insert))
vflip()
insert(insert);
}
translate(p6) pulley_assembly(GT2x16_plain_idler);
path = [ [p1.x, p1.y, pulley_pr(GT2x20ob_pulley)],
[p5.x, p5.y, -pulley_pr(GT2x16_plain_idler)],
[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)]
];
belt = GT2x6;
belt(belt, path, 80, [0, belt_pitch_height(belt) - belt_thickness(belt) / 2]);
translate([-25, 0])
layout([for(b = belts) belt_width(b)], 10)
rotate([0, 90, 0])
belt(belts[$i], [[0, 0, 20], [0, 1, 20]]);
}
if($preview)
belt_test();

83
tests/bezier.scad Normal file
View File

@@ -0,0 +1,83 @@
//
// 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>
use <../utils/bezier.scad>
use <../utils/sweep.scad>
use <../utils/annotation.scad>
function find_min_z(path, i = 1, best_i = 0) =
i >= len(path) ? best_i
: find_min_z(path, i + 1, path[i].z < path[best_i].z ? i : best_i);
module beziers() {
//
// Make Bezier control points to give specified length
//
control_points = adjust_bezier_length([[0, 0, 100], [0, 0, 0], [200, 0, 20], [100, -100, 50]], 250);
//
// Draw control points
//
color("green")
for(p = control_points)
translate(p)
sphere(1);
//
// Lines joining the control points
//
color("red")
sweep(control_points, circle_points(0.5, $fn = 64));
//
// Bezier curve path from control points
//
curve = bezier_path(control_points);
//
// Draw the curve
//
sweep(curve, circle_points(2, $fn = 64));
//
// Length computed from control points
//
length = bezier_length(control_points);
//
// Length computed from curve
//
length2 = path_length(curve);
assert(str(length) == str(length2), str(length, " ", length2));
//
// Minimum Z
//
min_z = bezier_min_z(control_points);
i = find_min_z(curve);
assert(str(min_z) == str(curve[i].z));
color("blue") {
translate(curve[i] + [0, 0, 2])
arrow();
translate(curve[i] - [0, 0, 2])
vflip()
arrow();
}
translate(control_points[1] - [0, 0, 2])
label(str("bezier_length = ", length, ", bezier_min_z = ", bezier_min_z(curve)), valign = "top");
}
if($preview)
beziers();

41
tests/blowers.scad Normal file
View File

@@ -0,0 +1,41 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/blowers.scad>
module blowers()
layout([for(b = blowers) blower_width(b)], 10, true) let(b = blowers[$i]){
screw = blower_screw(b);
washer = screw_washer(screw);
h = blower_lug(b);
blower(b);
blower_hole_positions(b)
translate_z(h)
screw_and_washer(screw, screw_longer_than(h + washer_thickness(washer) + 5));
}
if($preview)
blowers();

108
tests/bom.scad Normal file
View File

@@ -0,0 +1,108 @@
//
// 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/>.
//
//
//! BOM and assembly demonstration
//
include <../core.scad>
include <../vitamins/screws.scad>
include <../vitamins/inserts.scad>
include <../vitamins/sheets.scad>
$explode = 1; // Normally set on the command line when generating assembly views with views.py
screw = M3_cap_screw;
sheet = PMMA3;
height = 10;
insert = screw_insert(screw);
washer = screw_washer(screw);
module widget(thickness) {
vitamin(str("widget(", thickness, "): Rivit like thing for ", thickness, "mm sheets"));
t = 1;
color("silver") {
cylinder(d = 3, h = thickness + 2 * eps, center = true);
for(end = [-1, 1])
translate_z(end * (thickness / 2 + t / 2 + eps))
cylinder(d = 4, h = t, center = true);
}
}
module widgit_stl() {
stl("widget");
union() {
rounded_rectangle([30, 30, 3], 2);
render() insert_boss(insert, height, 2.2);
}
}
module widgit_dxf() {
dxf("widget");
difference() {
sheet_2D(sheet, 20, 20, 1);
drill(screw_clearance_radius(screw), 0);
}
}
//! * Push the insert into the base with a soldering iron heated to 200&deg;C
module widgit_base_assembly()
assembly("widgit_base") {
color(pp1_colour)
widgit_stl();
translate_z(height)
insert(insert);
}
//! * Magically insert the widget into the acrylic sheet
module widget_top_assembly()
assembly("widget_top") {
translate([-5, 5])
widget(sheet_thickness(sheet));
render_2D_sheet(sheet) // Must be last because it is transparent
widgit_dxf();
}
//! * Screw the two assemblies together
module widgit_assembly()
assembly("wigdit") {
widgit_base_assembly(); // Note this is not exloded because it is sub-assembly
translate_z(height) {
translate_z(sheet_thickness(sheet))
screw_and_washer(screw, screw_longer_than(sheet_thickness(sheet) + 2 * washer_thickness(washer) + 3), true);
explode(5)
translate_z(sheet_thickness(sheet) / 2 + eps)
widget_top_assembly();
}
}
module boms() {
widgit_assembly();
}
boms();

54
tests/box.scad Normal file
View File

@@ -0,0 +1,54 @@
//
// 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/screws.scad>
include <../vitamins/sheets.scad>
include <../vitamins/inserts.scad>
use <../box.scad>
box = [M3_dome_screw, 3, DiBond, PMMA3, DiBond6, true, 150, 100, 70];
include <../box_assembly.scad>
module box_assembly() _box_assembly(box);
module box_test() {
translate_z(box_height(box) / 2 + box_bezel_height(box, true))
box_assembly();
rows = 3;
cols = 3;
gap = 30;
x_pitch = (box_width(box) + 2 * box_outset(box)) / cols + gap;
y_pitch = (box_depth(box) + 2 * box_outset(box)) / rows + gap;
for(x = [0 : cols - 1], y = [0 : rows - 1])
translate([(x - cols / 2) * x_pitch + gap / 2, (y - rows / 2) * y_pitch + gap / 2])
color((x + y) % 2 ? pp1_colour : pp2_colour) box_bezel_section(box, true, rows, cols, x, y);
translate([-cols / 2 * x_pitch - 20, 0])
for(i = [0 : 2])
translate([0, (i - 1) * 20, 0])
color(i % 2 ? pp1_colour : pp2_colour) box_corner_profile_section(box, i, 3);
}
if($preview)
box_test();

29
tests/bulldogs.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/bulldogs.scad>
module bulldogs()
layout([for(b = bulldogs) bulldog_depth(b)], 5, true)
bulldog(bulldogs[$i]);
if($preview)
bulldogs();

66
tests/butt_box.scad Normal file
View File

@@ -0,0 +1,66 @@
//
// 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/screws.scad>
include <../vitamins/sheets.scad>
include <../vitamins/inserts.scad>
include <../butt_box.scad>
$explode = 0;
box = [M3_dome_screw, DiBond, DiBond6, PMMA3, 250, 400, 300, 120];
module bbox_assembly() _bbox_assembly(box);
module bbox_test() {
translate_z(bbox_height(box) / 2)
bbox_assembly();
}
if($preview)
bbox_test();
else {
gap = 2;
bb = sheet_thickness(bbox_base_sheet(box));
bt = sheet_thickness(bbox_top_sheet(box));
h = bbox_height(box) + bb;
h2 = h + bt;
bbox_base_blank(box);
translate([bbox_width(box) / 2 + gap + h / 2 - bb / 2, 0])
rotate(90)
bbox_right_blank(box);
translate([-bbox_width(box) / 2 - gap - h / 2 + bb / 2, 0])
rotate(-90)
bbox_left_blank(box);
translate([0, bbox_depth(box) / 2 + gap + h / 2 - bb / 2])
rotate(180)
bbox_back_blank(box);
translate([0, -bbox_depth(box) / 2 - gap - h2 / 2 - (bt - bb) / 2])
bbox_front_blank(box);
translate([0, -bbox_depth(box) / 2 - gap - h2 - gap - bbox_depth(box) / 2 - sheet_thickness(bbox_sheets(box))])
bbox_top_blank(box);
}

29
tests/buttons.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/buttons.scad>
module buttons()
layout([for(b = buttons) square_button_width(b)], 5)
square_button(buttons[$i]);
if($preview)
buttons();

36
tests/cable_grommets.scad Normal file
View File

@@ -0,0 +1,36 @@
//
// 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>
use <../cable_grommets.scad>
module cable_grommets() {
rotate(90)
color(pp1_colour) ribbon_grommet(20, 3);
translate([20, 0])
round_grommet_assembly(6, 3);
translate([40, 0])
rotate(90)
color(pp1_colour) mouse_grommet(5, 3);
}
if($preview)
cable_grommets();

38
tests/cable_strips.scad Normal file
View File

@@ -0,0 +1,38 @@
//
// 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>
use <../vitamins/cable_strip.scad>
module cable_strips() {
depth = 50;
rotate(-90)
for(pos = [-100, 0, 100]) {
bezier_cable_strip(ways = 20, depth = depth, length = 150, travel = 100, pos = pos, below = 100, extra = 10);
translate([0, depth * 2])
rotate([0, -90, 0])
cable_strip(ways =20, depth = depth / 2, travel = 100, x = pos, extra = 30);
}
}
if($preview)
cable_strips();

25
tests/carriers.scad Normal file
View File

@@ -0,0 +1,25 @@
//
// 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>
use <../carriers.scad>
module carriers()
color(pp1_colour) ESP12F_carrier_stl();
carriers();

26
tests/clip.scad Normal file
View File

@@ -0,0 +1,26 @@
//
// 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>
module clips() {
clip(xmin = 0, ymin = 0, zmin = 0, zmax = 40) sphere(50);
}
clips();

57
tests/components.scad Normal file
View File

@@ -0,0 +1,57 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/components.scad>
module resistors()
layout([for(r = resistors) resistor_diameter(r)], 10)
resistor(resistors[$i]);
module al_clad_resistors()
layout([for(a = al_clad_resistors) al_clad_width(a)])
rotate(90)
al_clad_resistor_assembly(al_clad_resistors[$i], 4.7)
screw(al_clad_hole(al_clad_resistors[$i]) > 3 ? M3_pan_screw : M2p5_pan_screw, 16);
module thermal_cutouts()
layout([for(t = thermal_cutouts) tc_length(t)])
thermal_cutout(thermal_cutouts[$i]);
module components() {
resistors();
translate([0, 50])
TO220("Generic TO220 package");
translate([30, 50])
panel_USBA();
translate([0,80])
thermal_cutouts();
translate([0, 130])
al_clad_resistors();
}
if($preview)
components();

37
tests/corner_block.scad Normal file
View File

@@ -0,0 +1,37 @@
//
// 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>
use <../corner_block.scad>
include <../vitamins/screws.scad>
screws = [M2_cap_screw, M2p5_pan_screw, M3_dome_screw, M4_dome_screw];
module do_corner_block(screw)
if($preview)
fastened_corner_block_assembly(3, screw = screw);
else
corner_block(screw);
module corner_blocks()
for(i = [0 : len(screws) - 1])
translate([i * 30, 0])
do_corner_block(screws[i]);
corner_blocks();

38
tests/d_connectors.scad Normal file
View File

@@ -0,0 +1,38 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/d_connectors.scad>
module d_connectors()
for(socket = [false, true])
translate([socket ? len(d_connectors) * (d_flange_width(d_connectors[0]) + 10) : 0, 0])
layout([for(d = d_connectors) d_flange_width(d)], 10) let(d = d_connectors[$i])
rotate(90) {
d_plug(d, socket, pcb = $i == 2, idc = $i == 1);
if(socket)
translate_z(d_flange_thickness(d))
d_connector_holes(d)
d_pillar();
}
if($preview)
d_connectors();

29
tests/displays.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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/>.
//
use <../utils/layout.scad>
include <../vitamins/displays.scad>
use <../vitamins/pcb.scad>
module displays()
layout([for(d = displays) pcb_length(display_pcb(d))], 10)
display(displays[$i]);
if($preview)
displays();

34
tests/dogbones.scad Normal file
View File

@@ -0,0 +1,34 @@
//
// 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 <../global_defs.scad>
use <../utils/dogbones.scad>
module dogbones() {
#linear_extrude(height = eps)
dogbone_square([10, 20]);
#translate([15, 0])
dogbone_rectangle([10, 20, 5], center = false);
sq = 3;
translate([-5 + sq / 2 + eps, -10 + sq / 2 + eps])
%cube([sq, sq, 1], center = true);
}
dogbones();

57
tests/door_hinge.scad Normal file
View File

@@ -0,0 +1,57 @@
//
// 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>
use <../door_hinge.scad>
include <../vitamins/sheets.scad>
use <../vitamins/screw.scad>
door_w = 50;
door_h = 50;
sheet = PMMA6;
module door_hinges() {
translate([door_hinge_stat_length() / 2 - door_hinge_pin_x(), 0])
if($preview) {
for(side = [-1, 1])
translate_z(side * door_h / 2) {
door_hinge_assembly(side > 0, sheet_thickness(sheet));
door_hinge_static_assembly(side > 0, 3);
}
translate([door_w / 2 + eps, door_hinge_pin_y() - eps])
rotate([90, 0, 0])
render_2D_sheet(sheet)
difference() {
sheet_2D(sheet, door_w, door_h, 3);
for(z =[-1, 1])
translate([-door_w / 2, z * door_h / 2])
door_hinge_hole_positions(z)
drill(screw_pilot_hole(door_hinge_screw()), 0);
}
translate([door_w, 0])
children();
}
else
door_hinge_parts_stl();
}
door_hinges();

29
tests/door_latch.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../door_latch.scad>
module door_latches()
translate([door_latch_offset(), 0])
if($preview)
door_latch_assembly(3);
else
door_latch_stl();
door_latches();

29
tests/fan_guard.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../fan_guard.scad>
include <../vitamins/fans.scad>
module fan_guards()
layout([for(f = fans) fan_width(f)], 10)
color(pp1_colour) fan_guard(fans[$i], spokes = fan_width(fans[$i]) > 40 ? 8 : 4);
fan_guards();

31
tests/fans.scad Normal file
View File

@@ -0,0 +1,31 @@
//
// 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>
use <../utils/layout.scad>
include <../fan_guard.scad>
include <../vitamins/fans.scad>
module fans()
layout([for(f = fans) fan_width(f)], 10)
fan_assembly(fans[$i], 3 + fan_guard_thickness(), true);
if($preview)
fans();

26
tests/fillet.scad Normal file
View File

@@ -0,0 +1,26 @@
//
// 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 <../global_defs.scad>
use <../utils/fillet.scad>
module fillets() {
fillet(3, 25);
}
fillets();

37
tests/fixing_block.scad Normal file
View File

@@ -0,0 +1,37 @@
//
// 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>
use <../fixing_block.scad>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
screws = [M2_cap_screw, M2p5_pan_screw, M3_dome_screw, M4_dome_screw];
module fixing_block_test(screw)
if($preview)
fastened_fixing_block_assembly(3, screw = screw);
else
fixing_block(screw);
module fixing_blocks()
layout([for(s = screws) fixing_block_width(s)], 5)
fixing_block_test(screws[$i]);
fixing_blocks();

37
tests/foot.scad Normal file
View File

@@ -0,0 +1,37 @@
//
// 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>
use <../foot.scad>
module feet()
if($preview) {
translate([50, 0])
foot_assembly(3);
translate([foot_diameter(insert_foot()) / 2, 0])
fastened_insert_foot_assembly(3);
}
else {
translate([50, 0])
foot();
insert_foot();
}
feet();

27
tests/fuseholder.scad Normal file
View File

@@ -0,0 +1,27 @@
//
// 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>
use <../vitamins/fuseholder.scad>
module fuseholders()
fuseholder(6);
if($preview)
fuseholders();

31
tests/global.scad Normal file
View File

@@ -0,0 +1,31 @@
//
// 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>
module globals() {
linear_extrude(height = eps) {
semi_circle(r = 10);
translate([30, 0])
ellipse(15, 7);
}
}
rotate([70, 0, 315]) globals();

29
tests/handle.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../handle.scad>
module handle()
translate([handle_length() / 2, 0])
if($preview)
handle_fastened_assembly(3);
else
handle_stl();
handle();

28
tests/hanging_hole.scad Normal file
View File

@@ -0,0 +1,28 @@
//
// 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 <../global_defs.scad>
use <../utils/hanging_hole.scad>
module hanging_holes() {
rotate(45)
#hanging_hole(z = 10, ir = 3, h = 30)
circle(r = 10);
}
hanging_holes();

31
tests/hot_ends.scad Normal file
View File

@@ -0,0 +1,31 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/hot_ends.scad>
module hot_ends()
layout([for(h = hot_ends) 40])
translate([-20, 0])
rotate(90)
hot_end(hot_ends[$i], 3);
if($preview)
hot_ends();

30
tests/iecs.scad Normal file
View File

@@ -0,0 +1,30 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/iecs.scad>
module iecs()
layout([for(i = iecs) iec_flange_h(i)], 10)
rotate(90)
iec_assembly(iecs[$i], 3);
if($preview)
iecs();

30
tests/inserts.scad Normal file
View File

@@ -0,0 +1,30 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/inserts.scad>
module inserts()
for(i = [0: len(inserts) -1])
translate([10 * i, 0])
insert(inserts[i]);
if($preview)
inserts();

35
tests/jack.scad Normal file
View File

@@ -0,0 +1,35 @@
//
// 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>
use <../vitamins/jack.scad>
module jacks() {
translate([0, 0])
jack_4mm("blue",3, "royalblue");
translate([20, 0])
jack_4mm_shielded("brown", 3, "sienna");
translate([40, 0])
post_4mm("red",3);
}
if($preview)
jacks();

30
tests/layout.scad Normal file
View File

@@ -0,0 +1,30 @@
//
// 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 <../global_defs.scad>
use <../utils/layout.scad>
diams = [3, 7, 5, 11];
module layouts() {
linear_extrude(height = eps)
layout(diams, gap = 1)
circle(d = diams[$i]);
}
rotate([70, 0, 315]) layouts();

30
tests/leadnuts.scad Normal file
View File

@@ -0,0 +1,30 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/leadnuts.scad>
module leadnuts()
layout([for(n = leadnuts) leadnut_flange_dia(n)], 5)
leadnut(leadnuts[$i]);
if($preview)
leadnuts();

29
tests/leds.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/leds.scad>
module leds()
layout([for(l = LEDs) led_diameter(l)], 5)
led(LEDs[$i], ["green", "blue", "red"][$i % 3]);
if($preview)
leds();

38
tests/light_strips.scad Normal file
View File

@@ -0,0 +1,38 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/light_strips.scad>
module light_strips()
layout([for(s = light_strips) light_strip_width(s)], 10)
rotate(90) let(light = light_strips[$i], segs = light_strip_segments(light, 260), d = light_strip_clip_depth(light)) {
light_strip(light, segs);
for(end = [-1, 1])
translate([end * (light_strip_cut_length(light, segs) / 2 - d / 2), 0])
rotate([90, 0, 90])
color("lime") render()
translate_z(-d / 2)
light_strip_clip(light);
}
if($preview)
light_strips();

View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/linear_bearings.scad>
module linear_bearings()
layout([for(b = linear_bearings) 2 * bearing_radius(b)])
linear_bearing(linear_bearings[$i]);
if($preview)
linear_bearings();

29
tests/mains_sockets.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/mains_sockets.scad>
module mains_sockets()
layout([for(s = mains_sockets) mains_socket_width(s)], 5)
mains_socket(mains_sockets[$i]);
if($preview)
mains_sockets();

70
tests/maths.scad Normal file
View File

@@ -0,0 +1,70 @@
//
// 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>
use <../utils/maths.scad>
use <../utils/annotation.scad>
tip = [0, 0, 20];
module shape() {
cylinder(d1 = 20, d2 = 0, h = tip.z);
}
t = [10, 20, 30];
r = [45, 20, 70];
s = [1, 0.5, 0.75];
module maths() {
//
// Translate, rotate and scale the shape
//
translate(t)
rotate(r)
scale(s)
shape();
//
// Apply the same transformations to the vector position of the tip
//
p = transform(tip, translate(t) * rotate(r) * scale(s));
//
// Place an arrow where the tip ends up
//
translate(p)
arrow();
//
// Unit vector pointing at p
//
u = unit(p);
//
// Point arrow in same direction
//
z = [0, 0, 1];
v = cross(u, z);
a = acos(u * z);
l = 20;
rotate(-a, v)
translate_z(l)
vflip()
arrow(l);
}
rotate(45)
maths();

39
tests/meter.scad Normal file
View File

@@ -0,0 +1,39 @@
//
// 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>
use <../vitamins/meter.scad>
module meters()
if($preview) {
meter_assembly();
translate([0, meter_bezel_width() + 5])
vflip()
meter_assembly();
translate([0, -meter_bezel_width()])
rotate([0, 180, 0])
meter(colour = "blue", value = "123");
}
else
meter_bezel();
meters();

29
tests/microswitches.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/microswitches.scad>
module microswitches()
layout([for(i = microswitches) microswitch_length(i)], 5)
microswitch(microswitches[$i]);
if($preview)
microswitches();

21
tests/microview.scad Normal file
View File

@@ -0,0 +1,21 @@
//
// 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/>.
//
use <../vitamins/microview.scad>
microview(!$preview);

30
tests/modules.scad Normal file
View File

@@ -0,0 +1,30 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/modules.scad>
module modules()
layout([for(m = modules) mod_length(m)], 5)
module_assembly(modules[$i], 3);
if($preview)
modules();

51
tests/nuts.scad Normal file
View File

@@ -0,0 +1,51 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
module nuts() {
for(nyloc = [false, true])
translate([0, nyloc ? 20 : 0])
layout([for(n = nuts) 2 * nut_radius(n)], 5)
nut(nuts[$i], nyloc);
translate([0, 40])
layout([for(n = nuts) 2 * nut_radius(n)], 5) let(n = nuts[$i]) {
if(n == M3_nut)
nut(n, brass = true);
if(n == M2p5_nut)
nut(n, nylon = true);
if(n == M4_nut)
rotate(-45)
wingnut(M4_wingnut);
if(n == M6_nut)
nut_and_washer(M6_half_nut, false);
if(n == M8_nut)
#nut_trap(M8_cap_screw, n, h = 30);
}
}
if($preview)
nuts();

25
tests/o_ring.scad Normal file
View File

@@ -0,0 +1,25 @@
//
// 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/>.
//
use <../vitamins/o_ring.scad>
module o_rings()
O_ring(2.5, 1.6, 3);
if($preview)
o_rings();

39
tests/offset.scad Normal file
View File

@@ -0,0 +1,39 @@
//
// 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>
use <../utils/offset.scad>
module shape()
difference() {
cube(40, center = true);
cube([20, 20, 41], center = true);
}
module offsets() {
$fn = 20;
for(x = [-1, 0, 1])
translate([50 * x, 0])
offset_3D(3 * x, chamfer_base = true)
shape();
}
offsets();

32
tests/opengrab.scad Normal file
View File

@@ -0,0 +1,32 @@
//
// 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>
use <../vitamins/opengrab.scad>
module opengrab_test() {
opengrab_target();
rotate(45)
translate_z(opengrab_target_thickness())
opengrab();
}
if($preview)
opengrab_test();

32
tests/pcbs.scad Normal file
View File

@@ -0,0 +1,32 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/d_connectors.scad>
include <../vitamins/pcbs.scad>
module pcbs()
layout([for(p = pcbs) pcb_width(p)], 15)
translate([0, pcb_length(pcbs[$i]) / 2])
rotate(90)
pcb_assembly(pcbs[$i], 5 + $i, 3);
if($preview)
pcbs();

29
tests/pillars.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/pillars.scad>
module pillars()
layout([for(p = pillars) pillar_od(p)], 5)
pillar(pillars[$i]);
if($preview)
pillars();

77
tests/polyholes.scad Normal file
View File

@@ -0,0 +1,77 @@
//
// 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>
use <../vitamins/rod.scad>
include <../vitamins/sheets.scad>
module polyholes() {
module positions()
for(i = [1 : 10]) {
translate([(i * i + i) / 2 + 3 * i , 8])
let($r = i / 2)
children();
let(d = i + 0.5)
translate([(d * d + d) / 2 + 3 * d, 19])
let($r = d / 2)
children();
}
color(pp1_colour) linear_extrude(height = 3, center = true)
difference() {
square([100, 27]);
positions()
poly_circle(r = $r);
}
positions()
rod(d = 2 * $r, l = 8 * $r + 5);
//
// Poly rings
//
ir = 3 / 2;
cir = corrected_radius(ir);
sizes = [1.5, 2, 3, 4];
for(i = [0 : len(sizes) - 1])
translate([i * 10, -10]) {
color(pp1_colour) linear_extrude(height = 1)
poly_ring(ir = ir, or = cir + sizes[i] * extrusion_width);
rod(2 * ir, 3);
}
//
// Drill and slot
//
sheet = Steel06;
translate([10, -30])
render_2D_sheet(sheet)
difference() {
sheet_2D(sheet, 20, 20, 1);
translate([0, 5])
slot(1.5, 6, 0);
translate([0, -5])
drill(2, 0);
}
}
polyholes();

36
tests/psus.scad Normal file
View File

@@ -0,0 +1,36 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/psus.scad>
module psus()
layout([for(p = psus) psu_width(p)], 10) let(p = psus[$i])
rotate(atx_psu(p) ? 0 : 90) {
psu(p);
psu_screw_positions(p)
translate_z(3)
screw_and_washer(psu_screw(p), 8);
}
if($preview)
psus();

32
tests/pulleys.scad Normal file
View File

@@ -0,0 +1,32 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/belts.scad>
include <../vitamins/pulleys.scad>
module pulleys()
layout([for(p = pulleys) pulley_flange_dia(p)])
rotate(-45)
pulley_assembly(pulleys[$i]);
if($preview)
pulleys();

29
tests/quadrant.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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 <../global_defs.scad>
use <../utils/quadrant.scad>
module quadrants() {
linear_extrude(height = eps)
quadrant(10, 4);
}
rotate([70, 0, 315]) quadrants();

48
tests/rails.scad Normal file
View File

@@ -0,0 +1,48 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/rails.scad>
use <../vitamins/nut.scad>
sheet = 3;
module rails()
layout([for(l = rails) carriage_width(rail_carriage(l))], 25)
rotate(-90) {
rail = rails[$i];
length = rail == MGN15 ? 260 : 200;
screw = rail_screw(rail);
nut = screw_nut(screw);
washer = screw_washer(screw);
rail_assembly(rail, length, rail_travel(rail, length) / 2);
rail_screws(rail, length, sheet + nut_thickness(nut, true) + washer_thickness(washer));
rail_hole_positions(rail, length, 0)
translate_z(-sheet)
vflip()
nut_and_washer(nut, true);
}
if($preview)
rails();

35
tests/ribbon_clamp.scad Normal file
View File

@@ -0,0 +1,35 @@
//
// 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>
use <../ribbon_clamp.scad>
use <../vitamins/wire.scad>
ways = 20;
module ribbon_clamps()
translate([ribbon_clamp_length(ways) / 2, 0])
if($preview) {
ribbon_clamp_fastened_assembly(ways, 3);
ribbon_cable(ways, 100);
}
else
ribbon_clamp(ways);
ribbon_clamps();

31
tests/ring_terminals.scad Normal file
View File

@@ -0,0 +1,31 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/ring_terminals.scad>
module ring_terminals()
layout([for(t = ring_terminals) ringterm_od(t)], 5)
rotate(90)
ring_terminal_assembly(ring_terminals[$i], 3);
if($preview)
ring_terminals();

29
tests/rockers.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/rockers.scad>
module rockers()
layout([for(r = rockers) rocker_flange_w(r)], 5)
rocker(rockers[$i]);
if($preview)
rockers();

31
tests/rod.scad Normal file
View File

@@ -0,0 +1,31 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/linear_bearings.scad>
use <../vitamins/rod.scad>
module rods()
layout([for(b = linear_bearings) 2 * bearing_radius(b)])
rod(bearing_rod_dia(linear_bearings[$i]), 80);
if($preview)
rods();

42
tests/round.scad Normal file
View File

@@ -0,0 +1,42 @@
//
// 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>
use <../utils/round.scad>
module shape()
difference() {
square(40, center = true);
square([20, 20], center = true);
}
module rounds() {
linear_extrude(height = eps)
round(or = 4, ir = 2)
shape();
translate([50, 0])
round_3D(or = 4, ir = 2, chamfer_base = true, $fn = 16)
linear_extrude(height = 40, center = true)
shape();
}
rounds();

View File

@@ -0,0 +1,32 @@
//
// 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 <../global_defs.scad>
use <../utils/rounded_cylinder.scad>
module rounded_cylinders() {
linear_extrude(height = eps)
rounded_corner(10, 20, 3, 5);
translate([30, 10])
rounded_cylinder(10, 20, 3, 5, 270);
}
rounded_cylinders();

View File

@@ -0,0 +1,57 @@
//
// 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 <../global_defs.scad>
use <../utils/rounded_polygon.scad>
use <../utils/annotation.scad>
r = 5;
h = 40;
h2 = 20;
h3 = 30;
w = 100;
w2 = 70;
w3 = 30;
profile = [
[ -w / 2 + r, r, r],
[ -w / 2 + r / 2, 2 * r + eps, -eps],
[-w2 / 2, h - r, r],
[-w3 / 2, h2 + r,-r],
[ 0, h3 - r, r],
[ w3 / 2, h2 + r,-r],
[ w2 / 2, h - r, r],
[ w / 2 - r / 2, 2 * r + eps, -eps],
[ w / 2 - r, r, r],
];
module rounded_polygons() {
tangents = rounded_polygon_tangents(profile);
length = rounded_polygon_length(profile, tangents);
rotate([70, 0, 315])
linear_extrude(height = eps)
rounded_polygon(profile, tangents);
translate([0, -10])
label(str("perimeter length = ", length), valign = "top", halign = "right");
}
rounded_polygons();

View File

@@ -0,0 +1,30 @@
//
// 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>
module rounded_rectangles() {
linear_extrude(height = eps)
rounded_square([30, 20], 3);
translate([40, 0])
rounded_rectangle([30, 20, 10], 3);
}
rounded_rectangles();

37
tests/screw_knob.scad Normal file
View File

@@ -0,0 +1,37 @@
//
// 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>
use <../screw_knob.scad>
include <../vitamins/screws.scad>
screws = [M3_hex_screw, M4_hex_screw];
module do_screw_knob(screw)
if($preview)
screw_knob_assembly(screw, 16);
else
screw_knob(screw);
module screw_knobs()
for(i = [0 : len(screws) - 1])
translate([i * 30, 0])
do_screw_knob(screws[i]);
screw_knobs();

37
tests/screws.scad Normal file
View File

@@ -0,0 +1,37 @@
//
// 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/screws.scad>
module screws()
for(y = [0 : len(screw_lists) -1])
for(x = [0 : len(screw_lists[y]) -1]) {
screw = screw_lists[y][x];
if(screw) {
length = screw_max_thread(screw)
? screw_longer_than(screw_max_thread(screw) + 5)
: screw_head_type(screw) == hs_grub ? 6 : 30;
translate([x * 20, y * 20])
screw(screw, length);
}
}
if($preview)
screws();

26
tests/sealing_strip.scad Normal file
View File

@@ -0,0 +1,26 @@
//
// 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>
use <../vitamins/sealing_strip.scad>
module sealing_strip_test()
sealing_strip(100);
if($preview)
sealing_strip_test();

29
tests/sector.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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 <../global_defs.scad>
use <../utils/sector.scad>
module sectors() {
linear_extrude(height = eps)
sector(50, 45, 180);
}
rotate([70, 0, 315]) sectors();

31
tests/sheets.scad Normal file
View File

@@ -0,0 +1,31 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/sheets.scad>
width = 30;
module sheets()
layout([for(s = sheets) width], 5)
render_sheet(sheets[$i]) sheet(sheets[$i], width, width, 2);
if($preview)
sheets();

31
tests/socket_box.scad Normal file
View File

@@ -0,0 +1,31 @@
//
// 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/>.
//
$explode = 1;
include <../core.scad>
use <../utils/layout.scad>
include <../vitamins/mains_sockets.scad>
use <../socket_box.scad>
module socket_boxes()
layout([for(s = mains_sockets) mains_socket_width(s)], 20)
if($preview)
socket_box_fastened_assembly(mains_sockets[$i], 3);
else
socket_box_stl(mains_sockets[$i]);
socket_boxes();

29
tests/spades.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/spades.scad>
module spades()
layout([for(s = spades) spade_w(s)], 5)
spade(spades[$i], 10);
if($preview)
spades();

31
tests/sphere.scad Normal file
View File

@@ -0,0 +1,31 @@
//
// 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>
r = 20;
verts = [4, 8, 12, 16, 20, 24, 28, 32];
module spheres()
for(i = [0: len(verts)-1], $fn =verts[i])
translate([i * 2 * r, 0])
sphere(r);
spheres();

31
tests/spools.scad Normal file
View File

@@ -0,0 +1,31 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/spools.scad>
module spools()
layout([for(s = spools) spool_height(s)], 100)
rotate([90, 0, 90])
spool(spools[$i]);
if($preview)
spools();

29
tests/springs.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/springs.scad>
module springs()
layout([for(s = springs) spring_od2(s)], 5)
comp_spring(springs[$i]);
if($preview)
springs();

30
tests/ssrs.scad Normal file
View File

@@ -0,0 +1,30 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/ssrs.scad>
module ssrs()
layout([for(s = ssrs) ssr_length(s)], 15)
ssr_assembly(ssrs[$i], M4_cap_screw, 3);
if($preview)
ssrs();

34
tests/stepper_motors.scad Normal file
View File

@@ -0,0 +1,34 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/stepper_motors.scad>
module stepper_motors()
layout([for(s = stepper_motors) NEMA_width(s)], 5) {
rotate(180)
NEMA(stepper_motors[$i]);
NEMA_screws(stepper_motors[$i], M3_pan_screw);
}
if($preview)
stepper_motors();

34
tests/strap_handle.scad Normal file
View File

@@ -0,0 +1,34 @@
//
// 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>
use <../strap_handle.scad>
length = 150;
module strap_handles()
if($preview)
strap_assembly(length);
else {
strap(length);
translate([0, 30])
strap_end();
}
strap_handles();

53
tests/sweep.scad Normal file
View File

@@ -0,0 +1,53 @@
//
// 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>
use <../utils/sweep.scad>
use <../utils/maths.scad>
use <../utils/bezier.scad>
L_points = [[0, 5, 0], [ 2, 5, 0], [2, 2, 0], [10, 2, 0], [10, 0, 0], [0, 0, 0]];
rad = 90;
loop = circle_points(rad, $fn = 180);
loop_x = transform_points(loop, rotate([90, -90, $t * 360]));
loop_y = transform_points(loop, rotate([0, -90, $t * 360]));
loop_z = transform_points(loop, rotate([$t * 360, 0, 0]));
sweep(loop_z, L_points, loop = true);
sweep(loop_x, L_points, loop = true);
sweep(loop_y, L_points, loop = true);
knot = [ for(i=[0:.2:359])
[ (19*cos(3*i) + 40)*cos(2*i),
(19*cos(3*i) + 40)*sin(2*i),
19*sin(3*i) ] ];
sweep(knot, L_points, loop = true, twist = 0);
p = transform_points([[0,0,0], [20,0,5], [10,30,4], [0,0,0], [0,0,20]], scale(10));
n = 100;
path = bezier_path(p, n);
rotate(45) sweep(path, circle_points(5, $fn = 64));

43
tests/teardrops.scad Normal file
View File

@@ -0,0 +1,43 @@
//
// 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>
module teardrops() {
color(pp1_colour)
rotate([90, 0, -45])
linear_extrude(height = 3)
difference() {
square(40);
translate([10, 10])
teardrop(h = 0, r = 3);
translate([10, 20])
teardrop_plus(h = 0, r = 3);
translate([20, 30])
tearslot(h = 0, r = 3, w = 10);
translate([30, 15])
vertical_tearslot(h = 0, r =3, l = 10);
}
}
teardrops();

30
tests/toggles.scad Normal file
View File

@@ -0,0 +1,30 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/toggles.scad>
module toggles()
layout([for(t = toggles) toggle_width(t)], 16)
toggle(toggles[$i], 3);
if($preview)
toggles();

31
tests/transformers.scad Normal file
View File

@@ -0,0 +1,31 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/transformers.scad>
module transformers()
layout([for(t = transformers) tx_depth(t)], 10)
rotate(90)
transformer(transformers[$i]);
if($preview)
transformers();

32
tests/tube.scad Normal file
View File

@@ -0,0 +1,32 @@
//
// 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 <../global_defs.scad>
use <../utils/tube.scad>
module tubes() {
linear_extrude(height = eps)
ring(10, 8);
translate([50, 10])
tube(10, 8, 30);
}
tubes();

29
tests/tubings.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/tubings.scad>
module tubings()
layout([for(t = tubings) tubing_od(t)], 10)
tubing(tubings[$i]);
if($preview)
tubings();

31
tests/variacs.scad Normal file
View File

@@ -0,0 +1,31 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
include <../vitamins/variacs.scad>
module variacs()
layout([for(v = variacs) 2 * (variac_bulge_dia(v) - variac_diameter(v) / 2)], 25)
rotate(-90)
variac(variacs[$i]);
if($preview)
variacs();

48
tests/veroboard.scad Normal file
View File

@@ -0,0 +1,48 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/screws.scad>
use <../vitamins/veroboard.scad>
z_cable_ways = 20;
z_vb = ["z_vb", "z_bed_terminal", 5, z_cable_ways / 2 + 12, inch(0.1), false, M3_dome_screw,
[[2,2],[2,-3]], [], [5, 7, 9],
[
[3, z_cable_ways / 4 + 5.5, 0, "term254", z_cable_ways / 2, [1, 3]],
[0.5, z_cable_ways / 4 + 5.5, 90, "transition", z_cable_ways / 2, [1, 3]],
],
[
[[0,1,3], 6], [[0,1,3], 8], [[0,1,3],[10 : 6 + z_cable_ways / 2 - 1]],
]
];
module veroboard_test() translate([vero_length(z_vb) / 2, vero_width(z_vb) / 2]) {
vflip()
veroboard_assembly(z_vb, 12, 3);
translate([30, 0])
rotate(180)
veroboard_assembly(z_vb, 12, 3);
}
if($preview)
veroboard_test();

47
tests/washers.scad Normal file
View File

@@ -0,0 +1,47 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/washers.scad>
function penny_diameter(w) = let(p = penny_washer(w)) washer_diameter(p ? p : w);
module washers()
layout([for(w = washers) penny_diameter(w)], 2) let(w = washers[$i]) {
star_washer(w);
if(spring_washer_thickness(w))
translate([0, 20])
let($explode = 1)
spring_washer(w);
translate([0, 40])
washer(w);
if(penny_washer(w))
translate([0, 65])
penny_washer(w);
translate([0, 90])
printed_washer(w);
}
if($preview)
washers();

29
tests/zipties.scad Normal file
View File

@@ -0,0 +1,29 @@
//
// 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>
use <../utils/layout.scad>
include <../vitamins/zipties.scad>
module zipties()
layout([for(z = zipties) 9], 10)
ziptie(zipties[$i], 5);
if($preview)
zipties();