1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-09-03 12:22:46 +02:00

Compare commits

...

27 Commits

Author SHA1 Message Date
Chris Palmer
4459cca3ea Merge branch 'martinbudden-screw_length_formatting' 2020-02-23 16:16:30 +00:00
Chris Palmer
95bbebd42d Updated readme. 2020-02-23 16:16:09 +00:00
Chris Palmer
28c795e9f4 Merge branch 'screw_length_formatting' of https://github.com/martinbudden/NopSCADlib into martinbudden-screw_length_formatting 2020-02-23 15:24:43 +00:00
Chris Palmer
9a0477d16b Merge branch 'martinbudden-pcb_microswitch2' 2020-02-23 15:22:43 +00:00
Chris Palmer
0583da2eb7 Added images 2020-02-23 15:22:25 +00:00
Chris
9a08fe9b5c Merge branch 'master' into pcb_microswitch2 2020-02-23 15:10:13 +00:00
Chris Palmer
8ab7993148 Merge branch 'martinbudden-rocker_color' 2020-02-23 15:03:23 +00:00
Chris Palmer
16dd8d6d17 Added images and readme. 2020-02-23 15:02:39 +00:00
Chris Palmer
08c268145e Merge branch 'rocker_color' of https://github.com/martinbudden/NopSCADlib into martinbudden-rocker_color 2020-02-23 14:52:11 +00:00
Chris Palmer
ba7e64233a Clarified path settings in usage.md. 2020-02-23 14:46:39 +00:00
Chris Palmer
7090c714ce Merge branch 'martinbudden-pcb_buzzer' 2020-02-23 14:34:04 +00:00
Chris Palmer
654f094304 Merge branch 'martinbudden-spool_filament' 2020-02-23 14:28:57 +00:00
Chris Palmer
1e5e5860e1 Made more realistic and added a test. 2020-02-23 14:28:39 +00:00
Chris Palmer
3d8a9ec8aa Merge branch 'spool_filament' of https://github.com/martinbudden/NopSCADlib into martinbudden-spool_filament 2020-02-23 10:04:23 +00:00
Chris Palmer
7ec059142f Updated readme. 2020-02-23 10:01:28 +00:00
Chris Palmer
7f0d96b824 Merge branch 'pcb_buzzer' of https://github.com/martinbudden/NopSCADlib into martinbudden-pcb_buzzer 2020-02-22 23:06:08 +00:00
Chris Palmer
9e826c1a09 Merge branch 'martinbudden-belt_colors' 2020-02-22 23:02:03 +00:00
Chris Palmer
2c1dbe04a9 Added images and readme. 2020-02-22 23:01:50 +00:00
Chris Palmer
d644d6b698 Merge branch 'belt_colors' of https://github.com/martinbudden/NopSCADlib into martinbudden-belt_colors 2020-02-22 22:47:42 +00:00
Martin Budden
b7b5c837bd Used tube for buzzer. 2020-02-17 19:40:49 +00:00
Martin Budden
a793cb6d43 Added ability to use microswitch on a pcb. 2020-02-17 06:58:09 +00:00
Martin Budden
dc4e24b63a Simplified drawing of filament. 2020-02-16 23:06:07 +00:00
Martin Budden
8f85ac73dc Added space before screw length when length < 10 to ensure correct ordering.
This means 5mm, 6mm etc comes before 10mm in BOM.
2020-02-16 21:15:44 +00:00
Martin Budden
f5fdec613c Allow setting of color of rocker switch. Defaults to current colors. 2020-01-29 17:46:32 +00:00
Martin Budden
c55b8b6d1c Parameterised belt colors. 2020-01-29 17:40:34 +00:00
Martin Budden
56ec8e03ad Added PCB buzzer. 2020-01-29 17:37:01 +00:00
Martin Budden
728b7adf38 Add ability to display filament on spool. 2020-01-14 11:26:21 +00:00
17 changed files with 78 additions and 45 deletions

View File

