mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-08-06 23:46:30 +02:00
Added D_plug_d() function.
This commit is contained in:
@@ -876,6 +876,7 @@ D-connectors. Can be any number of ways, male or female, solder buckets, PCB mou
|
||||
| `d_connector_holes(type)` | Place children at the screw hole positions |
|
||||
| `d_pillar()` | Draw a pillar for a D-connector |
|
||||
| `d_plug(type, socket = false, pcb = false, idc = false)` | Draw specified D plug, which can be IDC, PCB or plain solder bucket |
|
||||
| `d_plug_D(length, width, rad)` | D plug D shape |
|
||||
| `d_socket(connector, pcb = false, idc = false)` | Draw specified D socket, which can be IDC, PCB or plain solder bucket |
|
||||
|
||||

|
||||
|
@@ -72,6 +72,16 @@ module d_pillar() { //! Draw a pillar for a D-connector
|
||||
female_metric_thread(screw, pitch, height, false, colour = d_pillar_colour);
|
||||
}
|
||||
|
||||
module d_plug_D(length, width, rad) { //! D plug D shape
|
||||
d = width / 2 - rad;
|
||||
offset = d * sin(10);
|
||||
|
||||
hull()
|
||||
for(x = [-1, 1], y = [-1, 1])
|
||||
translate([x * (length / 2 - rad) + y * x * offset, y * (width / 2 - rad)])
|
||||
circle(rad);
|
||||
}
|
||||
|
||||
module d_plug(type, socket = false, pcb = false, idc = false) { //! Draw specified D plug, which can be IDC, PCB or plain solder bucket
|
||||
hole_r = 3.05 / 2;
|
||||
dwall = 0.5;
|
||||
@@ -89,16 +99,6 @@ module d_plug(type, socket = false, pcb = false, idc = false) { //! Draw specifi
|
||||
vitamin(str(socket ? "d_socket(" : "d_plug(", type[0], arg(pcb, false, "pcb"), arg(idc, false, "idc"),
|
||||
"): D-type ", pins, " way ", desc, socket ? " socket" : " plug"));
|
||||
|
||||
module D(length, width, rad) {
|
||||
d = width / 2 - rad;
|
||||
offset = d * sin(10);
|
||||
|
||||
hull()
|
||||
for(x = [-1, 1], y = [-1, 1])
|
||||
translate([x * (length / 2 - rad) + y * x * offset, y * (width / 2 - rad)])
|
||||
circle(rad);
|
||||
}
|
||||
|
||||
module pin_positions()
|
||||
for($i = [1 : pins])
|
||||
translate([($i - (pins + 1) / 2) * 2.77 / 2, ($i % 2 - 0.5) * 2.84])
|
||||
@@ -117,14 +117,14 @@ module d_plug(type, socket = false, pcb = false, idc = false) { //! Draw specifi
|
||||
|
||||
linear_extrude(front_height, convexity = 5)
|
||||
difference() {
|
||||
D(d_length, d_width, 2.5);
|
||||
D(d_length - 2 * dwall, d_width - 2 * dwall, 2.5 - dwall);
|
||||
d_plug_D(d_length, d_width, 2.5);
|
||||
d_plug_D(d_length - 2 * dwall, d_width - 2 * dwall, 2.5 - dwall);
|
||||
}
|
||||
|
||||
if(!idc)
|
||||
rotate([0,180,0])
|
||||
hflip()
|
||||
linear_extrude(back_height, convexity = 5)
|
||||
D(d_lengths(type)[0] + 2 * dwall, d_widths(type)[0] + 2 * dwall, 2.5 + dwall);
|
||||
d_plug_D(d_lengths(type)[0] + 2 * dwall, d_widths(type)[0] + 2 * dwall, 2.5 + dwall);
|
||||
|
||||
}
|
||||
//
|
||||
@@ -134,12 +134,12 @@ module d_plug(type, socket = false, pcb = false, idc = false) { //! Draw specifi
|
||||
translate_z(d_flange_thickness(type) + eps)
|
||||
rotate([0, 180, 0])
|
||||
linear_extrude(back_height + 1 + d_flange_thickness(type), convexity = 5)
|
||||
D(d_length - dwall, d_width - dwall, 2.5 - dwall/2);
|
||||
d_plug_D(d_length - dwall, d_width - dwall, 2.5 - dwall/2);
|
||||
|
||||
if(socket)
|
||||
linear_extrude(front_height - eps, convexity = 5)
|
||||
difference() {
|
||||
D(d_length - dwall, d_width - dwall, 2.5 - dwall/2);
|
||||
d_plug_D(d_length - dwall, d_width - dwall, 2.5 - dwall/2);
|
||||
|
||||
pin_positions()
|
||||
circle(r = 0.7);
|
||||
|
Reference in New Issue
Block a user