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

Potentiometers now create a BOM entry and have a value specified.

This commit is contained in:
Chris Palmer
2021-10-28 12:43:53 +01:00
parent c35c732324
commit c8d9bb7d09
3 changed files with 35 additions and 23 deletions

View File

@@ -2390,6 +2390,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | `potentiometer(BTT_encoder)` | BTT_encoder |
| 1 | `box_header(2p54header, 4, 2)` | Box header 4 x 2 |
| 1 | `d_plug(DCONN9, pcb = true)` | D-type 9 way PCB mount plug |
| 1 | `dil_socket(12, 15.24)` | DIL socket 24 x 0.6" |
@@ -2397,6 +2398,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 1 | `pdip(24, 27C32, w = 15.24)` | IC 27C32 PDIP24 |
| 1 | `pdip(8, NE555)` | IC NE555 PDIP8 |
| 1 | `idc_transition(2p54header, 5)` | IDC transition header 5 x 2 |
| 1 | `potentiometer(KY_040_encoder)` | KY_040_encoder |
| 1 | `led(LED10mm, "yellow")` | LED 10 mm yellow |
| 1 | `led(LED3mm)` | LED 3 mm red |
| 1 | `led(LED5mm, "orange")` | LED 5 mm orange |
@@ -2826,10 +2828,19 @@ Potentiometers and rotary encoders
| Module | Description |
|:--- |:--- |
| `pot_nut(type, washer = true)` | Draw the nut for a potentiometer and possibly a washer |
| `potentiometer(type, thickness = 3, shaft_length = undef)` | Draw a potentiometer with nut spaced by specified thickness |
| `potentiometer(type, thickness = 3, shaft_length = undef, value = false)` | Draw a potentiometer with nut spaced by specified thickness |
![potentiometers](tests/png/potentiometers.png)
### Vitamins
| Qty | Module call | BOM entry |
| ---:|:--- |:---|
| 1 | `potentiometer(BTT_encoder)` | BTT_encoder |
| 1 | `potentiometer(KY_040_encoder)` | KY_040_encoder |
| 1 | `potentiometer(imperial_pot)` | Potentiometer imperial_pot |
| 1 | `potentiometer(imperial_pot_x2)` | Potentiometer imperial_pot_x2 |
| 1 | `potentiometer(metric_pot)` | Potentiometer metric_pot |
<a href="#top">Top</a>

View File

