mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-03-14 19:59:45 +01:00
Added pot_nut() module to draw potentiometer nuts and washers.
This commit is contained in:
parent
b541298eae
commit
82502eb470
BIN
libtest.png
BIN
libtest.png
Binary file not shown.
Before Width: | Height: | Size: 932 KiB After Width: | Height: | Size: 932 KiB |
@ -2799,6 +2799,7 @@ Potentiometers and rotary encoders
|
||||
| `pot_face(type)` | Faceplate rib width, plate depth and plate height |
|
||||
| `pot_gangs(type)` | Number of gangs for mult-gang pot |
|
||||
| `pot_neck(type)` | Diameter and length of the shaft neck |
|
||||
| `pot_nut(type)` | Across flat diameter and thickness of the nut |
|
||||
| `pot_shaft(type)` | Diameter, flat diameter, length and flat/slot length and colour. If flat diameter is less than the radius then it is a slot width |
|
||||
| `pot_spigot(type)` | Spigot width, length and height above the boss |
|
||||
| `pot_spigot_x(type)` | Spigot offset from the shaft centre |
|
||||
@ -2806,16 +2807,18 @@ Potentiometers and rotary encoders
|
||||
| `pot_thread_h(type)` | Height of threaded part |
|
||||
| `pot_thread_p(type)` | Thread pritch |
|
||||
| `pot_wafer(type)` | Width, diameter and thickness of the track wafer plus true if curved |
|
||||
| `pot_washer(type)` | Outside diameter and thickness of the washer |
|
||||
|
||||
### Functions
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| `pot_size(type)` | Get pot body dimensions |
|
||||
| `pot_z(type)` | Ideal distance behind panel surface to get the nut on comfortably |
|
||||
| `pot_z(type, washer = true)` | Ideal distance behind panel surface to get the nut and washer on comfortably |
|
||||
|
||||
### Modules
|
||||
| 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 |
|
||||
|
||||

|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 101 KiB |
Binary file not shown.
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 116 KiB |
@ -23,9 +23,13 @@ include <../vitamins/potentiometers.scad>
|
||||
|
||||
module potentiometers()
|
||||
layout([for(p = potentiometers) pot_size(p).x])
|
||||
hflip()
|
||||
hflip() {
|
||||
potentiometer(potentiometers[$i], shaft_length = 30);
|
||||
|
||||
translate_z(-3)
|
||||
pot_nut(potentiometers[$i]);
|
||||
}
|
||||
|
||||
if($preview)
|
||||
let($show_threads = true)
|
||||
potentiometers();
|
||||
|
@ -40,12 +40,52 @@ function pot_spigot(type) = type[9]; //! Spigot width, length and height abov
|
||||
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_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
|
||||
|
||||
function pot_z(type) = pot_thread_h(type) - pot_nut_t - pot_proud; //! Ideal distance behind panel surface to get the nut on comfortably
|
||||
function pot_z(type, washer = true) = pot_thread_h(type) - pot_nut(type)[1] - pot_proud - (washer ? pot_washer(type)[1] : 0); //! Ideal distance behind panel surface to get the nut and washer on comfortably
|
||||
function pot_spigot_r(type) = let(sp = pot_spigot(type)) sp.x > 2 * spigot_r ? spigot_r : 0;
|
||||
|
||||
module pot_nut(type, washer = true) { //! Draw the nut for a potentiometer and possibly a washer
|
||||
nut = pot_nut(type);
|
||||
washer = washer ? pot_washer(type) : false;
|
||||
nut_z = washer ? washer[1] : 0;
|
||||
thread_d = pot_thread_d(type);
|
||||
vflip() explode(23, explode_children = true) {
|
||||
if(washer)
|
||||
color(washer[2])
|
||||
linear_extrude(washer[1])
|
||||
difference() {
|
||||
circle(d = washer.x);
|
||||
|
||||
circle(d = thread_d);
|
||||
|
||||
serations = washer[3];
|
||||
if(serations)
|
||||
for(i = [1 : serations])
|
||||
rotate(i * 360 / serations)
|
||||
translate([thread_d / 2, 0])
|
||||
square([(washer.x - thread_d) / 2, PI * thread_d / (2 * serations)], center = true);
|
||||
}
|
||||
|
||||
if(nut)
|
||||
color(nut[2])
|
||||
translate_z(nut_z + exploded() * 10) {
|
||||
linear_extrude(nut[1])
|
||||
difference() {
|
||||
circle(d = nut.x / cos(30), $fn = 6);
|
||||
|
||||
circle(d = thread_d);
|
||||
}
|
||||
|
||||
if(show_threads && exploded())
|
||||
female_metric_thread(thread_d, pot_thread_p(type), nut[1], center = false, colour = nut[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module potentiometer(type, thickness = 3, shaft_length = undef) {//! Draw a potentiometer with nut spaced by specified thickness
|
||||
bh = pot_boss_h(type);
|
||||
s = pot_size(type);
|
||||
|
@ -17,11 +17,11 @@
|
||||
// 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 h flat h colour neck
|
||||
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]];
|
||||
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]];
|
||||
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]];
|
||||
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]];
|
||||
// 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]];
|
||||
|
||||
potentiometers = [BTT_encoder, KY_040_encoder, metric_pot, imperial_pot, imperial_pot_x2];
|
||||
|
Loading…
x
Reference in New Issue
Block a user