Skip to content

Commit ed3afe3

Browse files
Merge pull request #1877 from adrianVmariano/master
Add BSPP pipe thread
2 parents 85edc18 + b5f6901 commit ed3afe3

File tree

1 file changed

+152
-0
lines changed

1 file changed

+152
-0
lines changed

threading.scad

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,158 @@ module npt_threaded_rod(
10441044

10451045

10461046

1047+
// Module: bspp_threaded_rod()
1048+
// Synopsis: Creates British Standard Parallel Pipe (BSPP) threading.
1049+
// SynTags: Geom
1050+
// Topics: Threading, Screws
1051+
// See Also: npt_threaded_rod()
1052+
// Usage:
1053+
// bspp_threaded_rod(size, [internal=], ...) [ATTACHMENTS];
1054+
// Description:
1055+
// British Standard Pipe (BSP) is a set of screw thread standards used internationally (except in the USA)
1056+
// for connecting pipes. This module implements British STandard Pipe Parallel (BSPP) thread, where the
1057+
// threads are paralell, rather than tapered, and the joint is achieved by compression of an O-ring seal or washer.
1058+
// Constructs a BSPP end threading. If `internal=true`, creates a mask for making internal pipe threads.
1059+
// .
1060+
// The size was originally based on the inner diameter (in inches) of the pipe, but contemporary pipes have
1061+
// thinner walls, and hence an inner diameter larger than the nominal size.
1062+
// Arguments:
1063+
// size = BSP standard pipe size. 1/16, 1/8, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8, 1, 1+1/8, 1+1/4, 1+3/8, 1+1/2, 1+5/8, 1+3/4, 1+7/8 or 2.
1064+
// l / length / h / height = Length of threaded rod.
1065+
// ---
1066+
// left_handed = If true, create left-handed threads. Default: false
1067+
// starts = The number of lead starts. Default: 1
1068+
// internal = If true, make this a mask for making internal threads. Default: false
1069+
// bevel = Sets bevel for both ends. Set to true for default size, a number to specify a bevel size, false for no bevel, and "reverse" for an inverted bevel. Default: false for blunt start ends, true otherwise
1070+
// bevel1 = Set bevel for bottom end. Overrides bevel=.
1071+
// bevel2 = Set bevel for top end. Overrides bevel=.
1072+
// blunt_start = If true apply truncated blunt start threads at both ends. Default: true
1073+
// blunt_start1 = If true apply truncated blunt start threads bottom end.
1074+
// blunt_start2 = If true apply truncated blunt start threads top end.
1075+
// end_len = Specify the unthreaded length at the end after blunt start threads. Default: 0
1076+
// end_len1 = Specify unthreaded length at the bottom
1077+
// end_len2 = Specify unthreaded length at the top
1078+
// lead_in = Specify linear length of the lead in section of the threading with blunt start threads
1079+
// lead_in1 = Specify linear length of the lead in section of the threading at the bottom with blunt start threads
1080+
// lead_in2 = Specify linear length of the lead in section of the threading at the top with blunt start threads
1081+
// lead_in_ang = Specify angular length in degrees of the lead in section of the threading with blunt start threads
1082+
// lead_in_ang1 = Specify angular length in degrees of the lead in section of the threading at the bottom with blunt start threads
1083+
// lead_in_ang2 = Specify angular length in degrees of the lead in section of the threading at the top with blunt start threads
1084+
// lead_in_shape = Specify the shape of the thread lead in by giving a text string or function. Default: "default"
1085+
// anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `CENTER`
1086+
// spin = Rotate this many degrees around the Z axis after anchor. See [spin](attachments.scad#subsection-spin). Default: `0`
1087+
// orient = Vector to rotate top towards, after spin. See [orient](attachments.scad#subsection-orient). Default: `UP`
1088+
// $slop = The printer-specific slop value, which adds clearance (`4*$slop`) to internal threads.
1089+
// Examples(Med):
1090+
// bspp_threaded_rod(size=3/8, length = 10, $fn=72);
1091+
// bspp_threaded_rod(size=1/2, length = 10, $fn=72, bevel=true);
1092+
// bspp_threaded_rod(size=1/2, length = 10, left_handed=true, $fn=72);
1093+
// bspp_threaded_rod(size=3/4, length = 10, internal=true, $fn=96);
1094+
// Example:
1095+
// diff("remove"){
1096+
// cuboid([30,30,30])
1097+
// tag("remove"){
1098+
// up(.01)position(TOP)
1099+
// bspp_threaded_rod(size=1/2, length=30, $fn=96, internal=true, $slop=0.1, anchor=TOP);
1100+
// cyl(d=3/4*INCH, l=42, $fn=32);
1101+
// }
1102+
// }
1103+
bspp_dimensions = [
1104+
// Size TPI OD
1105+
[ 1/16, [ 28, 0.3041 ]],
1106+
[ 1/8, [ 28, 0.3372 ]],
1107+
[ 1/4, [ 19, 0.4506 ]],
1108+
[ 3/8, [ 19, 0.5886 ]],
1109+
[ 1/2, [ 14, 0.8250 ]],
1110+
[ 5/8, [ 14, 0.8105 ]],
1111+
[ 3/4, [ 14, 0.9495 ]],
1112+
[ 7/8, [ 14, 1.0975 ]],
1113+
[ 1, [ 11, 1.3090 ]],
1114+
[ 1+1/8, [ 11, 1.3756 ]],
1115+
[ 1+1/4, [ 11, 1.5335 ]],
1116+
[ 1+3/8, [ 11, 1.6285 ]],
1117+
[ 1+1/2, [ 11, 1.7656 ]],
1118+
[ 1+5/8, [ 11, 1.9656 ]],
1119+
[ 1+3/4, [ 11, 1.9995 ]],
1120+
[ 1+7/8, [ 11, 2.1276 ]],
1121+
[ 2, [ 11, 2.2306 ]],
1122+
];
1123+
function bspp_threaded_rod(
1124+
size,
1125+
left_handed=false, starts=1,
1126+
bevel,bevel1,bevel2,
1127+
internal=false,
1128+
length, height,
1129+
blunt_start, blunt_start1, blunt_start2,
1130+
lead_in, lead_in1, lead_in2,
1131+
lead_in_ang, lead_in_ang1, lead_in_ang2,
1132+
end_len, end_len1, end_len2,
1133+
lead_in_shape="default",
1134+
anchor, spin, orient
1135+
) = no_function("bspp_threaded_rod");
1136+
1137+
module bspp_threaded_rod(
1138+
size, l, h,
1139+
left_handed=false, starts=1,
1140+
bevel,bevel1,bevel2,
1141+
internal=false,
1142+
length, height,
1143+
blunt_start, blunt_start1, blunt_start2,
1144+
lead_in, lead_in1, lead_in2,
1145+
lead_in_ang, lead_in_ang1, lead_in_ang2,
1146+
end_len, end_len1, end_len2,
1147+
lead_in_shape="default",
1148+
anchor, spin, orient
1149+
)
1150+
{
1151+
assert(!is_undef(size), "undefined size");
1152+
assert(is_num(size), "size is not a number");
1153+
_pitch = 0;
1154+
_diameter = 1;
1155+
index = search(size, bspp_dimensions);
1156+
forcefuncall = assert(len(index), str("Unsupported BSPP size ", size, "."));
1157+
p = INCH / bspp_dimensions[index[0]][1][_pitch];
1158+
d = INCH * bspp_dimensions[index[0]][1][_diameter];
1159+
theta = 55 / 2;
1160+
H = p / (2 * tan(theta)); // : fundamental triangle height
1161+
hh = 2 * H / 3; // : actual depth of the thread
1162+
e = H * sin(theta) / 6; // : rounding arc's height
1163+
r = e / (1 - sin(theta)); // : rounding arc's radius
1164+
s = hh - 2 * e; // : straight flank depth
1165+
c = tan(theta) * (H / 6 + e); // : crest's half width
1166+
pStart = [-c, -e];
1167+
pEnd = [c, -e];
1168+
vStart = [(p / 2 - tan(theta) * (H / 6 + e)), -hh + e];
1169+
vEnd = [p / 2, -hh];
1170+
segments = 4;
1171+
// right valley rounding:
1172+
valley = arc(n = segments, cp = [p / 2, -(hh - r)], points = [vStart, vEnd]);
1173+
//stroke(valley, width = 0.01, color = "cyan");
1174+
// peak rounding:
1175+
peak = arc(n = 2 * segments, cp = [0, -r], points = [pStart, pEnd]);
1176+
//stroke(peak, width = 0.01, color = "cyan");
1177+
profile = scale(1 / p, concat(reverse(xflip(valley)), peak, valley));
1178+
//stroke(profile, width = 0.01, color = "cyan");
1179+
generic_threaded_rod(
1180+
d = d, length = length, height = height, h=h, l=l,
1181+
pitch = p, profile = profile,
1182+
left_handed=left_handed,
1183+
bevel=bevel,bevel1=bevel1,bevel2=bevel2,
1184+
internal=internal,
1185+
blunt_start=blunt_start, blunt_start1=blunt_start1, blunt_start2=blunt_start2,
1186+
lead_in=lead_in, lead_in1=lead_in1, lead_in2=lead_in2, lead_in_shape=lead_in_shape,
1187+
lead_in_ang=lead_in_ang, lead_in_ang1=lead_in_ang1, lead_in_ang2=lead_in_ang2,
1188+
end_len=end_len, end_len1=end_len1, end_len2=end_len2,
1189+
anchor=anchor,
1190+
spin=spin,starts=starts,
1191+
orient=orient
1192+
)
1193+
children();
1194+
}
1195+
1196+
1197+
1198+
10471199
// Section: Buttress Threading
10481200

10491201
// Module: buttress_threaded_rod()

0 commit comments

Comments
 (0)