Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
be324c31da | ||
|
49c3b6be2c | ||
|
8583f5472d | ||
|
645ff21d3d | ||
|
4ff12b1d8b | ||
|
847dba544f | ||
|
13c654a10e | ||
|
49ee92db8e | ||
|
be14a52c21 | ||
|
af4c5e2b3e | ||
|
f85a7e85be | ||
|
c68f879d13 | ||
|
3d4653fc0f | ||
|
b40c076d23 | ||
|
5ae040079e | ||
|
881a032aa3 | ||
|
4b1d6298e4 |
@@ -31,6 +31,7 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|
||||
## Parts list
|
||||
| <span style="writing-mode: vertical-rl; text-orientation: mixed;">Base</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">Feet</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">Mains In</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">Main</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">TOTALS</span> | |
|
||||
|--:|--:|--:|--:|--:|:--|
|
||||
| | | | | | **Vitamins** |
|
||||
| . | . | . | 2 | 2 | 4mm shielded jack socket blue |
|
||||
| . | . | . | 1 | 1 | 4mm shielded jack socket brown |
|
||||
| . | . | . | 2 | 2 | 4mm shielded jack socket green |
|
||||
@@ -47,9 +48,11 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|
||||
| . | . | 1 | 1 | 2 | Wire blue 30/0.25mm strands, length 150mm - not shown |
|
||||
| . | . | 2 | . | 2 | Wire brown 30/0.25mm strands, length 150mm - not shown |
|
||||
| . | . | 1 | 1 | 2 | Wire green & yellow 30/0.25mm strands, length 150mm - not shown |
|
||||
| | | | | | **3D Printed parts** |
|
||||
| . | 4 | . | . | 4 | foot.stl |
|
||||
| 1 | . | . | . | 1 | socket_box.stl |
|
||||
| 2 | 16 | 14 | 18 | 50 | Total vitamins count |
|
||||
| | | | | | **3D printed parts** |
|
||||
| . | 4 | . | . | 4 | foot.stl |
|
||||
| 1 | . | . | . | 1 | socket_box.stl |
|
||||
| 1 | 4 | . | . | 5 | Total 3D printed parts count |
|
||||
|
||||
[Top](#TOP)
|
||||
|
||||
|
1
lib.scad
@@ -60,6 +60,7 @@ include <vitamins/ball_bearings.scad>
|
||||
include <vitamins/light_strips.scad>
|
||||
include <vitamins/spools.scad>
|
||||
include <vitamins/mains_sockets.scad>
|
||||
include <vitamins/ldrs.scad>
|
||||
|
||||
use <vitamins/jack.scad>
|
||||
use <vitamins/meter.scad>
|
||||
|
BIN
libtest.png
Before Width: | Height: | Size: 703 KiB After Width: | Height: | Size: 703 KiB |
@@ -40,6 +40,7 @@ use <tests/inserts.scad>
|
||||
use <tests/jack.scad>
|
||||
use <tests/leadnuts.scad>
|
||||
use <tests/leds.scad>
|
||||
use <tests/ldrs.scad>
|
||||
use <tests/light_strips.scad>
|
||||
use <tests/linear_bearings.scad>
|
||||
use <tests/meter.scad>
|
||||
@@ -252,6 +253,9 @@ components_y = toggles_y + 40;
|
||||
translate([x2, leds_y])
|
||||
leds();
|
||||
|
||||
translate([x2 + 40, leds_y])
|
||||
ldrs();
|
||||
|
||||
translate([x2 + 8, carriers_y])
|
||||
carriers();
|
||||
|
||||
|
@@ -130,7 +130,7 @@ module round_grommet_bottom(diameter, od = undef) { //! Generate the STL for a r
|
||||
}
|
||||
|
||||
module round_grommet_hole(diameter, h = 100) //! Make a hole for a round grommet
|
||||
drill(echoit(corrected_radius(diameter / 2) + wall + clearance), h);
|
||||
drill(corrected_radius(diameter / 2) + wall + clearance, h);
|
||||
|
||||
module round_grommet_assembly(diameter, thickness, od = undef) {
|
||||
color(pp1_colour)
|
||||
|
@@ -33,10 +33,8 @@ wall = 1.8;
|
||||
top = 1.5;
|
||||
screw = M3_cap_screw;
|
||||
insert = screw_insert(screw);
|
||||
boss_r = wall + corrected_radius(insert_hole_radius(insert));
|
||||
boss_h = insert_hole_length(insert);
|
||||
boss_r = insert_boss_radius(insert, wall);
|
||||
counter_bore = 2;
|
||||
boss_h2 = boss_h + counter_bore;
|
||||
rad = 2;
|
||||
clearance = layer_height;
|
||||
overlap = 6;
|
||||
@@ -137,49 +135,13 @@ module psu_shroud(type, cable_d, name, cables = 1) { //! Generate the STL file f
|
||||
translate([0, height / 2])
|
||||
vertical_tearslot(h = 0, r = cable_d / 2, l = cable_d);
|
||||
}
|
||||
|
||||
mirror([0, 1, 0]) {
|
||||
// insert boss
|
||||
translate_z(height - boss_h)
|
||||
linear_extrude(height = boss_h)
|
||||
psu_shroud_hole_positions(type)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([0, $side * (boss_r - 1)])
|
||||
square([2 * boss_r, eps], center = true);
|
||||
}
|
||||
poly_circle(insert_hole_radius(insert));
|
||||
}
|
||||
|
||||
// insert boss counter_bore
|
||||
translate_z(height - boss_h2)
|
||||
linear_extrude(height = counter_bore + eps)
|
||||
psu_shroud_hole_positions(type)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([0, $side * (boss_r - 1)])
|
||||
square([2 * boss_r, eps], center = true);
|
||||
}
|
||||
poly_circle(insert_screw_diameter(insert) / 2 + 0.1);
|
||||
}
|
||||
// support cones
|
||||
translate_z(height - boss_h2)
|
||||
psu_shroud_hole_positions(type)
|
||||
hull() {
|
||||
cylinder(h = eps, r = boss_r - eps);
|
||||
|
||||
translate([0, $side * (boss_r - 1)])
|
||||
cube([2 * boss_r, eps, eps], center = true);
|
||||
|
||||
translate([0, $side * (boss_r - wall), - (2 * boss_r - wall)])
|
||||
cube(eps);
|
||||
}
|
||||
}
|
||||
}
|
||||
// insert lugs
|
||||
mirror([0, 1, 0])
|
||||
psu_shroud_hole_positions(type)
|
||||
translate_z(height)
|
||||
rotate(90)
|
||||
insert_lug(insert, wall, $side, counter_bore);
|
||||
}
|
||||
|
||||
module psu_shroud_assembly(type, cable_d, name, cables = 1) //! The printed parts with inserts fitted
|
||||
assembly(str("psu_shroud_", name)) {
|
||||
|
@@ -33,10 +33,8 @@ wall = 1.8;
|
||||
top = 1.5;
|
||||
screw = M3_cap_screw;
|
||||
insert = screw_insert(screw);
|
||||
boss_r = wall + corrected_radius(insert_hole_radius(insert));
|
||||
boss_h = insert_hole_length(insert);
|
||||
boss_r = insert_boss_radius(insert, wall);
|
||||
counter_bore = 2;
|
||||
boss_h2 = boss_h + counter_bore;
|
||||
rad = 3;
|
||||
clearance = layer_height;
|
||||
|
||||
@@ -61,7 +59,6 @@ module ssr_shroud_holes(type, cable_d) { //! Drill the screw and ziptie holes
|
||||
translate([ssr_shroud_cable_x(type, cable_d), side * (ssr_width(type) / 2 - 2 * boss_r)])
|
||||
rotate(-90)
|
||||
cable_tie_holes(cable_d / 2, h = 0);
|
||||
|
||||
}
|
||||
|
||||
module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a specified ssr and cable
|
||||
@@ -103,45 +100,11 @@ module ssr_shroud(type, cable_d, name) { //! Generate the STL file for a spec
|
||||
vertical_tearslot(h = 0, r = cable_d / 2, l = cable_d);
|
||||
}
|
||||
// insert boss
|
||||
translate_z(height - boss_h)
|
||||
linear_extrude(height = boss_h)
|
||||
ssr_shroud_hole_positions(type)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([0, -$side * (boss_r - 1)])
|
||||
square([2 * boss_r, eps], center = true);
|
||||
}
|
||||
poly_circle(insert_hole_radius(insert));
|
||||
}
|
||||
|
||||
// insert boss counter_bore
|
||||
translate_z(height - boss_h2)
|
||||
linear_extrude(height = counter_bore + eps)
|
||||
ssr_shroud_hole_positions(type)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([0, -$side * (boss_r - 1)])
|
||||
square([2 * boss_r, eps], center = true);
|
||||
}
|
||||
poly_circle(insert_screw_diameter(insert) / 2 + 0.1);
|
||||
}
|
||||
// support cones
|
||||
ssr_shroud_hole_positions(type)
|
||||
hull() {
|
||||
translate_z(-height + boss_h2) {
|
||||
cylinder(h = eps, r = boss_r - eps);
|
||||
|
||||
translate([0, -$side * (boss_r - 1)])
|
||||
cube([2 * boss_r, eps, eps], center = true);
|
||||
}
|
||||
translate([0, -$side * (boss_r - wall), -height + boss_h2 + (2 * boss_r - wall)])
|
||||
cube(eps);
|
||||
}
|
||||
|
||||
vflip()
|
||||
translate_z(height)
|
||||
rotate(90)
|
||||
insert_lug(insert, wall, $side, counter_bore);
|
||||
}
|
||||
|
||||
module ssr_shroud_assembly(type, cable_d, name) //! The printed parts with inserts fitted
|
||||
@@ -153,7 +116,6 @@ assembly(str("ssr_shroud_", name)) {
|
||||
|
||||
ssr_shroud_hole_positions(type)
|
||||
insert(insert);
|
||||
|
||||
}
|
||||
|
||||
module ssr_shroud_fastened_assembly(type, cable_d, thickness, name) //! Assembly with screws in place
|
||||
@@ -177,6 +139,4 @@ module ssr_shroud_fastened_assembly(type, cable_d, thickness, name) //! Assembly
|
||||
color(grey20)
|
||||
cylinder(d = cable_d, h = 20, center = true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
71
readme.md
@@ -35,16 +35,17 @@ See [usage](docs/usage.md) for requirements, installation instructions and a usa
|
||||
<tr><td> <a href = "#Iecs">Iecs</a> </td><td> <a href = "#Spades">Spades</a> </td><td> <a href = "#Screw_knob">Screw_knob</a> </td><td> <a href = "#Tube">Tube</a> </td><td></td></tr>
|
||||
<tr><td> <a href = "#Inserts">Inserts</a> </td><td> <a href = "#Spools">Spools</a> </td><td> <a href = "#Socket_box">Socket_box</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Jack">Jack</a> </td><td> <a href = "#Springs">Springs</a> </td><td> <a href = "#Ssr_shroud">Ssr_shroud</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#Ssrs">Ssrs</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Leds">Leds</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Mains_sockets">Mains_sockets</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Meter">Meter</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microswitches">Microswitches</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microview">Microview</a> </td><td> <a href = "#Washers">Washers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Modules">Modules</a> </td><td> <a href = "#Wire">Wire</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Nuts">Nuts</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Ldrs">Ldrs</a> </td><td> <a href = "#Ssrs">Ssrs</a> </td><td> <a href = "#Strap_handle">Strap_handle</a> </td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Leadnuts">Leadnuts</a> </td><td> <a href = "#Stepper_motors">Stepper_motors</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Leds">Leds</a> </td><td> <a href = "#Toggles">Toggles</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Light_strips">Light_strips</a> </td><td> <a href = "#Transformers">Transformers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Linear_bearings">Linear_bearings</a> </td><td> <a href = "#Tubings">Tubings</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Mains_sockets">Mains_sockets</a> </td><td> <a href = "#Variacs">Variacs</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Meter">Meter</a> </td><td> <a href = "#Veroboard">Veroboard</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microswitches">Microswitches</a> </td><td> <a href = "#Washers">Washers</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Microview">Microview</a> </td><td> <a href = "#Wire">Wire</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Modules">Modules</a> </td><td> <a href = "#Zipties">Zipties</a> </td><td></td><td></td><td></td></tr>
|
||||
<tr><td> <a href = "#Nuts">Nuts</a> </td><td></td><td></td><td></td><td></td></tr>
|
||||
</table>
|
||||
|
||||
---
|
||||
@@ -889,12 +890,18 @@ Heatfit threaded inserts. Can be pushed into thermoplastics using a soldering ir
|
||||
| ```insert_ring3_d(type)``` | Diameter of the bottom ring |
|
||||
| ```insert_screw_diameter(type)``` | Screw size |
|
||||
|
||||
### Functions
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```insert_boss_radius(type, wall)``` | Compute the outer radius of an insert boss |
|
||||
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```insert(type)``` | Draw specified insert |
|
||||
| ```insert_boss(type, z, wall = 2 * extrusion_width)``` | Make a boss to take an insert |
|
||||
| ```insert_hole(type, counterbore = 0, horizontal = false)``` | Make a hole to take an insert, ```counterbore``` is the extra length for the screw |
|
||||
| ```insert_lug(insert, wall, side, counter_bore = 0)``` | Make a flying insert lug, see [ssr_shroud](#Ssr_shroud) |
|
||||
|
||||

|
||||
|
||||
@@ -945,6 +952,47 @@ E.g. a "brown" socket for mains live needs to be displayed as "sienna" to look r
|
||||
| 1 | ```jack_4mm_shielded("brown", 3, "sienna")``` | 4mm shielded jack socket brown |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
<a name="Ldrs"></a>
|
||||
## Ldrs
|
||||
Light dependent resistors.
|
||||
|
||||
Larger ones seem to have both a higher dark resistance and a lower bright light resistance.
|
||||
|
||||
|
||||
[vitamins/ldrs.scad](vitamins/ldrs.scad) Object definitions.
|
||||
|
||||
[vitamins/ldr.scad](vitamins/ldr.scad) Implementation.
|
||||
|
||||
[tests/ldrs.scad](tests/ldrs.scad) Code for this example.
|
||||
|
||||
### Properties
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```ldr_active(type)``` | The active width |
|
||||
| ```ldr_description(type)``` | Description |
|
||||
| ```ldr_diameter(type)``` | The diameter of the round bit |
|
||||
| ```ldr_lead_d(type)``` | The lead diameter |
|
||||
| ```ldr_pitch(type)``` | Pitch between the leads |
|
||||
| ```ldr_thickness(type)``` | Thickness |
|
||||
| ```ldr_width(type)``` | Across the flats |
|
||||
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|:--- |:--- |
|
||||
| ```LDR(type, lead_length = 3)``` | Draw an LDR, can specify the lead length |
|
||||
|
||||

|
||||
|
||||
### Vitamins
|
||||
| Qty | Module call | BOM entry |
|
||||
| ---:|:--- |:---|
|
||||
| 1 | ```ldr(large_ldr)``` | Light dependent resistor - large |
|
||||
| 1 | ```ldr(small_ldr)``` | Light dependent resistor - small |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
---
|
||||
@@ -2217,7 +2265,7 @@ Note that modules that drill holes will return a 2D object if ```h``` is set to
|
||||
|:--- |:--- |
|
||||
| ```render_2D_sheet(type, color = false)``` | Extrude a 2D sheet template and give it the correct colour |
|
||||
| ```render_sheet(type, color = false)``` | Render a sheet in the correct colour after holes have been subtracted |
|
||||
| ```sheet(type, w, d, corners = [0, 0, 0, 0])``` | Draw speified sheet |
|
||||
| ```sheet(type, w, d, corners = [0, 0, 0, 0])``` | Draw specified sheet |
|
||||
| ```sheet_2D(type, w, d, corners = [0, 0, 0, 0])``` | 2D sheet template with specified size and optionally rounded corners |
|
||||
|
||||

|
||||
@@ -4463,6 +4511,7 @@ Global constants, functions and modules. This file is used directly or indirectl
|
||||
| ```ellipse(xr, yr)``` | Draw an ellipse |
|
||||
| ```extrude_if(h, center = true)``` | Extrudes 2D object to 3D when ```h``` is nonzero, otherwise leaves it 2D |
|
||||
| ```hflip()``` | Invert children by doing a 180° flip around the Y axis |
|
||||
| ```right_triangle(width, height, h, center = true)``` | A right angled triangle with the 90° corner at the origin. 3D when ```h``` is nonzero, otherwise 2D |
|
||||
| ```semi_circle(r, d = undef)``` | A semi circle in the positive Y domain |
|
||||
| ```translate_z(z)``` | Shortcut for Z only translations |
|
||||
| ```vflip()``` | Invert children by doing a 180° flip around the X axis |
|
||||
|
@@ -37,9 +37,10 @@ def read_deps(dname):
|
||||
deps.append(dep)
|
||||
return deps
|
||||
|
||||
def check_deps(target_mtime, dname):
|
||||
def check_deps(target, dname):
|
||||
target_mtime = mtime(target)
|
||||
if not target_mtime:
|
||||
return "target missing"
|
||||
return target + " missing"
|
||||
if not os.path.isfile(dname):
|
||||
return "no deps"
|
||||
deps = read_deps(dname)
|
||||
|
@@ -84,7 +84,6 @@ def make_parts(target, part_type, parts = None):
|
||||
# Find all the scad files
|
||||
#
|
||||
lib_dir = os.environ['OPENSCADPATH'] + '/NopSCADlib/printed'
|
||||
used = []
|
||||
module_suffix = '_dxf' if part_type == 'svg' else '_' + part_type
|
||||
for dir in [source_dir, lib_dir]:
|
||||
for filename in os.listdir(dir):
|
||||
@@ -113,7 +112,7 @@ def make_parts(target, part_type, parts = None):
|
||||
#
|
||||
part_file = target_dir + "/" + part
|
||||
dname = deps_name(deps_dir, filename)
|
||||
changed = check_deps(mtime(part_file), dname)
|
||||
changed = check_deps(part_file, dname)
|
||||
changed = times.check_have_time(changed, part)
|
||||
if part_type == 'stl' and not changed and not part in bounds_map:
|
||||
changed = "No bounds"
|
||||
@@ -125,14 +124,9 @@ def make_parts(target, part_type, parts = None):
|
||||
if part_type == 'stl':
|
||||
bounds = c14n_stl.canonicalise(part_file)
|
||||
bounds_map[part] = bounds
|
||||
|
||||
targets.remove(part)
|
||||
os.remove(part_maker_name)
|
||||
#
|
||||
# Add the files on the BOM to the used list for plates.py
|
||||
#
|
||||
for line in open("openscad.log"):
|
||||
if line[:7] == 'ECHO: "' and line[-6:] == '.' + part_type + '"\n':
|
||||
used.append(line[7:-2])
|
||||
#
|
||||
# Write new bounds file
|
||||
#
|
||||
@@ -150,4 +144,3 @@ def make_parts(target, part_type, parts = None):
|
||||
print("Could not find a module called", part[:-4] + module_suffix, "to make", part)
|
||||
sys.exit(1)
|
||||
times.print_times()
|
||||
return used
|
||||
|
@@ -187,7 +187,7 @@ def tests(tests):
|
||||
body += ["\n" %(base_name, png_name)]
|
||||
|
||||
dname = deps_name(deps_dir, scad)
|
||||
oldest = min(mtime(png_name), mtime(bom_name))
|
||||
oldest = png_name if mtime(png_name) < mtime(bom_name) else bom_name
|
||||
changed = check_deps(oldest, dname)
|
||||
changed = times.check_have_time(changed, scad_name)
|
||||
if changed:
|
||||
|
@@ -154,14 +154,14 @@ def views(target, do_assemblies = None):
|
||||
f.write("use <%s/%s>\n" % (dir, filename))
|
||||
f.write("%s();\n" % module);
|
||||
#
|
||||
# Run openscad on the created file
|
||||
# Run openscad on th created file
|
||||
#
|
||||
dname = deps_name(deps_dir, filename)
|
||||
for explode in [0, 1]:
|
||||
png_name = target_dir + '/' + module + '.png'
|
||||
if not explode:
|
||||
png_name = png_name.replace('_assembly', '_assembled')
|
||||
changed = check_deps(mtime(png_name), dname)
|
||||
changed = check_deps(png_name, dname)
|
||||
changed = times.check_have_time(changed, png_name)
|
||||
tmp_name = 'tmp.png'
|
||||
if changed:
|
||||
@@ -219,36 +219,49 @@ def views(target, do_assemblies = None):
|
||||
# Global BOM
|
||||
#
|
||||
print('<a name="Parts_list"></a>\n## Parts list', file = doc_file)
|
||||
vitamins = {}
|
||||
printed = {}
|
||||
routed = {}
|
||||
types = ["vitamins", "printed", "routed"]
|
||||
headings = {"vitamins" : "vitamins", "printed" : "3D printed parts", "routed" : "CNC routed parts"}
|
||||
things = {}
|
||||
for t in types:
|
||||
things[t] = {}
|
||||
for ass in flat_bom:
|
||||
for v in ass["vitamins"]:
|
||||
if v in vitamins:
|
||||
vitamins[v] += ass["vitamins"][v]
|
||||
else:
|
||||
vitamins[v] = ass["vitamins"][v]
|
||||
for p in ass["printed"]:
|
||||
if p in printed:
|
||||
printed[p] += ass["printed"][p]
|
||||
else:
|
||||
printed[p] = ass["printed"][p]
|
||||
for t in types:
|
||||
for thing in ass[t]:
|
||||
if thing in things[t]:
|
||||
things[t][thing] += ass[t][thing]
|
||||
else:
|
||||
things[t][thing] = ass[t][thing]
|
||||
for ass in flat_bom:
|
||||
name = ass["name"][:-9].replace('_', ' ').title().replace(' ',' ')
|
||||
print('| <span style="writing-mode: vertical-rl; text-orientation: mixed;">%s</span> ' % name, file = doc_file, end = '')
|
||||
print('| <span style="writing-mode: vertical-rl; text-orientation: mixed;">TOTALS</span> | |', file = doc_file)
|
||||
|
||||
print(('|--:' * len(flat_bom) + '|--:|:--|'), file = doc_file)
|
||||
for v in sorted(vitamins, key = lambda s: s.split(":")[-1]):
|
||||
for ass in flat_bom:
|
||||
count = ass["vitamins"][v] if v in ass["vitamins"] else '.'
|
||||
print('| %s ' % pad(count, 2, 1), file = doc_file, end = '')
|
||||
print('| %s | %s |' % (pad(vitamins[v], 2, 1), pad(v.split(":")[1], 2)), file = doc_file)
|
||||
print(('| ' * len(flat_bom) + '| | **3D Printed parts** |'), file = doc_file)
|
||||
for p in sorted(printed):
|
||||
for ass in flat_bom:
|
||||
count = ass["printed"][p] if p in ass["printed"] else '.'
|
||||
print('| %s ' % pad(count, 2, 1), file = doc_file, end = '')
|
||||
print('| %s | %s |' % (pad(printed[p], 2, 1), pad(p, 3)), file = doc_file)
|
||||
|
||||
for t in types:
|
||||
if things[t]:
|
||||
totals = {}
|
||||
heading = headings[t][0:1].upper() + headings[t][1:]
|
||||
print(('| ' * len(flat_bom) + '| | **%s** |') % heading, file = doc_file)
|
||||
for thing in sorted(things[t], key = lambda s: s.split(":")[-1]):
|
||||
for ass in flat_bom:
|
||||
count = ass[t][thing] if thing in ass[t] else 0
|
||||
print('| %s ' % pad(count if count else '.', 2, 1), file = doc_file, end = '')
|
||||
name = ass["name"]
|
||||
if name in totals:
|
||||
totals[name] += count
|
||||
else:
|
||||
totals[name] = count
|
||||
print('| %s | %s |' % (pad(things[t][thing], 2, 1), pad(thing.split(":")[-1], 2)), file = doc_file)
|
||||
|
||||
grand_total = 0
|
||||
for ass in flat_bom:
|
||||
name = ass["name"]
|
||||
total = totals[name] if name in totals else 0
|
||||
print('| %s ' % pad(total if total else '.', 2, 1), file = doc_file, end = '')
|
||||
grand_total += total
|
||||
print("| %s | %s |" % (pad(grand_total, 2, 1), pad('Total %s count' % headings[t], 2)), file = doc_file)
|
||||
|
||||
print(file = doc_file)
|
||||
eop(print_mode, doc_file)
|
||||
#
|
||||
|
@@ -20,7 +20,8 @@ include <../global_defs.scad>
|
||||
use <../utils/fillet.scad>
|
||||
|
||||
module fillets() {
|
||||
fillet(3, 25);
|
||||
rotate(180)
|
||||
fillet(3, 10);
|
||||
}
|
||||
|
||||
fillets();
|
||||
|
@@ -25,6 +25,9 @@ module globals() {
|
||||
|
||||
translate([30, 0])
|
||||
ellipse(15, 7);
|
||||
|
||||
translate([50, 0])
|
||||
right_triangle(10, 20, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
27
tests/ldrs.scad
Normal 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 <../vitamins/ldrs.scad>
|
||||
|
||||
use <../utils/layout.scad>
|
||||
|
||||
module ldrs()
|
||||
layout([for(l = ldrs) ldr_diameter(l)], 5)
|
||||
LDR(ldrs[$i]);
|
||||
|
||||
ldrs();
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
BIN
tests/png/ldrs.png
Normal file
After Width: | Height: | Size: 118 KiB |
@@ -63,6 +63,10 @@ module semi_circle(r, d = undef) //! A semi circle in the pos
|
||||
square([2 * sq, sq]);
|
||||
}
|
||||
|
||||
module right_triangle(width, height, h, center = true) //! A right angled triangle with the 90° corner at the origin. 3D when ```h``` is nonzero, otherwise 2D
|
||||
extrude_if(h, center = center)
|
||||
polygon(points = [[0,0], [width, 0], [0, height]]);
|
||||
|
||||
include <sphere.scad>
|
||||
include <bom.scad>
|
||||
include <polyholes.scad>
|
||||
|
@@ -28,5 +28,6 @@ module fillet(r, h, center = false) //! Fillet with specified radius and height
|
||||
translate([-eps, -eps, 0])
|
||||
square(r + eps);
|
||||
|
||||
circle(r + eps);
|
||||
translate([r, r])
|
||||
circle(r + eps);
|
||||
}
|
||||
|
@@ -93,6 +93,8 @@ module insert_hole(type, counterbore = 0, horizontal = false) { //! Make a hole
|
||||
}
|
||||
}
|
||||
|
||||
function insert_boss_radius(type, wall) = corrected_radius(insert_hole_radius(type)) + wall; //! Compute the outer radius of an insert boss
|
||||
|
||||
module insert_boss(type, z, wall = 2 * extrusion_width) { //! Make a boss to take an insert
|
||||
render(convexity = 3)
|
||||
difference() {
|
||||
@@ -105,3 +107,45 @@ module insert_boss(type, z, wall = 2 * extrusion_width) { //! Make a boss to tak
|
||||
insert_hole(type, max(0, z - insert_hole_length(type) - 2 * layer_height));
|
||||
}
|
||||
}
|
||||
|
||||
module insert_lug(insert, wall, side, counter_bore = 0) { //! Make a flying insert lug, see [ssr_shroud](#Ssr_shroud)
|
||||
boss_r = insert_boss_radius(insert, wall);
|
||||
boss_h = insert_hole_length(insert);
|
||||
boss_h2 = boss_h + counter_bore;
|
||||
translate_z(-boss_h)
|
||||
linear_extrude(height = boss_h)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([side * (boss_r - 1), 0])
|
||||
square([eps, 2 * boss_r], center = true);
|
||||
}
|
||||
poly_circle(insert_hole_radius(insert));
|
||||
}
|
||||
|
||||
// insert boss counter_bore
|
||||
translate_z(-boss_h2) {
|
||||
linear_extrude(height = counter_bore + eps)
|
||||
difference() {
|
||||
hull() {
|
||||
circle(boss_r);
|
||||
|
||||
translate([side * (boss_r - 1), 0])
|
||||
square([eps, 2 * boss_r], center = true);
|
||||
}
|
||||
poly_circle(insert_screw_diameter(insert) / 2 + 0.1);
|
||||
}
|
||||
|
||||
// support cones
|
||||
hull() {
|
||||
cylinder(h = eps, r = boss_r - eps);
|
||||
|
||||
translate([side * (boss_r - 1), 0])
|
||||
cube([eps, 2 * boss_r, eps], center = true);
|
||||
|
||||
translate([side * (boss_r - wall + eps), 0, - (2 * boss_r - wall)])
|
||||
cube(eps, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
105
vitamins/ldr.scad
Normal file
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
//! Light dependent resistors.
|
||||
//!
|
||||
//! Larger ones seem to have both a higher dark resistance and a lower bright light resistance.
|
||||
//
|
||||
include <../core.scad>
|
||||
|
||||
function ldr_description(type) = type[1]; //! Description
|
||||
function ldr_diameter(type) = type[2]; //! The diameter of the round bit
|
||||
function ldr_width(type) = type[3]; //! Across the flats
|
||||
function ldr_thickness(type) = type[4]; //! Thickness
|
||||
function ldr_pitch(type) = type[5]; //! Pitch between the leads
|
||||
function ldr_active(type) = type[6]; //! The active width
|
||||
function ldr_lead_d(type) = type[7]; //! The lead diameter
|
||||
|
||||
module LDR(type, lead_length = 3) { //! Draw an LDR, can specify the lead length
|
||||
vitamin(str("ldr(", type[0], "): Light dependent resistor - ", ldr_description(type)));
|
||||
|
||||
module shape()
|
||||
intersection() {
|
||||
circle(d = ldr_diameter(type));
|
||||
|
||||
square([100, ldr_width(type)], center = true);
|
||||
}
|
||||
|
||||
function serpentine_t() = let(w = ldr_width(type), n = floor(w / 0.5) + 0.5) w / (n * 2);
|
||||
|
||||
module serpentine() {
|
||||
w = ldr_width(type);
|
||||
|
||||
t = serpentine_t();
|
||||
pitch = 2 * t;
|
||||
l = ldr_active(type);
|
||||
lines = ceil(w / pitch);
|
||||
|
||||
for(i = [0 : lines - 1])
|
||||
translate([0, i * pitch - w / 2 + t / 2]) {
|
||||
square([l - 3 * t, t], center = true);
|
||||
|
||||
end = i % 2 ? 1 : -1;
|
||||
$fn = 16;
|
||||
translate([end * (l / 2 - 1.5 * t), t])
|
||||
rotate(-end * 90)
|
||||
difference() {
|
||||
semi_circle(1.5 * t);
|
||||
|
||||
semi_circle(t / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
t = ldr_thickness(type);
|
||||
|
||||
color("white")
|
||||
linear_extrude(height = t - 0.4)
|
||||
shape();
|
||||
|
||||
color("orange")
|
||||
translate_z(t - 0.4)
|
||||
linear_extrude(height = 0.1)
|
||||
shape();
|
||||
|
||||
color([0.9, 0.9, 0.9])
|
||||
translate_z(t - 0.3)
|
||||
linear_extrude(height = 0.1)
|
||||
difference() {
|
||||
offset(-serpentine_t())
|
||||
shape();
|
||||
|
||||
serpentine();
|
||||
}
|
||||
|
||||
color("silver")
|
||||
for(side = [-1, 1])
|
||||
translate([side * ldr_pitch(type) / 2, 0]) {
|
||||
translate_z(-lead_length)
|
||||
cylinder(d = ldr_lead_d(type), h = lead_length, $fn = 16);
|
||||
|
||||
translate_z(t - 0.3)
|
||||
cylinder(d = 1.5 * ldr_lead_d(type), h = 0.2, $fn = 16);
|
||||
}
|
||||
color([1, 1, 1, 0.25])
|
||||
translate_z(t - 0.3 + eps)
|
||||
linear_extrude(height = 0.3)
|
||||
shape();
|
||||
}
|
28
vitamins/ldrs.scad
Normal 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/>.
|
||||
//
|
||||
|
||||
//
|
||||
// Light dependent resistors.
|
||||
//
|
||||
small_ldr = ["small_ldr", "small", 5, 4.2, 2.0, 3.2, 2.5, 0.4];
|
||||
large_ldr = ["large_ldr", "large", 9.2, 7.9, 2.0, 6.8, 4.5, 0.5];
|
||||
|
||||
ldrs = [small_ldr, large_ldr];
|
||||
|
||||
use <ldr.scad>
|
@@ -43,14 +43,14 @@ module microview(cutout = false) { //! Draw microview or generate a panel cutou
|
||||
translate_z(8.35) {
|
||||
|
||||
color("black")
|
||||
import("microview/GKM-002_R05_CHIP_UPPER_HOUSING-1.stl", convexity = 2);
|
||||
import("microview/GKM-002_R05_CHIP_UPPER_HOUSING-1.STL", convexity = 2);
|
||||
|
||||
translate([-2, 0, 0])
|
||||
color("dimgray")
|
||||
cube([12.5, 15.5, 4.41], center = true);
|
||||
}
|
||||
color("dimgray")
|
||||
import("microview/GKM-003_R05_CHIP_LOWER_HOUSING.stl", convexity = 2);
|
||||
import("microview/GKM-003_R05_CHIP_LOWER_HOUSING.STL", convexity = 2);
|
||||
|
||||
for(side = [-1, 1], i = [0 : 7])
|
||||
translate([side * inch(0.35), (i - 3.5) * inch(0.1)])
|
||||
|
@@ -58,7 +58,7 @@ module nut(type, nyloc = false, brass = false, nylon = false) { //! Draw specifi
|
||||
rounded_cylinder(r = outer_rad * cos(30) , h = nyloc_thickness, r2 = (nyloc_thickness - thickness) / 2, ir = hole_rad);
|
||||
}
|
||||
if($children)
|
||||
translate_z(thickness)
|
||||
translate_z(nut_thickness(type, nyloc))
|
||||
children();
|
||||
}
|
||||
|
||||
|
@@ -750,14 +750,19 @@ module pcb(type) { //! Draw specified PCB
|
||||
}
|
||||
}
|
||||
|
||||
module pcb_spacer(screw, height, wall = 1.8) { //! Generate STL for PCB spacer
|
||||
stl(str("pcb_spacer", round(screw_radius(screw) * 20), round(height * 10)));
|
||||
module pcb_spacer(screw, height, wall = 1.8, taper = 0) { //! Generate STL for PCB spacer
|
||||
stl(str("pcb_spacer", round(screw_radius(screw) * 20), round(height * 10), taper ? str("_", taper) : ""));
|
||||
|
||||
ir = screw_clearance_radius(screw);
|
||||
or = corrected_radius(ir) + wall;
|
||||
|
||||
linear_extrude(height = height)
|
||||
poly_ring(or, ir);
|
||||
if(height > taper)
|
||||
linear_extrude(height = height - taper)
|
||||
poly_ring(or, ir);
|
||||
|
||||
if(taper)
|
||||
linear_extrude(height = height)
|
||||
poly_ring(ir + 2 * extrusion_width, ir);
|
||||
}
|
||||
|
||||
module pcb_base(type, height, thickness, wall = 2) { //! Generate STL for a base with PCB spacers
|
||||
@@ -798,12 +803,8 @@ module pcb_assembly(type, height, thickness) { //! Draw PCB assembly with spaces
|
||||
screw(screw, screw_length);
|
||||
|
||||
color(pp1_colour)
|
||||
if(taper) {
|
||||
h2 = max(0, height - 2);
|
||||
if(h2)
|
||||
pcb_spacer(screw, h2);
|
||||
pcb_spacer(screw, height, 2 * extrusion_width); // Thin as can be at the top because there is no clearance around the holes.
|
||||
}
|
||||
if(taper)
|
||||
pcb_spacer(screw, height, taper = 2);
|
||||
else
|
||||
pcb_spacer(screw, height);
|
||||
|
||||
|
@@ -74,7 +74,7 @@ module sheet_2D(type, w, d, corners = [0, 0, 0, 0]) { //! 2D sheet template with
|
||||
}
|
||||
}
|
||||
|
||||
module sheet(type, w, d, corners = [0, 0, 0, 0]) //! Draw speified sheet
|
||||
module sheet(type, w, d, corners = [0, 0, 0, 0]) //! Draw specified sheet
|
||||
linear_extrude(height = sheet_thickness(type), center = true)
|
||||
sheet_2D(type, w, d, corners);
|
||||
|
||||
|