@@ -26,7 +26,7 @@ OpenSCAD has to be setup to find libraries by setting the ```OPENSCADPATH``` env
in the directory it points to. This can be done with ```git clone https://github.com/nophead/NopSCADlib.git``` while in that directory or, if you don't want to use GIT,
by downloading https://github.com/nophead/NopSCADlib/archive/master.zip and unzipping it to a directory called NopSCADlib.
The ```NopSCADlib/scripts``` directory needs to be added to the executable search path.
The ```NopSCADlib/scripts``` directory needs to be added to the executable search path, ```PATH``` on Windows and ```path``` on Linux and Mac.
The installation can be tested by opening ```NopSCADlib/libtest.scad``` in the OpenSCAD GUI. It should render all the objects in the library in about 1 minute.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 764 KiB

After

Width:  |  Height:  |  Size: 766 KiB

View File

@@ -254,7 +254,7 @@ buttons_y = spades_y + 40;
jacks_y = buttons_y + 40;
microswitches_y = jacks_y + 40;
rockers_y = microswitches_y + 40;
toggles_y = rockers_y + 40;
toggles_y = rockers_y + 60;
components_y = toggles_y + 40;
translate([x2, leds_y])

View File

@@ -196,7 +196,7 @@ Individual teeth are not drawn, instead they are represented by a lighter colour
### Modules
| Module | Description |
|:--- |:--- |
| ```belt(type, points, gap = 0, gap_pt = undef)``` | Draw a belt path given a set of points and pitch radii where the pulleys are. Closed loop unless a gap is specified |
| ```belt(type, points, gap = 0, gap_pt = undef, belt_colour = grey20, tooth_colour = grey50)``` | Draw a belt path given a set of points and pitch radii where the pulleys are. Closed loop unless a gap is specified |
![belts](tests/png/belts.png)
@@ -213,7 +213,7 @@ Individual teeth are not drawn, instead they are represented by a lighter colour
| 2 | ```pulley(GT2x16_plain_idler)``` | Pulley GT2 idler smooth 9.63mm |
| 2 | ```pulley(GT2x20ob_pulley)``` | Pulley GT2OB 20 teeth |
| 1 | ```screw(M3_cs_cap_screw, 20)``` | Screw M3 cs cap x 20mm |
| 4 | ```screw(M3_grub_screw, 6)``` | Screw M3 grub x 6mm |
| 4 | ```screw(M3_grub_screw, 6)``` | Screw M3 grub x 6mm |
<a href="#top">Top</a>
@@ -1760,6 +1760,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| Module | Description |
|:--- |:--- |
| ```barrel_jack(cutout = false)``` | Draw barrel power jack |
| ```buzzer(height, diameter, colour)``` | Draw PCB buzzer with specified height, diameter and color |
| ```chip(length, width, thickness, colour, cutout = false)``` | Draw a coloured cube to represent a chip, or other rectangular component |
| ```flat_flex(cutout = false)``` | Draw flat flexistrip connector as used on RPI0 |
| ```flex(cutout = false)``` | Draw flexistrip connector |
@@ -2026,10 +2027,10 @@ Face order is bottom, top, left, right, front, back.
| 1 | ```psu(PD_150_12)``` | PSU PD-150-12 |
| 1 | ```psu(S_250_48)``` | PSU S-250-48 |
| 1 | ```psu(S_300_12)``` | PSU S-300-12 |
| 4 | ```screw(No632_pan_screw, 8)``` | Screw 6-32 pan x 8mm |
| 4 | ```screw(M3_cap_screw, 8)``` | Screw M3 cap x 8mm |
| 8 | ```screw(M3_pan_screw, 8)``` | Screw M3 pan x 8mm |
| 4 | ```screw(M4_cap_screw, 8)``` | Screw M4 cap x 8mm |
| 4 | ```screw(No632_pan_screw, 8)``` | Screw 6-32 pan x 8mm |
| 4 | ```screw(M3_cap_screw, 8)``` | Screw M3 cap x 8mm |
| 8 | ```screw(M3_pan_screw, 8)``` | Screw M3 pan x 8mm |
| 4 | ```screw(M4_cap_screw, 8)``` | Screw M4 cap x 8mm |
| 12 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
| 8 | ```washer(M4_washer)``` | Washer M4 x 9mm x 0.8mm |
@@ -2095,10 +2096,10 @@ Timing belt pulleys, both toothed and plain with internal bearings for idlers.
| 1 | ```pulley(GT2x20um_pulley)``` | Pulley GT2UM 20 teeth |
| 1 | ```pulley(T2p5x16_pulley)``` | Pulley T2.5 16 teeth |
| 1 | ```pulley(T5x10_pulley)``` | Pulley T5 10 teeth |
| 1 | ```screw(M3_grub_screw, 3)``` | Screw M3 grub x 3mm |
| 2 | ```screw(M3_grub_screw, 4)``` | Screw M3 grub x 4mm |
| 4 | ```screw(M3_grub_screw, 6)``` | Screw M3 grub x 6mm |
| 1 | ```screw(M4_grub_screw, 6)``` | Screw M4 grub x 6mm |
| 1 | ```screw(M3_grub_screw, 3)``` | Screw M3 grub x 3mm |
| 2 | ```screw(M3_grub_screw, 4)``` | Screw M3 grub x 4mm |
| 4 | ```screw(M3_grub_screw, 6)``` | Screw M3 grub x 6mm |
| 1 | ```screw(M4_grub_screw, 6)``` | Screw M4 grub x 6mm |
<a href="#top">Top</a>
@@ -2258,7 +2259,7 @@ Rocker switch. Also used for neon indicator in the same form factor.
| ```rocker_height(type)``` | Body height |
| ```rocker_part(type)``` | Part description |
| ```rocker_pivot(type)``` | Pivot distance from the back of the flange |
| ```rocker_slot_h(type)``` | Panel slow height |
| ```rocker_slot_h(type)``` | Panel slot height |
| ```rocker_slot_w(type)``` | Panel slot width |
| ```rocker_spades(type)``` | Spade types and positions |
| ```rocker_width(type)``` | Body width |
@@ -2266,7 +2267,7 @@ Rocker switch. Also used for neon indicator in the same form factor.
### Modules
| Module | Description |
|:--- |:--- |
| ```rocker(type)``` | Draw the specified rocker switch |
| ```rocker(type, colour)``` | Draw the specified rocker switch |
| ```rocker_hole(type, h = 0)``` | Make a hole to accept a rocker switch, by default 2D, set h for 3D |
![rockers](tests/png/rockers.png)
@@ -2274,8 +2275,8 @@ Rocker switch. Also used for neon indicator in the same form factor.
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | ```rocker(neon_indicator)``` | Neon Indicator H8630FBNAL |
| 1 | ```rocker(small_rocker)``` | Rocker Switch PRASA1-16F-BB0BW |
| 2 | ```rocker(neon_indicator)``` | Neon Indicator H8630FBNAL |
| 2 | ```rocker(small_rocker)``` | Rocker Switch PRASA1-16F-BB0BW |
<a href="#top">Top</a>
@@ -2383,14 +2384,14 @@ Machine screws and wood screws with various head styles.
| 1 | ```screw(M3_cap_screw, 10)``` | Screw M3 cap x 10mm |
| 1 | ```screw(M3_cs_cap_screw, 10)``` | Screw M3 cs cap x 10mm |
| 1 | ```screw(M3_dome_screw, 10)``` | Screw M3 dome x 10mm |
| 1 | ```screw(M3_grub_screw, 6)``` | Screw M3 grub x 6mm |
| 1 | ```screw(M3_grub_screw, 6)``` | Screw M3 grub x 6mm |
| 1 | ```screw(M3_hex_screw, 10)``` | Screw M3 hex x 10mm |
| 1 | ```screw(M3_low_cap_screw, 10)``` | Screw M3 low cap x 10mm |
| 1 | ```screw(M3_pan_screw, 10)``` | Screw M3 pan x 10mm |
| 1 | ```screw(M4_cap_screw, 25)``` | Screw M4 cap x 25mm |
| 1 | ```screw(M4_cs_cap_screw, 25)``` | Screw M4 cs cap x 25mm |
| 1 | ```screw(M4_dome_screw, 25)``` | Screw M4 dome x 25mm |
| 1 | ```screw(M4_grub_screw, 6)``` | Screw M4 grub x 6mm |
| 1 | ```screw(M4_grub_screw, 6)``` | Screw M4 grub x 6mm |
| 1 | ```screw(M4_hex_screw, 30)``` | Screw M4 hex x 30mm |
| 1 | ```screw(M4_pan_screw, 30)``` | Screw M4 pan x 30mm |
| 1 | ```screw(M5_cap_screw, 30)``` | Screw M5 cap x 30mm |
@@ -2562,7 +2563,7 @@ Filament spool models
### Modules
| Module | Description |
|:--- |:--- |
| ```spool(type)``` | Draw specified spool |
| ```spool(type, filament_depth = 0, filament_colour = "white", filament_d = 3)``` | Draw specified spool with optional filament |
![spools](tests/png/spools.png)
@@ -2712,7 +2713,7 @@ NEMA stepper motor model.
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 24 | ```screw(M3_pan_screw, 8)``` | Screw M3 pan x 8mm |
| 24 | ```screw(M3_pan_screw, 8)``` | Screw M3 pan x 8mm |
| 1 | ```NEMA(NEMA14)``` | Stepper motor NEMA14 x 36mm |
| 1 | ```NEMA(NEMA16)``` | Stepper motor NEMA16 x 19.2mm |
| 1 | ```NEMA(NEMA17S)``` | Stepper motor NEMA17 x 34mm |
@@ -3506,7 +3507,7 @@ Star washers can be omitted by setting ```star_washers``` to false.
| 3 | ```insert(F1BM2p5)``` | Heatfit insert M2.5 |
| 3 | ```insert(F1BM3)``` | Heatfit insert M3 |
| 3 | ```insert(F1BM4)``` | Heatfit insert M4 |
| 3 | ```screw(M2_cap_screw, 8)``` | Screw M2 cap x 8mm |
| 3 | ```screw(M2_cap_screw, 8)``` | Screw M2 cap x 8mm |
| 3 | ```screw(M2p5_pan_screw, 10)``` | Screw M2.5 pan x 10mm |
| 3 | ```screw(M3_dome_screw, 10)``` | Screw M3 dome x 10mm |
| 3 | ```screw(M4_dome_screw, 12)``` | Screw M4 dome x 12mm |
@@ -3726,7 +3727,7 @@ Star washers can be omitted by setting ```star_washers``` to false.
| 3 | ```insert(F1BM2p5)``` | Heatfit insert M2.5 |
| 3 | ```insert(F1BM3)``` | Heatfit insert M3 |
| 3 | ```insert(F1BM4)``` | Heatfit insert M4 |
| 3 | ```screw(M2_cap_screw, 8)``` | Screw M2 cap x 8mm |
| 3 | ```screw(M2_cap_screw, 8)``` | Screw M2 cap x 8mm |
| 3 | ```screw(M2p5_pan_screw, 10)``` | Screw M2.5 pan x 10mm |
| 3 | ```screw(M3_dome_screw, 10)``` | Screw M3 dome x 10mm |
| 3 | ```screw(M4_dome_screw, 16)``` | Screw M4 dome x 16mm |
@@ -3870,7 +3871,7 @@ inserts don't grip well in rubber.
| ---:|:--- |:---|
| 1 | ```insert(F1BM3)``` | Heatfit insert M3 |
| 1 | ```nut(M4_nut, nyloc = true)``` | Nut M4 x 3.2mm nyloc |
| 1 | ```screw(M3_cap_screw, 8)``` | Screw M3 cap x 8mm |
| 1 | ```screw(M3_cap_screw, 8)``` | Screw M3 cap x 8mm |
| 1 | ```screw(M4_cap_screw, 16)``` | Screw M4 cap x 16mm |
| 1 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
| 2 | ```washer(M4_washer)``` | Washer M4 x 9mm x 0.8mm |
@@ -4285,7 +4286,7 @@ be fully customised by passing a list of properties.
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 2 | ```insert(F1BM3)``` | Heatfit insert M3 |
| 2 | ```screw(M3_pan_screw, 8)``` | Screw M3 pan x 8mm |
| 2 | ```screw(M3_pan_screw, 8)``` | Screw M3 pan x 8mm |
| 2 | ```washer(M3_penny_washer)``` | Washer penny M3 x 12mm x 0.8mm |
| 2 | ```star_washer(M3_washer)``` | Washer star M3 x 0.5mm |
@@ -4757,7 +4758,7 @@ heirachical BOMs are also generated for real projects.
| ---:|:--- |:---|
| 1 | ```insert(F1BM3)``` | Heatfit insert M3 |
| 1 | ```widget(3)``` | Rivit like thing for 3mm sheets |
| 1 | ```screw(M3_cap_screw, 8)``` | Screw M3 cap x 8mm |
| 1 | ```screw(M3_cap_screw, 8)``` | Screw M3 cap x 8mm |
| 1 | ```sheet(PMMA3, 20, 20, 1)``` | Sheet acrylic 20mm x 20mm x 3mm |
| 1 | ```washer(M3_washer)``` | Washer M3 x 7mm x 0.5mm |
| 1 | ```star_washer(M3_washer)``` | Washer star M3 x 0.5mm |