@@ -27,21 +27,21 @@ pot_proud = 0.3;
spigot_r = 0.5;
tab = [3.2, 0.5];
function pot_body(type) = type[0]; //! Body diameter or width & depth, height and corner radius
function pot_face(type) = type[1]; //! Faceplate rib width, plate depth and plate height
function pot_wafer(type) = type[2]; //! Width, diameter and thickness of the track wafer plus true if curved
function pot_gangs(type) = type[3]; //! Number of gangs for mult-gang pot
function pot_thread_d(type) = type[4]; //! Nomininal thread diameter
function pot_thread_p(type) = type[5]; //! Thread pritch
function pot_thread_h(type) = type[6]; //! Height of threaded part
function pot_boss_d(type) = type[7]; //! Boss diameter
function pot_boss_h(type) = type[8]; //! Boss height
function pot_spigot(type) = type[9]; //! Spigot width, length and height above the boss
function pot_spigot_x(type) = type[10]; //! Spigot offset from the shaft centre
function pot_shaft(type) = type[11]; //! Diameter, flat diameter, length and flat/slot length and colour. If flat diameter is less than the radius then it is a slot width
function pot_neck(type) = type[12]; //! Diameter and length of the shaft neck
function pot_nut(type) = type[13]; //! Across flat diameter and thickness of the nut
function pot_washer(type) = type[14]; //! Outside diameter and thickness of the washer
function pot_body(type) = type[1]; //! Body diameter or width & depth, height and corner radius
function pot_face(type) = type[2]; //! Faceplate rib width, plate depth and plate height
function pot_wafer(type) = type[3]; //! Width, diameter and thickness of the track wafer plus true if curved
function pot_gangs(type) = type[4]; //! Number of gangs for mult-gang pot
function pot_thread_d(type) = type[5]; //! Nomininal thread diameter
function pot_thread_p(type) = type[6]; //! Thread pritch
function pot_thread_h(type) = type[7]; //! Height of threaded part
function pot_boss_d(type) = type[8]; //! Boss diameter
function pot_boss_h(type) = type[9]; //! Boss height
function pot_spigot(type) = type[10]; //! Spigot width, length and height above the boss
function pot_spigot_x(type) = type[11]; //! Spigot offset from the shaft centre
function pot_shaft(type) = type[12]; //! Diameter, flat diameter, length and flat/slot length and colour. If flat diameter is less than the radius then it is a slot width
function pot_neck(type) = type[13]; //! Diameter and length of the shaft neck
function pot_nut(type) = type[14]; //! Across flat diameter and thickness of the nut
function pot_washer(type) = type[15]; //! Outside diameter and thickness of the washer
function pot_size(type) = let(d = pot_body(type)) len(d) > 3 ? [d.x , d.y, d.z] : [d.x, d.x, d.y]; //! Get pot body dimensions
@@ -86,7 +86,7 @@ module pot_nut(type, washer = true) { //! Draw the nut for a potentiometer and p
}
}
module potentiometer(type, thickness = 3, shaft_length = undef) {//! Draw a potentiometer with nut spaced by specified thickness
module potentiometer(type, thickness = 3, shaft_length = undef, value = false) {//! Draw a potentiometer with nut spaced by specified thickness
bh = pot_boss_h(type);
s = pot_size(type);
face = pot_face(type);
@@ -97,6 +97,7 @@ module potentiometer(type, thickness = 3, shaft_length = undef) {//! Draw a pote
thread_d = pot_thread_d(type);
thread_h = pot_thread_h(type);
shaft = pot_shaft(type);
vitamin(str("potentiometer(", type[0], "): ", slice(type[0], start = -8) != "_encoder" ? "Potentiometer " : "", value ? value : type[0]));
color(dia_cast_colour) {
// Boss

View File

@@ -17,12 +17,12 @@
// If not, see <https://www.gnu.org/licenses/>.
//
//! Potentiometers and rotary encoders
// body h r face wafer gangs thread d pitch h boss h spigot w, l, h offset shaft d flat d shaft h flat h colour neck nut washer
imperial_pot_x2 = [[24, 22.5, 1.5], [5.7, 15.33, 0.8], [20, 28, 1.6, true], 2, inch(3/8), inch(1/32), 6.35, 13.6, 2.4, [1.12, 3.03, 2], 11, [6.27, 5.5, 44.3, 44.3, silver], [0, 0], [13.3, 2.4, brass], [17.4, 0.8, grey(20), 9]];
imperial_pot = [[24, 12, 1.5], [5.7, 15.33, 0.8], [20, 28, 1.6, true], 1, inch(3/8), inch(1/32), 6.35, 13.6, 2.4, [1.12, 3.03, 2], 11, [6.27, 5.5, 44.3, 44.3, grey(95)], [0, 0], [13.3, 2.4, brass], [17.4, 0.8, grey(20), 9]];
metric_pot = [[23, 11, 1.0], [0, 15.33, 0.8], [18, 27, 1.2, false], 1, 10, 0.75, 7.32, 13.9, 2.5, [1.12, 2.88, 1.26], 11, [6.27, 5.5, 43.8, 43.5, grey(50)], [0, 0], [12.8, 2, silver], [17.7, 0.8, grey(20), 10]];
KY_040_encoder = [[12, 12, 6.5, 1.0], false, false, 1, 7, 0.75, 7, 0, 0, [0.4, 2, 0.8],5.8, [6, 4.5, 13, 10, grey(60)], [4, 0.5],[9.8, 2.2, silver], [11.5, 0.4, silver]];
BTT_encoder = [[12, 11, 6, 0.5], false, false, 1, 6, 0.8, 4.5, 0, 0, false, 0, [5, 0.75, 9.5, 9, silver], [3, 0.5]];
// body h r face wafer gangs thread d pitch h boss h spigot w, l, h offset shaft d flat d shaft h flat h colour neck nut washer
imperial_pot_x2 = ["imperial_pot_x2", [24, 22.5, 1.5], [5.7, 15.33, 0.8], [20, 28, 1.6, true], 2, inch(3/8), inch(1/32), 6.35, 13.6, 2.4, [1.12, 3.03, 2], 11, [6.27, 5.5, 44.3, 44.3, silver], [0, 0], [13.3, 2.4, brass], [17.4, 0.8, grey(20), 9]];
imperial_pot = ["imperial_pot", [24, 12, 1.5], [5.7, 15.33, 0.8], [20, 28, 1.6, true], 1, inch(3/8), inch(1/32), 6.35, 13.6, 2.4, [1.12, 3.03, 2], 11, [6.27, 5.5, 44.3, 44.3, grey(95)], [0, 0], [13.3, 2.4, brass], [17.4, 0.8, grey(20), 9]];
metric_pot = ["metric_pot", [23, 11, 1.0], [0, 15.33, 0.8], [18, 27, 1.2, false], 1, 10, 0.75, 7.32, 13.9, 2.5, [1.12, 2.88, 1.26], 11, [6.27, 5.5, 43.8, 43.5, grey(50)], [0, 0], [12.8, 2, silver], [17.7, 0.8, grey(20), 10]];
KY_040_encoder = ["KY_040_encoder", [12, 12, 6.5, 1.0], false, false, 1, 7, 0.75, 7, 0, 0, [0.4, 2, 0.8],5.8, [6, 4.5, 13, 10, grey(60)], [4, 0.5],[9.8, 2.2, silver], [11.5, 0.4, silver]];
BTT_encoder = ["BTT_encoder", [12, 11, 6, 0.5], false, false, 1, 6, 0.8, 4.5, 0, 0, false, 0, [5, 0.75, 9.5, 9, silver], [3, 0.5]];
potentiometers = [BTT_encoder, KY_040_encoder, metric_pot, imperial_pot, imperial_pot_x2];