mcopy/scad/cpc_connectors.scad

129 lines
2.9 KiB
OpenSCAD
Raw Normal View History

2023-03-05 05:28:39 +00:00
/*
Amphenol CPC 9pin Connectors
*/
include <./common/common.scad>;
2023-03-15 01:45:18 +00:00
PART="cpc_9pin_socket";
2023-03-08 21:01:02 +00:00
PlugD = 15.75;
PlugH = 11.65;
PlugGuideD = 17;
PlugPinD = 3.1;
PlugGuideRetraction = 1.25;
PinSpacing = 3.85;
2023-03-05 05:28:39 +00:00
SocketD = PlugD + 0.2;
2023-03-13 21:45:50 +00:00
SocketGuideD = PlugGuideD + 0.2;
2023-03-05 05:28:39 +00:00
2023-03-08 21:01:02 +00:00
CollarD = 19;
2023-03-13 21:45:50 +00:00
GuideAngles = [0, 100, 140, 220, 260];
2023-03-08 21:01:02 +00:00
GuideWidths = [3.2, 1.5, 1.5, 1.5, 1.5];
function arc_angle (D, W) = W / ((PI/180) * (D/2));
module guide (Diameter, Height, Angle, Width) {
A = arc_angle(Diameter, Width);
echo(A);
rotate([0, 0, Angle]) difference () {
cylinder(r = R(Diameter), h = Height, center = true, $fn = 200);
rotate([0, 0, -A/2]) translate([Diameter / 2, 0, 0]) cube([Diameter, Diameter * 2, Height + 1], center = true);
rotate([0, 0, A/2]) translate([-Diameter / 2, 0, 0]) cube([Diameter, Diameter * 2, Height + 1], center = true);
}
}
module plug_pin (X, Y, H) {
translate([X, Y, 0]) {
cylinder(r = R(PlugPinD), h = H, center = true, $fn = 40);
}
}
module plug_pin_voids (PinH) {
plug_pin(0, 0, PinH); //5
plug_pin(PinSpacing, 0, PinH); //4
plug_pin(-PinSpacing, 0, PinH); //6
plug_pin(0, PinSpacing, PinH); //2
plug_pin(0, -PinSpacing, PinH); //8
plug_pin(PinSpacing, PinSpacing, PinH); //1
plug_pin(-PinSpacing, PinSpacing, PinH); //3
plug_pin(-PinSpacing, -PinSpacing, PinH); //9
plug_pin(PinSpacing, -PinSpacing, PinH); //7
}
2023-03-05 05:28:39 +00:00
module cpc_9pin_plug () {
$fn = 200;
2023-03-08 21:01:02 +00:00
PinH = PlugH + 1;
2023-03-05 05:28:39 +00:00
difference () {
union () {
2023-03-08 21:01:02 +00:00
cylinder(r = R(PlugD), h = PlugH, center = true);
2023-03-13 21:45:50 +00:00
translate([0, 0, -(PlugH/2)+(2/2)]) cylinder(r = R(PlugD + 2), h = 2, center = true);
2023-03-08 21:01:02 +00:00
translate([0, 0, -PlugGuideRetraction/2]) {
for (i = [0 : len(GuideAngles) - 1]) {
guide(PlugGuideD, PlugH - PlugGuideRetraction, GuideAngles[i], GuideWidths[i]);
}
}
2023-03-05 05:28:39 +00:00
}
2023-03-08 21:01:02 +00:00
plug_pin_voids(PinH);
2023-03-05 05:28:39 +00:00
}
2023-03-13 21:45:50 +00:00
2023-03-05 05:28:39 +00:00
}
2023-03-05 22:13:42 +00:00
module cpc_9pin_plug_collar () {
2023-03-05 05:28:39 +00:00
$fn = 200;
H = 25;
difference () {
union () {
2023-03-08 21:01:02 +00:00
cylinder(r = R(CollarD), h = H, center = true);
2023-03-05 05:28:39 +00:00
}
2023-03-08 21:01:02 +00:00
cylinder(r = R(SocketD), h = H, center = true);
2023-03-05 05:28:39 +00:00
}
}
2023-03-13 21:45:50 +00:00
module cpc_9pin_plug_back () {
//
}
2023-03-05 05:28:39 +00:00
module cpc_9pin_socket () {
$fn = 200;
2023-03-13 21:45:50 +00:00
PinH = PlugH + 1;
difference () {
union () {
2023-03-15 01:45:18 +00:00
cylinder(r = R(CollarD), h = PlugH, center = true);
2023-03-13 21:45:50 +00:00
}
translate([0, 0, -9]) union () {
cylinder(r = R(SocketD), h = PlugH, center = true);
for (i = [0 : len(GuideAngles) - 1]) {
guide(SocketGuideD, PlugH, GuideAngles[i], GuideWidths[i] + 0.1);
}
}
plug_pin_voids(PinH);
}
}
2023-03-05 05:28:39 +00:00
2023-03-13 21:45:50 +00:00
module debug () {
2023-03-05 05:28:39 +00:00
difference () {
union () {
2023-03-13 21:45:50 +00:00
cpc_9pin_plug();
translate([0, 0, 13]) cpc_9pin_socket();
2023-03-05 05:28:39 +00:00
}
2023-03-13 21:45:50 +00:00
translate([25, 0, 0]) cube([50, 50, 100], center = true);
2023-03-05 05:28:39 +00:00
}
}
if (PART == "cpc_9pin_plug") {
cpc_9pin_plug();
2023-03-05 22:13:42 +00:00
} else if (PART == "cpc_9pin_plug_collar") {
cpc_9pin_plug_collar();
2023-03-13 21:45:50 +00:00
} else if (PART == "cpc_9pin_plug_back") {
cpc_9pin_plug_back();
2023-03-05 05:28:39 +00:00
} else if (PART == "cpc_9pin_socket") {
cpc_9pin_socket();
2023-03-13 21:45:50 +00:00
} else {
debug();
2023-03-05 05:28:39 +00:00
}