View File

@@ -67,7 +67,7 @@ module belt_test() {
translate([-25, 0])
layout([for(b = belts) belt_width(b)], 10)
rotate([0, 90, 0])
belt(belts[$i], [[0, 0, 20], [0, 1, 20]]);
belt(belts[$i], [[0, 0, 20], [0, 1, 20]], belt_colour = $i%2==0 ? grey90 : grey20, tooth_colour = $i%2==0 ? grey70 : grey50);
}
if($preview)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 162 KiB

View File

@@ -21,9 +21,13 @@ use <../utils/layout.scad>
include <../vitamins/rockers.scad>
module rockers()
layout([for(r = rockers) rocker_flange_w(r)], 5)
module rockers() {
layout([for(r = rockers) rocker_flange_w(r)], 5) {
rocker(rockers[$i]);
translate([0, 25])
rocker(rockers[$i], $i==0 ? "red" : "green");
}
}
if($preview)
rockers();

View File

@@ -23,9 +23,9 @@ use <../utils/layout.scad>
include <../vitamins/spools.scad>
module spools()
layout([for(s = spools) spool_height(s)], 100)
layout([for(s = spools) spool_height(s)], 100) let(s = spools[$i])
rotate([90, 0, 90])
spool(spools[$i]);
spool(s, filament_depth = spool_depth(s) / 2, filament_colour = [pp1_colour, pp2_colour, pp3_colour, pp4_colour][$i % 4], filament_d = $i ? 3 : 1.75);
if($preview)
spools();

