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

Added SMD capacitors.

This commit is contained in:
Chris Palmer
2021-06-08 08:08:35 +01:00
parent 3bc8f35e37
commit b8efa11fd9
6 changed files with 38 additions and 0 deletions

View File

@@ -3387,6 +3387,8 @@ Surface mount components for PCBs.
### Properties
| Function | Description |
|:--- |:--- |
| `smd_cap_end_cap(type)` | End cap width |
| `smd_cap_size(type)` | Body length, width |
| `smd_led_lens(type)` | Lens length width and height |
| `smd_led_size(type)` | Body length, width and height |
| `smd_res_end_cap(type)` | End cap width |
@@ -3403,6 +3405,7 @@ Surface mount components for PCBs.
### Modules
| Module | Description |
|:--- |:--- |
| `smd_capacitor(type, height)` | Draw an SMD capacitor with specified height |
| `smd_led(type, colour, cutout)` | Draw an SMD LED with specified `colour` |
| `smd_resistor(type, value)` | Draw an SMD resistor with specified value |
@@ -3413,6 +3416,9 @@ Surface mount components for PCBs.
| ---:|:--- |:---|
| 1 | `smd_led(LED0603, green)` | SMD LED 0603 green |
| 1 | `smd_led(LED0805, blue)` | SMD LED 0805 blue |
| 1 | `smd_capacitor(CAP0603)` | SMD capacitor 0603 |
| 1 | `smd_capacitor(CAP0805)` | SMD capacitor 0805 |
| 1 | `smd_capacitor(CAP1206)` | SMD capacitor 1206 |
| 1 | `smd_resistor(RES0603, 1R0)` | SMD resistor 0603 1R0 0.1W |
| 1 | `smd_resistor(RES0805, 10M)` | SMD resistor 0805 10M 0.125W |
| 1 | `smd_resistor(RES1206, 100K)` | SMD resistor 1206 100K 0.25W |

View File

@@ -28,6 +28,11 @@ module smds() {
translate([0, 3])
layout([for(l = smd_leds) smd_led_size(l).x], 1)
smd_led(smd_leds[$i], ["green", "blue", "red"][$i % 3]);
translate([0, 6])
layout([for(c = smd_capacitors) smd_cap_size(c).x], 1)
let(c = smd_capacitors[$i])
smd_capacitor(c, smd_cap_size(c).y * 0.8);
}
if($preview)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

@@ -966,6 +966,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
if(show(comp, "potentiometer")) potentiometer(param(4, 5), param(5, 9));
if(show(comp, "buzzer")) buzzer(param(4, 9), param(5, 12), param(6, grey(20)));
if(show(comp, "smd_res")) smd_resistor(comp[4], comp[5]);
if(show(comp, "smd_cap")) smd_capacitor(comp[4], comp[5]);
}
}
}

View File

@@ -109,3 +109,23 @@ module smd_resistor(type, value) { //! Draw an SMD resistor with specified value
resize([(size.x - 2 * cap) * 0.75, size.y / 2])
text(value, halign = "center", valign = "center");
}
function smd_cap_size(type) = type[1]; //! Body length, width
function smd_cap_end_cap(type) = type[2]; //! End cap width
module smd_capacitor(type, height) { //! Draw an SMD capacitor with specified height
size = smd_cap_size(type);
vitamin(str("smd_capacitor(", type[0], "): SMD capacitor ", smd_size(size)));
cap = smd_cap_end_cap(type);
t = 0.02;
color("tan")
translate_z(height / 2)
cube([size.x - 2 * cap, size.y - 2 * t, height - 2 * t], center = true);
color(silver)
for(end = [-1, 1])
translate([end * (size.x / 2 - cap / 2), 0, height / 2])
cube([cap, size.y - 2 * eps, height], center = true);
}

View File

@@ -32,4 +32,10 @@ RES1206 = ["RES1206", [3.1, 1.6, 0.6], 0.5, 1/4];
smd_resistors = [RES0603, RES0805, RES1206];
CAP0603 = ["CAP0603", [1.6, 0.8], 0.3];
CAP0805 = ["CAP0805", [2.0, 1.2], 0.4];
CAP1206 = ["CAP1206", [3.1, 1.6], 0.5];
smd_capacitors = [CAP0603, CAP0805, CAP1206];
use <smd.scad>