View File

@@ -41,9 +41,7 @@ function no_point(str) = chr([for(c = str) if(c == ".") ord("p") else ord(c)]);
// We model the belt path at the pitch radius of the pulleys and the pitch line of the belt to get an accurate length.
// The belt is then drawn by offseting each side from the pitch line.
//
module belt(type, points, gap = 0, gap_pt = undef) { //! Draw a belt path given a set of points and pitch radii where the pulleys are. Closed loop unless a gap is specified
belt_colour = grey20;
tooth_colour = grey50;
module belt(type, points, gap = 0, gap_pt = undef, belt_colour = grey20, tooth_colour = grey50) { //! Draw a belt path given a set of points and pitch radii where the pulleys are. Closed loop unless a gap is specified
width = belt_width(type);
pitch = belt_pitch(type);
thickness = belt_thickness(type);

View File

@@ -27,6 +27,7 @@ include <screws.scad>
include <buttons.scad>
include <green_terminals.scad>
include <pin_headers.scad>
include <microswitches.scad>
use <../utils/rounded_cylinder.scad>
use <../utils/dogbones.scad>
@@ -200,6 +201,13 @@ module jack(cutout = false) { //! Draw 3.5mm jack
}
}
module buzzer(height, diameter, colour) { //! Draw PCB buzzer with specified height, diameter and color
color (colour)
tube(or = diameter / 2, ir = height > 5 ? 1 : 0.75, h = height);
color("white")
cylinder(d = 2, h = max(height - 3 , 0.5));
}
function hdmi_depth(type) = type[2]; //! Front to back depth
function hdmi_width1(type) = type[3]; //! Inside width at the top
function hdmi_width2(type) = type[4]; //! Inside width at the bottom
@@ -710,6 +718,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
if(show(comp, "usb_Ax2")) usb_Ax2(cutouts);
if(show(comp, "usb_uA")) usb_uA(cutouts);
if(show(comp, "usb_B")) usb_B(cutouts);
if(show(comp, "buzzer")) buzzer(param(4, 9), param(5, 12), param(6, grey20));
if(show(comp, "jack")) jack(cutouts);
if(show(comp, "barrel_jack")) barrel_jack(cutouts);
if(show(comp, "hdmi")) hdmi(hdmi_full, cutouts);
@@ -728,6 +737,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
color(comp[7]) if(!cutouts) translate_z(comp[6] / 2) cube([comp[4], comp[5], comp[6]], center = true);
else if(comp[8]) translate([-50, 0, comp[6] / 2 - panel_clearance]) cube([100, comp[5] + 2 * panel_clearance, comp[6] + 2 * panel_clearance], center = true);
if(show(comp, "button_6mm")) square_button(button_6mm);
if(show(comp, "microswitch")) translate_z(microswitch_thickness(comp[4])/2) microswitch(comp[4]);
if(show(comp, "pcb")) if(!cutouts) translate_z(comp[4]) pcb(comp[5]);
if(show(comp, "standoff")) if(!cutouts) standoff(comp[4], comp[5], comp[6], comp[7]);
if(show(comp, "uSD")) uSD(comp[4], cutouts);

View File

@@ -17,6 +17,7 @@
// If not, see <https://www.gnu.org/licenses/>.
//
include <screws.scad>
include <microswitches.scad>
//
// l w t r h l c b h
// e i h a o a o o o
@@ -284,7 +285,6 @@ ArduinoLeonardo = ["ArduinoLeonardo", "Arduino Leonardo", 68.58, 53.34, 1.6, 0,
M2p5_pan_screw
];
Keyes5p1 = ["Keyes5p1", "Keyes5.1 Arduino Uno expansion board", 68.58, 53.34, 1.6, 0, 3.3, 0, "#2140BE", false, [[15.24, 50.8],[66.04, 35.56],[66.04, 7.62],[13.97, 2.54]],
[[30.226, -2.54, 0, "-2p54header", 10, 1],
[54.61, -2.54, 0, "-2p54header", 8, 1],
@@ -339,20 +339,18 @@ PERF74x51 = ["PERF74x51", "Perfboard 74 x 51mm", 74, 51, 1.0, 0, 3.0, 0, "sienna
PSU12V1A = ["PSU12V1A", "PSU 12V 1A", 67, 31, 1.7, 0, 3.9, 0, "green", true, [[3.5, 3.5], [-3.5, 3.5], [-3.5, -3.5], [3.5, -3.5]], [], []];
include <microswitches.scad>
RAMPSEndstop = ["RAMPSEndstop", "RAMPS Endstop Switch",
40.0, 16.0, 1.6, 0, 2.54, 0, "red", false,
[
[2, 2], [2, 13.5], [17, 13.5], [36, 13.5]
],
[
[ 12, 8, -90, "jst_xh", 3, true, "white", "silver"],
[ 26, 13.5, 0, "chip", 12, 4, 5.5],
[ 26, 10.5, 0, "chip", 12, 2, 5.5, "white"],
[ 27.5, 17, 15, "chip", 15, 0.5, 4.5, "silver"],
[ 26.5, 12.75, 0, "microswitch", small_microswitch],
],
[]];
pcbs = [ExtruderPCB, PI_IO, RPI0, EnviroPlus, RPI3, ArduinoUno3, ArduinoLeonardo, Keyes5p1, PERF80x20, PERF70x50, PERF70x30, PERF60x40, PERF74x51, PSU12V1A, DuetE, Duex2, Duex5, Melzi, ZC_A0591, RAMPSEndstop];
use <pcb.scad>

View File

@@ -25,7 +25,7 @@ use <spade.scad>
function rocker_part(type) = type[1]; //! Part description
function rocker_slot_w(type) = type[2]; //! Panel slot width
function rocker_slot_h(type) = type[3]; //! Panel slow height
function rocker_slot_h(type) = type[3]; //! Panel slot height
function rocker_flange_w(type) = type[4]; //! Flange width
function rocker_flange_h(type) = type[5]; //! Flange height
function rocker_flange_t(type) = type[6]; //! Flange thickness
@@ -37,7 +37,7 @@ function rocker_pivot(type) = type[11]; //! Pivot distance from the back of
function rocker_button(type) = type[12]; //! How far the button extends from the bezel
function rocker_spades(type) = type[13]; //! Spade types and positions
module rocker(type) { //! Draw the specified rocker switch
module rocker(type, colour) { //! Draw the specified rocker switch
vitamin(str("rocker(", type[0], "): ", rocker_part(type)));
bezel = rocker_bezel(type);
@@ -65,7 +65,7 @@ module rocker(type) { //! Draw the specified rocker switch
rounded_rectangle([rocker_width(type), rocker_height(type), rocker_depth(type) + eps], 0.5, center = false);
}
if(rocker_pivot(type))
color(grey30)
color(colour ? colour : grey30)
translate_z(rocker_pivot(type))
rotate([90, 0, 90])
linear_extrude(height = rocker_w, center = true)
@@ -78,7 +78,7 @@ module rocker(type) { //! Draw the specified rocker switch
}
else
color("red") cube([rocker_w, rocker_h, 2 * (rocker_flange_t(type) + rocker_button(type))], center = true);
color(colour ? colour : "red") cube([rocker_w, rocker_h, 2 * (rocker_flange_t(type) + rocker_button(type))], center = true);
for(spade = rocker_spades(type))
translate([spade[2], spade[3], -rocker_depth(type)])

View File

@@ -59,7 +59,7 @@ function screw_shorter_than(x) = x >= 20 ? floor(x / 5) * 5 : //! Returns longes
function screw_smaller_than(d) = d >= 2.5 && d < 3 ? 2.5 : floor(d); // Largest diameter screw less than or equal to specified diameter
module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified screw, optionally hobbed or nylon
description = str("Screw ", nylon ? "Nylon " : "", type[1], " x ", length, "mm", hob_point ? str(", hobbed at ", hob_point) : "");
description = str("Screw ", nylon ? "Nylon " : "", type[1], length < 10 ? " x " : " x ", length, "mm", hob_point ? str(", hobbed at ", hob_point) : "");
vitamin(str("screw(", type[0], "_screw, ", length, arg(hob_point, 0, "hob_point"), arg(nylon, false, "nylon"), "): ", description));
head_type = screw_head_type(type);

View File

@@ -20,6 +20,7 @@
//! Filament spool models
include <../core.scad>
include <../utils/tube.scad>
function spool_diameter(type) = type[1]; //! Outside diameter
function spool_width(type) = type[2]; //! Internal width
@@ -32,7 +33,7 @@ function spool_hub_taper(type) = type[8]; //! Diameter at which it tapers do
function spool_height(type) = spool_width(type) + 2 * spool_hub_thickness(type); //! Outside width
function spool_pitch(type) = spool_width(type) + spool_rim_thickness(type); //! Spacing of the rims
module spool(type) { //! Draw specified spool
module spool(type, filament_depth = 0, filament_colour = "white", filament_d = 3) { //! Draw specified spool with optional filament
vitamin(str("spool(", type[0], "): Filament spool ", spool_diameter(type), " x ", spool_width(type)));
h = spool_height(type);
@@ -57,4 +58,25 @@ module spool(type) { //! Draw specified spool
[r3, h - spool_hub_thickness(type) + spool_rim_thickness(type)],
[r2, h],
]);
if(filament_depth) {
w = spool_width(type);
r = r5 + filament_depth;
color(filament_colour)
if(filament_d) {
n = round(w / filament_d) + 1;
fd = w / n;
rotate_extrude($fn = 180) {
for(i = [0 : n -1])
translate([r - fd / 2, i * fd - w / 2 + fd / 2])
circle(d = fd, $fn = 32);
translate([r5, -w / 2])
square([filament_depth - fd / 2, w]);
}
}
else
tube(r, r5, w, $fn = 180);
}
}