@code3d/screws 0.0.1-alpha.3 → 0.0.1-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +228 -40
  2. package/bld/chunks/chunk-2DGVQRQ5.js +78 -0
  3. package/bld/chunks/chunk-2DGVQRQ5.js.map +7 -0
  4. package/bld/chunks/chunk-4FMUSJBB.js +27 -0
  5. package/bld/chunks/chunk-4FMUSJBB.js.map +7 -0
  6. package/bld/chunks/chunk-7UGU5EFV.js +87 -0
  7. package/bld/chunks/chunk-7UGU5EFV.js.map +7 -0
  8. package/bld/chunks/chunk-DKS4VANI.js +27 -0
  9. package/bld/chunks/chunk-DKS4VANI.js.map +7 -0
  10. package/bld/chunks/chunk-ES62SR3Q.js +21 -0
  11. package/bld/chunks/chunk-ES62SR3Q.js.map +7 -0
  12. package/bld/chunks/chunk-ESLSQKZW.js +25 -0
  13. package/bld/chunks/chunk-ESLSQKZW.js.map +7 -0
  14. package/bld/chunks/chunk-GAX6375G.js +25 -0
  15. package/bld/chunks/chunk-GAX6375G.js.map +7 -0
  16. package/bld/chunks/chunk-GIIOR3XJ.js +49 -0
  17. package/bld/chunks/chunk-GIIOR3XJ.js.map +7 -0
  18. package/bld/chunks/chunk-HPPYZYCK.js +23 -0
  19. package/bld/chunks/chunk-HPPYZYCK.js.map +7 -0
  20. package/bld/chunks/chunk-IXFHRZSY.js +121 -0
  21. package/bld/chunks/chunk-IXFHRZSY.js.map +7 -0
  22. package/bld/chunks/chunk-MEIKYZ23.js +84 -0
  23. package/bld/chunks/chunk-MEIKYZ23.js.map +7 -0
  24. package/bld/chunks/chunk-O34BMYJV.js +84 -0
  25. package/bld/chunks/chunk-O34BMYJV.js.map +7 -0
  26. package/bld/chunks/chunk-P3M5KQ5U.js +46 -0
  27. package/bld/chunks/chunk-P3M5KQ5U.js.map +7 -0
  28. package/bld/chunks/chunk-PFFNLWWR.js +25 -0
  29. package/bld/chunks/chunk-PFFNLWWR.js.map +7 -0
  30. package/bld/chunks/chunk-SDUJLXOE.js +46 -0
  31. package/bld/chunks/chunk-SDUJLXOE.js.map +7 -0
  32. package/bld/chunks/chunk-SDYJF2XK.js +25 -0
  33. package/bld/chunks/chunk-SDYJF2XK.js.map +7 -0
  34. package/bld/chunks/chunk-SGDNOA44.js +92 -0
  35. package/bld/chunks/chunk-SGDNOA44.js.map +7 -0
  36. package/bld/chunks/chunk-SPFHOFBC.js +125 -0
  37. package/bld/chunks/chunk-SPFHOFBC.js.map +7 -0
  38. package/bld/chunks/chunk-VVX3WOBG.js +160 -0
  39. package/bld/chunks/chunk-VVX3WOBG.js.map +7 -0
  40. package/bld/chunks/chunk-W62ASGIP.js +25 -0
  41. package/bld/chunks/chunk-W62ASGIP.js.map +7 -0
  42. package/bld/chunks/chunk-Z5LEGL77.js +464 -0
  43. package/bld/chunks/chunk-Z5LEGL77.js.map +7 -0
  44. package/bld/chunks/chunk-ZNWKI54A.js +25 -0
  45. package/bld/chunks/chunk-ZNWKI54A.js.map +7 -0
  46. package/bld/library/common.d.ts +104 -0
  47. package/bld/library/common.d.ts.map +1 -0
  48. package/bld/library/gb-2672.d.ts +8 -0
  49. package/bld/library/gb-2672.d.ts.map +1 -0
  50. package/bld/library/gb-2672.js +17 -0
  51. package/bld/library/gb-2672.js.map +7 -0
  52. package/bld/library/gb-5281.d.ts +8 -0
  53. package/bld/library/gb-5281.d.ts.map +1 -0
  54. package/bld/library/gb-5281.js +15 -0
  55. package/bld/library/gb-5281.js.map +7 -0
  56. package/bld/library/gb-5782.d.ts +8 -0
  57. package/bld/library/gb-5782.d.ts.map +1 -0
  58. package/bld/library/gb-5782.js +19 -0
  59. package/bld/library/gb-5782.js.map +7 -0
  60. package/bld/library/gb-5783.d.ts +8 -0
  61. package/bld/library/gb-5783.d.ts.map +1 -0
  62. package/bld/library/gb-5783.js +19 -0
  63. package/bld/library/gb-5783.js.map +7 -0
  64. package/bld/library/gb-70-1.d.ts +8 -0
  65. package/bld/library/gb-70-1.d.ts.map +1 -0
  66. package/bld/library/gb-70-1.js +17 -0
  67. package/bld/library/gb-70-1.js.map +7 -0
  68. package/bld/library/gb-70-2.d.ts +8 -0
  69. package/bld/library/gb-70-2.d.ts.map +1 -0
  70. package/bld/library/gb-70-2.js +17 -0
  71. package/bld/library/gb-70-2.js.map +7 -0
  72. package/bld/library/gb-70-3.d.ts +8 -0
  73. package/bld/library/gb-70-3.d.ts.map +1 -0
  74. package/bld/library/gb-70-3.js +17 -0
  75. package/bld/library/gb-70-3.js.map +7 -0
  76. package/bld/library/gb-70-4.d.ts +8 -0
  77. package/bld/library/gb-70-4.d.ts.map +1 -0
  78. package/bld/library/gb-70-4.js +17 -0
  79. package/bld/library/gb-70-4.js.map +7 -0
  80. package/bld/library/gb-80.d.ts +8 -0
  81. package/bld/library/gb-80.d.ts.map +1 -0
  82. package/bld/library/gb-80.js +13 -0
  83. package/bld/library/gb-80.js.map +7 -0
  84. package/bld/library/gb-818.d.ts +8 -0
  85. package/bld/library/gb-818.d.ts.map +1 -0
  86. package/bld/library/gb-818.js +17 -0
  87. package/bld/library/gb-818.js.map +7 -0
  88. package/bld/library/hex-head.d.ts +18 -0
  89. package/bld/library/hex-head.d.ts.map +1 -0
  90. package/bld/library/index.d.ts +19 -0
  91. package/bld/library/index.d.ts.map +1 -1
  92. package/bld/library/index.js +80 -455
  93. package/bld/library/index.js.map +3 -3
  94. package/bld/library/iso-10642.d.ts +51 -0
  95. package/bld/library/iso-10642.d.ts.map +1 -0
  96. package/bld/library/iso-10642.js +16 -0
  97. package/bld/library/iso-10642.js.map +7 -0
  98. package/bld/library/iso-14583.d.ts +35 -0
  99. package/bld/library/iso-14583.d.ts.map +1 -0
  100. package/bld/library/iso-14583.js +16 -0
  101. package/bld/library/iso-14583.js.map +7 -0
  102. package/bld/library/iso-4014.d.ts +20 -0
  103. package/bld/library/iso-4014.d.ts.map +1 -0
  104. package/bld/library/iso-4014.js +18 -0
  105. package/bld/library/iso-4014.js.map +7 -0
  106. package/bld/library/iso-4017.d.ts +20 -0
  107. package/bld/library/iso-4017.d.ts.map +1 -0
  108. package/bld/library/iso-4017.js +18 -0
  109. package/bld/library/iso-4017.js.map +7 -0
  110. package/bld/library/iso-4029.d.ts +32 -0
  111. package/bld/library/iso-4029.d.ts.map +1 -0
  112. package/bld/library/iso-4029.js +12 -0
  113. package/bld/library/iso-4029.js.map +7 -0
  114. package/bld/library/iso-4762.d.ts +10 -152
  115. package/bld/library/iso-4762.d.ts.map +1 -1
  116. package/bld/library/iso-4762.js +16 -0
  117. package/bld/library/iso-4762.js.map +7 -0
  118. package/bld/library/iso-7045.d.ts +33 -0
  119. package/bld/library/iso-7045.d.ts.map +1 -0
  120. package/bld/library/iso-7045.js +16 -0
  121. package/bld/library/iso-7045.js.map +7 -0
  122. package/bld/library/iso-7379.d.ts +56 -0
  123. package/bld/library/iso-7379.d.ts.map +1 -0
  124. package/bld/library/iso-7379.js +14 -0
  125. package/bld/library/iso-7379.js.map +7 -0
  126. package/bld/library/iso-7380-1.d.ts +31 -0
  127. package/bld/library/iso-7380-1.d.ts.map +1 -0
  128. package/bld/library/iso-7380-1.js +16 -0
  129. package/bld/library/iso-7380-1.js.map +7 -0
  130. package/bld/library/iso-7380-2.d.ts +33 -0
  131. package/bld/library/iso-7380-2.d.ts.map +1 -0
  132. package/bld/library/iso-7380-2.js +16 -0
  133. package/bld/library/iso-7380-2.js.map +7 -0
  134. package/package.json +82 -2
  135. package/src/library/common.ts +367 -0
  136. package/src/library/gb-2672.ts +7 -0
  137. package/src/library/gb-5281.ts +7 -0
  138. package/src/library/gb-5782.ts +7 -0
  139. package/src/library/gb-5783.ts +7 -0
  140. package/src/library/gb-70-1.ts +7 -0
  141. package/src/library/gb-70-2.ts +7 -0
  142. package/src/library/gb-70-3.ts +7 -0
  143. package/src/library/gb-70-4.ts +7 -0
  144. package/src/library/gb-80.ts +7 -0
  145. package/src/library/gb-818.ts +7 -0
  146. package/src/library/hex-head.ts +53 -0
  147. package/src/library/index.ts +20 -0
  148. package/src/library/iso-10642.ts +173 -0
  149. package/src/library/iso-14583.ts +181 -0
  150. package/src/library/iso-4014.ts +64 -0
  151. package/src/library/iso-4017.ts +62 -0
  152. package/src/library/iso-4029.ts +101 -0
  153. package/src/library/iso-4762.ts +70 -300
  154. package/src/library/iso-7045.ts +134 -0
  155. package/src/library/iso-7379.ts +230 -0
  156. package/src/library/iso-7380-1.ts +110 -0
  157. package/src/library/iso-7380-2.ts +135 -0
  158. package/src/library/thread.ts +7 -1
@@ -0,0 +1,25 @@
1
+ import {
2
+ clearanceHole,
3
+ resolveSpecification,
4
+ screw,
5
+ specifications,
6
+ threadLength
7
+ } from "./chunk-SPFHOFBC.js";
8
+ import {
9
+ __export
10
+ } from "./chunk-Z5LEGL77.js";
11
+
12
+ // packages/screws/src/library/gb-2672.ts
13
+ var gb_2672_exports = {};
14
+ __export(gb_2672_exports, {
15
+ clearanceHole: () => clearanceHole,
16
+ resolveSpecification: () => resolveSpecification,
17
+ screw: () => screw,
18
+ specifications: () => specifications,
19
+ threadLength: () => threadLength
20
+ });
21
+
22
+ export {
23
+ gb_2672_exports
24
+ };
25
+ //# sourceMappingURL=chunk-GAX6375G.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/library/gb-2672.ts"],
4
+ "sourcesContent": ["/**\n * GB/T 2672-2017 (MOD ISO 14583:2011).\n * Shares the corresponding ISO module's nominal geometry within our preset\n * range. See the package README for sizes, hole allowances and modeling limits.\n * https://std.samr.gov.cn/gb/search/gbDetailed?id=71F772D818CAD3A7E05397BE0A0AB82A\n */\nexport * from './iso-14583.js';\n"],
5
+ "mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,49 @@
1
+ import {
2
+ __name,
3
+ metric,
4
+ positive,
5
+ validateHead
6
+ } from "./chunk-Z5LEGL77.js";
7
+
8
+ // packages/screws/src/library/hex-head.ts
9
+ import { frustum, intersect, regularPrism } from "@code3d/core";
10
+ function specification(size, headWidth, headHeight, underHeadRadius) {
11
+ return {
12
+ ...metric(size),
13
+ headWidth,
14
+ headHeight,
15
+ underHeadRadius,
16
+ headDiameter: 2 * headWidth / Math.sqrt(3)
17
+ };
18
+ }
19
+ __name(specification, "specification");
20
+ var specifications = {
21
+ M3: specification("M3", 5.5, 2, 0.1),
22
+ M4: specification("M4", 7, 2.8, 0.2),
23
+ M5: specification("M5", 8, 3.5, 0.2),
24
+ M6: specification("M6", 10, 4, 0.25),
25
+ M8: specification("M8", 13, 5.3, 0.4),
26
+ M10: specification("M10", 16, 6.4, 0.4),
27
+ M12: specification("M12", 18, 7.5, 0.6)
28
+ };
29
+ function hexHead(spec) {
30
+ validateHead(spec);
31
+ positive("Head width", spec.headWidth);
32
+ if (Math.abs(spec.headDiameter - 2 * spec.headWidth / Math.sqrt(3)) > 1e-6)
33
+ throw new Error("Hex head diameter must describe its corner envelope.");
34
+ const radius = spec.headWidth / Math.sqrt(3);
35
+ const blank = regularPrism(radius, spec.headHeight, 6, 30);
36
+ const chamferEnvelope = frustum(
37
+ spec.headWidth / 2 + spec.headHeight * Math.sqrt(3),
38
+ spec.headWidth / 2,
39
+ spec.headHeight
40
+ );
41
+ return intersect([blank, chamferEnvelope]);
42
+ }
43
+ __name(hexHead, "hexHead");
44
+
45
+ export {
46
+ specifications,
47
+ hexHead
48
+ };
49
+ //# sourceMappingURL=chunk-GIIOR3XJ.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/library/hex-head.ts"],
4
+ "sourcesContent": ["import {frustum, intersect, regularPrism} from '@code3d/core';\nimport {\n metric,\n validateHead,\n positive,\n type HeadSpecification,\n type MetricSize,\n} from './common.js';\n\nexport type Specification = HeadSpecification & Readonly<{headWidth: number}>;\n\n// Shared head dimensions of ISO 4014 and ISO 4017. ISO widths, not DIN 931/933.\n// https://www.vipafasteners.com/files/0/801-PARTIAL_THREAD_HEXAGON_HEAD_SCREWS_ISO_4014_UNI_5737_DIN_931.pdf\nfunction specification(\n size: MetricSize,\n headWidth: number,\n headHeight: number,\n underHeadRadius: number,\n): Specification {\n return {\n ...metric(size),\n headWidth,\n headHeight,\n underHeadRadius,\n headDiameter: (2 * headWidth) / Math.sqrt(3),\n };\n}\n\nexport const specifications = {\n M3: specification('M3', 5.5, 2, 0.1),\n M4: specification('M4', 7, 2.8, 0.2),\n M5: specification('M5', 8, 3.5, 0.2),\n M6: specification('M6', 10, 4, 0.25),\n M8: specification('M8', 13, 5.3, 0.4),\n M10: specification('M10', 16, 6.4, 0.4),\n M12: specification('M12', 18, 7.5, 0.6),\n} as const;\n\nexport function hexHead(spec: Specification) {\n validateHead(spec);\n positive('Head width', spec.headWidth);\n if (Math.abs(spec.headDiameter - (2 * spec.headWidth) / Math.sqrt(3)) > 1e-6)\n throw new Error('Hex head diameter must describe its corner envelope.');\n const radius = spec.headWidth / Math.sqrt(3);\n const blank = regularPrism(radius, spec.headHeight, 6, 30);\n // The cone produces the circular crown and six curved chamfer boundaries.\n const chamferEnvelope = frustum(\n spec.headWidth / 2 + spec.headHeight * Math.sqrt(3),\n spec.headWidth / 2,\n spec.headHeight,\n );\n return intersect([blank, chamferEnvelope]);\n}\n"],
5
+ "mappings": ";;;;;;;;AAAA,SAAQ,SAAS,WAAW,oBAAmB;AAa/C,SAAS,cACP,MACA,WACA,YACA,iBACe;AACf,SAAO;AAAA,IACL,GAAG,OAAO,IAAI;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAe,IAAI,YAAa,KAAK,KAAK,CAAC;AAAA,EAC7C;AACF;AAbS;AAeF,IAAM,iBAAiB;AAAA,EAC5B,IAAI,cAAc,MAAM,KAAK,GAAG,GAAG;AAAA,EACnC,IAAI,cAAc,MAAM,GAAG,KAAK,GAAG;AAAA,EACnC,IAAI,cAAc,MAAM,GAAG,KAAK,GAAG;AAAA,EACnC,IAAI,cAAc,MAAM,IAAI,GAAG,IAAI;AAAA,EACnC,IAAI,cAAc,MAAM,IAAI,KAAK,GAAG;AAAA,EACpC,KAAK,cAAc,OAAO,IAAI,KAAK,GAAG;AAAA,EACtC,KAAK,cAAc,OAAO,IAAI,KAAK,GAAG;AACxC;AAEO,SAAS,QAAQ,MAAqB;AAC3C,eAAa,IAAI;AACjB,WAAS,cAAc,KAAK,SAAS;AACrC,MAAI,KAAK,IAAI,KAAK,eAAgB,IAAI,KAAK,YAAa,KAAK,KAAK,CAAC,CAAC,IAAI;AACtE,UAAM,IAAI,MAAM,sDAAsD;AACxE,QAAM,SAAS,KAAK,YAAY,KAAK,KAAK,CAAC;AAC3C,QAAM,QAAQ,aAAa,QAAQ,KAAK,YAAY,GAAG,EAAE;AAEzD,QAAM,kBAAkB;AAAA,IACtB,KAAK,YAAY,IAAI,KAAK,aAAa,KAAK,KAAK,CAAC;AAAA,IAClD,KAAK,YAAY;AAAA,IACjB,KAAK;AAAA,EACP;AACA,SAAO,UAAU,CAAC,OAAO,eAAe,CAAC;AAC3C;AAdgB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,23 @@
1
+ import {
2
+ clearanceHole,
3
+ resolveSpecification,
4
+ screw,
5
+ specifications
6
+ } from "./chunk-VVX3WOBG.js";
7
+ import {
8
+ __export
9
+ } from "./chunk-Z5LEGL77.js";
10
+
11
+ // packages/screws/src/library/gb-5281.ts
12
+ var gb_5281_exports = {};
13
+ __export(gb_5281_exports, {
14
+ clearanceHole: () => clearanceHole,
15
+ resolveSpecification: () => resolveSpecification,
16
+ screw: () => screw,
17
+ specifications: () => specifications
18
+ });
19
+
20
+ export {
21
+ gb_5281_exports
22
+ };
23
+ //# sourceMappingURL=chunk-HPPYZYCK.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/library/gb-5281.ts"],
4
+ "sourcesContent": ["/**\n * GB/T 5281-1985 (EQV ISO 7379:1983).\n * Shares the corresponding ISO module's nominal geometry within our preset\n * range. See the package README for sizes, hole allowances and modeling limits.\n * https://std.samr.gov.cn/gb/search/gbDetailed?id=71F772D7AF1AD3A7E05397BE0A0AB82A\n */\nexport * from './iso-7379.js';\n"],
5
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,121 @@
1
+ import {
2
+ __export,
3
+ __name,
4
+ atY,
5
+ headedScrew,
6
+ hexSocket,
7
+ metric,
8
+ plainHole,
9
+ positive,
10
+ validateHead
11
+ } from "./chunk-Z5LEGL77.js";
12
+
13
+ // packages/screws/src/library/iso-10642.ts
14
+ var iso_10642_exports = {};
15
+ __export(iso_10642_exports, {
16
+ clearanceHole: () => clearanceHole,
17
+ resolveSpecification: () => resolveSpecification,
18
+ screw: () => screw,
19
+ specifications: () => specifications,
20
+ threadLength: () => threadLength
21
+ });
22
+ import { frustum, union } from "@code3d/core";
23
+ function specification(size, headDiameter, headHeight, hexSocketWidth, hexSocketDepth, underHeadRadius) {
24
+ return {
25
+ ...metric(size),
26
+ headDiameter,
27
+ headHeight,
28
+ hexSocketWidth,
29
+ hexSocketDepth,
30
+ underHeadRadius,
31
+ headAngle: 90
32
+ };
33
+ }
34
+ __name(specification, "specification");
35
+ var specifications = {
36
+ M3: specification("M3", 6.72, 1.86, 2, 1.1, 0.1),
37
+ M4: specification("M4", 8.96, 2.48, 2.5, 1.5, 0.2),
38
+ M5: specification("M5", 11.2, 3.1, 3, 1.9, 0.2),
39
+ M6: specification("M6", 13.44, 3.72, 4, 2.2, 0.25),
40
+ M8: specification("M8", 17.92, 4.96, 5, 3, 0.4),
41
+ M10: specification("M10", 22.4, 6.2, 6, 3.6, 0.4),
42
+ M12: specification("M12", 26.88, 7.44, 8, 4.3, 0.6)
43
+ };
44
+ function resolveSpecification(input) {
45
+ return typeof input === "string" ? specifications[input] : input;
46
+ }
47
+ __name(resolveSpecification, "resolveSpecification");
48
+ function validateCountersink(spec) {
49
+ if (spec.headAngle !== 90 || Math.abs(spec.headDiameter - spec.nominalDiameter - 2 * spec.headHeight) > 1e-6)
50
+ throw new Error(
51
+ "Countersunk head dimensions must define a 90-degree cone."
52
+ );
53
+ }
54
+ __name(validateCountersink, "validateCountersink");
55
+ function threadLength(spec, length) {
56
+ return 2 * spec.nominalDiameter + (length <= 125 ? 6 : length <= 200 ? 12 : 25);
57
+ }
58
+ __name(threadLength, "threadLength");
59
+ function screw(input, length) {
60
+ const spec = resolveSpecification(input);
61
+ validateHead(spec);
62
+ validateCountersink(spec);
63
+ const blank = frustum(
64
+ spec.nominalDiameter / 2,
65
+ spec.headDiameter / 2,
66
+ spec.headHeight
67
+ );
68
+ const head = hexSocket(
69
+ blank,
70
+ spec.hexSocketWidth,
71
+ spec.hexSocketDepth,
72
+ spec.headHeight
73
+ );
74
+ return headedScrew(
75
+ head,
76
+ spec,
77
+ length - spec.headHeight,
78
+ threadLength(spec, length)
79
+ );
80
+ }
81
+ __name(screw, "screw");
82
+ function clearanceHole(input, optionsOrDepth) {
83
+ const spec = resolveSpecification(input);
84
+ const options = typeof optionsOrDepth === "number" ? { depth: optionsOrDepth } : optionsOrDepth;
85
+ validateCountersink(spec);
86
+ const shaft = plainHole(spec, options);
87
+ if (options.countersink === false) return shaft;
88
+ const sink = options.countersink === true || options.countersink === void 0 ? {} : options.countersink;
89
+ const diameter = sink.diameter ?? spec.headDiameter + 0.5;
90
+ const shaftDiameter = options.diameter ?? spec.clearance[options.fit ?? "normal"];
91
+ positive("Countersink diameter", diameter);
92
+ if (diameter < spec.headDiameter || diameter <= shaftDiameter)
93
+ throw new Error(
94
+ "Countersink must accommodate the screw head and exceed the shaft diameter."
95
+ );
96
+ const depth = (diameter - shaftDiameter) / (2 * Math.tan(spec.headAngle * Math.PI / 360));
97
+ if (!Number.isFinite(depth) || depth <= 0 || depth > options.depth)
98
+ throw new Error("Countersink depth must be within the total hole depth.");
99
+ const recess = atY(
100
+ frustum(shaftDiameter / 2, diameter / 2, depth),
101
+ (options.depth - depth) / 2
102
+ );
103
+ return union([shaft, recess]).expose({
104
+ shaftTop: shaft.shaftTop,
105
+ shaftBottom: shaft.shaftBottom,
106
+ shaftAxis: shaft.shaftAxis,
107
+ countersinkTop: recess.up,
108
+ countersinkBottom: recess.down
109
+ });
110
+ }
111
+ __name(clearanceHole, "clearanceHole");
112
+
113
+ export {
114
+ specifications,
115
+ resolveSpecification,
116
+ threadLength,
117
+ screw,
118
+ clearanceHole,
119
+ iso_10642_exports
120
+ };
121
+ //# sourceMappingURL=chunk-IXFHRZSY.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/library/iso-10642.ts"],
4
+ "sourcesContent": ["import {frustum, union, type SolidModel} from '@code3d/core';\nimport {\n metric,\n validateHead,\n headedScrew,\n hexSocket,\n plainHole,\n atY,\n positive,\n type MetricSize,\n type HeadSpecification,\n type Screw,\n type ClearanceHole,\n type HoleElements,\n type ClearanceHoleOptions as CommonHoleOptions,\n} from './common.js';\nexport type {\n ClearanceFit,\n Screw,\n ScrewElements,\n ClearanceHole,\n HoleElements,\n} from './common.js';\nimport type {Bound} from '@code3d/core';\n\nexport type Specification = HeadSpecification &\n Readonly<{hexSocketWidth: number; hexSocketDepth: number; headAngle: 90}>;\n// ISO 10642 dimensions (not the smaller DIN 7991 head), millimetres.\n// https://www.vipafasteners.com/files/0/886-HEXAGON_SOCKET_COUNTERSUNK_HEAD_SCREWS_ISO_10642_UNI_5933_DIN_7991.pdf\nfunction specification(\n size: MetricSize,\n headDiameter: number,\n headHeight: number,\n hexSocketWidth: number,\n hexSocketDepth: number,\n underHeadRadius: number,\n): Specification {\n return {\n ...metric(size),\n headDiameter,\n headHeight,\n hexSocketWidth,\n hexSocketDepth,\n underHeadRadius,\n headAngle: 90,\n };\n}\nexport const specifications = {\n M3: specification('M3', 6.72, 1.86, 2, 1.1, 0.1),\n M4: specification('M4', 8.96, 2.48, 2.5, 1.5, 0.2),\n M5: specification('M5', 11.2, 3.1, 3, 1.9, 0.2),\n M6: specification('M6', 13.44, 3.72, 4, 2.2, 0.25),\n M8: specification('M8', 17.92, 4.96, 5, 3, 0.4),\n M10: specification('M10', 22.4, 6.2, 6, 3.6, 0.4),\n M12: specification('M12', 26.88, 7.44, 8, 4.3, 0.6),\n} as const;\nexport type Size = keyof typeof specifications;\nexport type ScrewInput = Size | Specification;\nexport type CountersinkOptions = Readonly<{diameter?: number}>;\nexport type ClearanceHoleOptions = Omit<CommonHoleOptions, 'counterbore'> &\n Readonly<{countersink?: boolean | CountersinkOptions}>;\nexport type PlainHoleOptions = ClearanceHoleOptions &\n Readonly<{countersink: false}>;\nexport type CountersunkHoleOptions = ClearanceHoleOptions &\n Readonly<{countersink?: true | CountersinkOptions}>;\nexport type CountersunkHoleElements = HoleElements &\n Readonly<{countersinkTop: Bound; countersinkBottom: Bound}>;\nexport type CountersunkHole = SolidModel<CountersunkHoleElements>;\n\nexport function resolveSpecification(input: ScrewInput): Specification {\n return typeof input === 'string' ? specifications[input] : input;\n}\nfunction validateCountersink(spec: Specification): void {\n if (\n spec.headAngle !== 90 ||\n Math.abs(spec.headDiameter - spec.nominalDiameter - 2 * spec.headHeight) >\n 1e-6\n )\n throw new Error(\n 'Countersunk head dimensions must define a 90-degree cone.',\n );\n}\nexport function threadLength(spec: Specification, length: number): number {\n return (\n 2 * spec.nominalDiameter + (length <= 125 ? 6 : length <= 200 ? 12 : 25)\n );\n}\n/**\n * Length includes the countersunk head.\n * @code3d.arguments ['M6', 20]\n * @code3d.param length {kind: 'length'}\n */\nexport function screw(input: ScrewInput, length: number): Screw {\n const spec = resolveSpecification(input);\n validateHead(spec);\n validateCountersink(spec);\n const blank = frustum(\n spec.nominalDiameter / 2,\n spec.headDiameter / 2,\n spec.headHeight,\n );\n const head = hexSocket(\n blank,\n spec.hexSocketWidth,\n spec.hexSocketDepth,\n spec.headHeight,\n );\n return headedScrew(\n head,\n spec,\n length - spec.headHeight,\n threadLength(spec, length),\n );\n}\n\n/** @code3d.arguments ['M6', 10] */\nexport function clearanceHole(\n input: ScrewInput,\n depth: number,\n): CountersunkHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: PlainHoleOptions,\n): ClearanceHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: CountersunkHoleOptions,\n): CountersunkHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: ClearanceHoleOptions,\n): ClearanceHole | CountersunkHole;\nexport function clearanceHole(\n input: ScrewInput,\n optionsOrDepth: number | ClearanceHoleOptions,\n): ClearanceHole | CountersunkHole {\n const spec = resolveSpecification(input);\n const options =\n typeof optionsOrDepth === 'number'\n ? {depth: optionsOrDepth}\n : optionsOrDepth;\n validateCountersink(spec);\n const shaft = plainHole(spec, options);\n if (options.countersink === false) return shaft;\n const sink =\n options.countersink === true || options.countersink === undefined\n ? {}\n : options.countersink;\n const diameter = sink.diameter ?? spec.headDiameter + 0.5;\n const shaftDiameter =\n options.diameter ?? spec.clearance[options.fit ?? 'normal'];\n positive('Countersink diameter', diameter);\n if (diameter < spec.headDiameter || diameter <= shaftDiameter)\n throw new Error(\n 'Countersink must accommodate the screw head and exceed the shaft diameter.',\n );\n const depth =\n (diameter - shaftDiameter) /\n (2 * Math.tan((spec.headAngle * Math.PI) / 360));\n if (!Number.isFinite(depth) || depth <= 0 || depth > options.depth)\n throw new Error('Countersink depth must be within the total hole depth.');\n const recess = atY(\n frustum(shaftDiameter / 2, diameter / 2, depth),\n (options.depth - depth) / 2,\n );\n return union([shaft, recess]).expose({\n shaftTop: shaft.shaftTop,\n shaftBottom: shaft.shaftBottom,\n shaftAxis: shaft.shaftAxis,\n countersinkTop: recess.up,\n countersinkBottom: recess.down,\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAQ,SAAS,aAA6B;AA6B9C,SAAS,cACP,MACA,cACA,YACA,gBACA,gBACA,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 clearanceHole,
5
+ headedScrew,
6
+ hexSocket,
7
+ metric,
8
+ validateHead
9
+ } from "./chunk-Z5LEGL77.js";
10
+
11
+ // packages/screws/src/library/iso-4762.ts
12
+ var iso_4762_exports = {};
13
+ __export(iso_4762_exports, {
14
+ clearanceHole: () => clearanceHole2,
15
+ resolveSpecification: () => resolveSpecification,
16
+ screw: () => screw,
17
+ specifications: () => specifications,
18
+ threadLength: () => threadLength
19
+ });
20
+ import { cylinder, frustum, union } from "@code3d/core";
21
+ function specification(size, headDiameter, headHeight, hexSocketWidth, hexSocketDepth, underHeadRadius, counterboreDiameter) {
22
+ return {
23
+ ...metric(size),
24
+ headDiameter,
25
+ headHeight,
26
+ hexSocketWidth,
27
+ hexSocketDepth,
28
+ underHeadRadius,
29
+ counterboreDiameter
30
+ };
31
+ }
32
+ __name(specification, "specification");
33
+ var specifications = {
34
+ M3: specification("M3", 5.5, 3, 2.5, 1.3, 0.1, 6),
35
+ M4: specification("M4", 7, 4, 3, 2, 0.2, 8),
36
+ M5: specification("M5", 8.5, 5, 4, 2.5, 0.2, 10),
37
+ M6: specification("M6", 10, 6, 5, 3, 0.25, 11),
38
+ M8: specification("M8", 13, 8, 6, 4, 0.4, 15),
39
+ M10: specification("M10", 16, 10, 8, 5, 0.4, 18),
40
+ M12: specification("M12", 18, 12, 10, 6, 0.6, 20)
41
+ };
42
+ function screw(input, length) {
43
+ const spec = resolveSpecification(input);
44
+ validateHead(spec);
45
+ const headChamfer = Math.min(spec.pitch / 2, spec.headHeight * 0.12);
46
+ const barrel = cylinder(spec.headDiameter / 2, spec.headHeight - headChamfer);
47
+ const crown = frustum(
48
+ spec.headDiameter / 2,
49
+ spec.headDiameter / 2 - headChamfer,
50
+ headChamfer
51
+ ).relate((part) => part.on(barrel.up));
52
+ const head = hexSocket(
53
+ union([barrel, crown]),
54
+ spec.hexSocketWidth,
55
+ spec.hexSocketDepth,
56
+ spec.headHeight
57
+ );
58
+ return headedScrew(head, spec, length, threadLength(spec, length));
59
+ }
60
+ __name(screw, "screw");
61
+ function clearanceHole2(input, optionsOrDepth) {
62
+ return clearanceHole(resolveSpecification(input), optionsOrDepth, true);
63
+ }
64
+ __name(clearanceHole2, "clearanceHole");
65
+ function resolveSpecification(input) {
66
+ return typeof input === "string" ? specifications[input] : input;
67
+ }
68
+ __name(resolveSpecification, "resolveSpecification");
69
+ function threadLength(spec, length) {
70
+ if (length <= 125) return 2 * spec.nominalDiameter + 12;
71
+ if (length <= 200) return 2 * spec.nominalDiameter + 18;
72
+ return 2 * spec.nominalDiameter + 31;
73
+ }
74
+ __name(threadLength, "threadLength");
75
+
76
+ export {
77
+ specifications,
78
+ screw,
79
+ clearanceHole2 as clearanceHole,
80
+ resolveSpecification,
81
+ threadLength,
82
+ iso_4762_exports
83
+ };
84
+ //# sourceMappingURL=chunk-MEIKYZ23.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/library/iso-4762.ts"],
4
+ "sourcesContent": ["import {cylinder, frustum, union} from '@code3d/core';\nimport {\n metric,\n headedScrew,\n validateHead,\n hexSocket,\n clearanceHole as buildClearanceHole,\n type MetricSize,\n type HeadSpecification,\n type Screw,\n type ClearanceHole,\n type CounterboredHole,\n type ClearanceHoleOptions,\n type CounterboreOptions,\n} from './common.js';\nexport type {\n ClearanceFit,\n ClearanceHoleOptions,\n CounterboreOptions,\n Screw,\n ClearanceHole,\n CounterboredHole,\n ScrewElements as SocketCapScrewElements,\n HoleElements as SocketCapHoleElements,\n CounterboredHoleElements as CounterboredSocketCapHoleElements,\n} from './common.js';\n\nexport type Specification = HeadSpecification &\n Readonly<{\n hexSocketWidth: number;\n hexSocketDepth: number;\n counterboreDiameter: number;\n }>;\n\n// ISO 4762 coarse-thread socket-head cap screws; millimetres.\n// Clearance series follow ISO 273. Counterbores follow DIN 974-1 normal series.\nfunction specification(\n size: MetricSize,\n headDiameter: number,\n headHeight: number,\n hexSocketWidth: number,\n hexSocketDepth: number,\n underHeadRadius: number,\n counterboreDiameter: number,\n): Specification {\n return {\n ...metric(size),\n headDiameter,\n headHeight,\n hexSocketWidth,\n hexSocketDepth,\n underHeadRadius,\n counterboreDiameter,\n };\n}\nexport const specifications = {\n M3: specification('M3', 5.5, 3, 2.5, 1.3, 0.1, 6),\n M4: specification('M4', 7, 4, 3, 2, 0.2, 8),\n M5: specification('M5', 8.5, 5, 4, 2.5, 0.2, 10),\n M6: specification('M6', 10, 6, 5, 3, 0.25, 11),\n M8: specification('M8', 13, 8, 6, 4, 0.4, 15),\n M10: specification('M10', 16, 10, 8, 5, 0.4, 18),\n M12: specification('M12', 18, 12, 10, 6, 0.6, 20),\n} as const;\n\nexport type Size = keyof typeof specifications;\nexport type ScrewInput = Size | Specification;\n\nexport type PlainClearanceHoleOptions = ClearanceHoleOptions &\n Readonly<{\n counterbore: false;\n }>;\n\nexport type CounterboredHoleOptions = Omit<\n ClearanceHoleOptions,\n 'counterbore'\n> &\n Readonly<{\n counterbore?: true | CounterboreOptions;\n }>;\n\n/**\n * @code3d.arguments ['M6', 18]\n * @code3d.arguments ['M8', 30]\n * @code3d.param length {kind: 'length'}\n */\nexport function screw(input: ScrewInput, length: number): Screw {\n const spec = resolveSpecification(input);\n validateHead(spec);\n const headChamfer = Math.min(spec.pitch / 2, spec.headHeight * 0.12);\n const barrel = cylinder(spec.headDiameter / 2, spec.headHeight - headChamfer);\n const crown = frustum(\n spec.headDiameter / 2,\n spec.headDiameter / 2 - headChamfer,\n headChamfer,\n ).relate(part => part.on(barrel.up));\n const head = hexSocket(\n union([barrel, crown]),\n spec.hexSocketWidth,\n spec.hexSocketDepth,\n spec.headHeight,\n );\n return headedScrew(head, spec, length, threadLength(spec, length));\n}\n\n/**\n * @code3d.arguments ['M6', 10]\n * @code3d.arguments ['M6', {depth: 10, counterbore: false}]\n * @code3d.param depth {kind: 'length', constraints: {exclusiveMin: 0}}\n */\nexport function clearanceHole(\n input: ScrewInput,\n depth: number,\n): CounterboredHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: PlainClearanceHoleOptions,\n): ClearanceHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: CounterboredHoleOptions,\n): CounterboredHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: ClearanceHoleOptions,\n): ClearanceHole | CounterboredHole;\nexport function clearanceHole(\n input: ScrewInput,\n optionsOrDepth: ClearanceHoleOptions | number,\n): ClearanceHole | CounterboredHole {\n return buildClearanceHole(resolveSpecification(input), optionsOrDepth, true);\n}\n\nexport function resolveSpecification(input: ScrewInput): Specification {\n return typeof input === 'string' ? specifications[input] : input;\n}\n\nexport function threadLength(spec: Specification, length: number): number {\n if (length <= 125) return 2 * spec.nominalDiameter + 12;\n if (length <= 200) return 2 * spec.nominalDiameter + 18;\n return 2 * spec.nominalDiameter + 31;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,uBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAQ,UAAU,SAAS,aAAY;AAoCvC,SAAS,cACP,MACA,cACA,YACA,gBACA,gBACA,iBACA,qBACe;AACf,SAAO;AAAA,IACL,GAAG,OAAO,IAAI;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAlBS;AAmBF,IAAM,iBAAiB;AAAA,EAC5B,IAAI,cAAc,MAAM,KAAK,GAAG,KAAK,KAAK,KAAK,CAAC;AAAA,EAChD,IAAI,cAAc,MAAM,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC;AAAA,EAC1C,IAAI,cAAc,MAAM,KAAK,GAAG,GAAG,KAAK,KAAK,EAAE;AAAA,EAC/C,IAAI,cAAc,MAAM,IAAI,GAAG,GAAG,GAAG,MAAM,EAAE;AAAA,EAC7C,IAAI,cAAc,MAAM,IAAI,GAAG,GAAG,GAAG,KAAK,EAAE;AAAA,EAC5C,KAAK,cAAc,OAAO,IAAI,IAAI,GAAG,GAAG,KAAK,EAAE;AAAA,EAC/C,KAAK,cAAc,OAAO,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE;AAClD;AAuBO,SAAS,MAAM,OAAmB,QAAuB;AAC9D,QAAM,OAAO,qBAAqB,KAAK;AACvC,eAAa,IAAI;AACjB,QAAM,cAAc,KAAK,IAAI,KAAK,QAAQ,GAAG,KAAK,aAAa,IAAI;AACnE,QAAM,SAAS,SAAS,KAAK,eAAe,GAAG,KAAK,aAAa,WAAW;AAC5E,QAAM,QAAQ;AAAA,IACZ,KAAK,eAAe;AAAA,IACpB,KAAK,eAAe,IAAI;AAAA,IACxB;AAAA,EACF,EAAE,OAAO,UAAQ,KAAK,GAAG,OAAO,EAAE,CAAC;AACnC,QAAM,OAAO;AAAA,IACX,MAAM,CAAC,QAAQ,KAAK,CAAC;AAAA,IACrB,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AACA,SAAO,YAAY,MAAM,MAAM,QAAQ,aAAa,MAAM,MAAM,CAAC;AACnE;AAjBgB;AAwCT,SAASC,eACd,OACA,gBACkC;AAClC,SAAO,cAAmB,qBAAqB,KAAK,GAAG,gBAAgB,IAAI;AAC7E;AALgB,OAAAA,gBAAA;AAOT,SAAS,qBAAqB,OAAkC;AACrE,SAAO,OAAO,UAAU,WAAW,eAAe,KAAK,IAAI;AAC7D;AAFgB;AAIT,SAAS,aAAa,MAAqB,QAAwB;AACxE,MAAI,UAAU,IAAK,QAAO,IAAI,KAAK,kBAAkB;AACrD,MAAI,UAAU,IAAK,QAAO,IAAI,KAAK,kBAAkB;AACrD,SAAO,IAAI,KAAK,kBAAkB;AACpC;AAJgB;",
6
+ "names": ["clearanceHole", "clearanceHole"]
7
+ }
@@ -0,0 +1,84 @@
1
+ import {
2
+ __export,
3
+ __name,
4
+ atY,
5
+ externalThread,
6
+ hexSocket,
7
+ metric,
8
+ positive
9
+ } from "./chunk-Z5LEGL77.js";
10
+
11
+ // packages/screws/src/library/iso-4029.ts
12
+ var iso_4029_exports = {};
13
+ __export(iso_4029_exports, {
14
+ resolveSpecification: () => resolveSpecification,
15
+ screw: () => screw,
16
+ specifications: () => specifications
17
+ });
18
+ import {
19
+ cut,
20
+ frustum,
21
+ intersect
22
+ } from "@code3d/core";
23
+ import { definePrimitive, replicad } from "@code3d/core/replicad";
24
+ function specification(size, hexSocketWidth, hexSocketDepth, cupDiameter) {
25
+ return { ...metric(size), hexSocketWidth, hexSocketDepth, cupDiameter };
26
+ }
27
+ __name(specification, "specification");
28
+ var specifications = {
29
+ M3: specification("M3", 1.5, 1.2, 1.4),
30
+ M4: specification("M4", 2, 1.5, 2),
31
+ M5: specification("M5", 2.5, 2, 2.5),
32
+ M6: specification("M6", 3, 2, 3),
33
+ M8: specification("M8", 4, 3, 5),
34
+ M10: specification("M10", 5, 4, 6),
35
+ M12: specification("M12", 6, 4.8, 8)
36
+ };
37
+ function resolveSpecification(input) {
38
+ return typeof input === "string" ? specifications[input] : input;
39
+ }
40
+ __name(resolveSpecification, "resolveSpecification");
41
+ var cupTool = definePrimitive((radius, depth) => {
42
+ const profile = replicad.draw([0, 0]).lineTo([radius, 0]).lineTo([0, depth]).close();
43
+ return profile.sketchOnPlane("XZ").revolve([0, 0, 1]).rotate(-90, [0, 0, 0], [1, 0, 0]).translate([0, -depth / 2, 0]);
44
+ });
45
+ function screw(input, length) {
46
+ const spec = resolveSpecification(input);
47
+ positive("Screw length", length);
48
+ positive("Cup diameter", spec.cupDiameter);
49
+ if (spec.cupDiameter >= spec.nominalDiameter)
50
+ throw new Error("Cup diameter must be smaller than the nominal diameter.");
51
+ const cupRadius = spec.cupDiameter / 2;
52
+ const cupDepth = cupRadius / Math.sqrt(3);
53
+ if (length <= spec.hexSocketDepth + cupDepth + spec.pitch)
54
+ throw new Error(
55
+ "Screw length must separate the socket from the cup point."
56
+ );
57
+ const thread = externalThread(spec, length);
58
+ const outerPoint = frustum(cupRadius, cupRadius + length, length);
59
+ const blank = intersect([thread, outerPoint]);
60
+ const driven = hexSocket(
61
+ blank,
62
+ spec.hexSocketWidth,
63
+ spec.hexSocketDepth,
64
+ length
65
+ );
66
+ const cup = atY(
67
+ cupTool(cupRadius * 0.85, cupDepth),
68
+ -length / 2 + cupDepth / 2
69
+ );
70
+ return cut(driven, [cup]).expose({
71
+ driveTop: thread.up,
72
+ pointBottom: thread.down,
73
+ threadAxis: thread.axis
74
+ });
75
+ }
76
+ __name(screw, "screw");
77
+
78
+ export {
79
+ specifications,
80
+ resolveSpecification,
81
+ screw,
82
+ iso_4029_exports
83
+ };
84
+ //# sourceMappingURL=chunk-O34BMYJV.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/library/iso-4029.ts"],
4
+ "sourcesContent": ["import {\n cut,\n frustum,\n intersect,\n type Bound,\n type CanonicalElements,\n type LineAnchor,\n type SolidModel,\n} from '@code3d/core';\nimport {definePrimitive, replicad, type Sketch} from '@code3d/core/replicad';\nimport {\n metric,\n externalThread,\n hexSocket,\n atY,\n positive,\n type MetricSize,\n type MetricSpecification,\n} from './common.js';\n\nexport type Specification = MetricSpecification &\n Readonly<{\n hexSocketWidth: number;\n hexSocketDepth: number;\n cupDiameter: number;\n }>;\n// ISO 4029 cup-point set screws, nominal driving width and minimum socket depth.\n// https://www.jcfasteners.com/wp-content/uploads/DIN-916-Grub-Screw-Cup-PT-B4A07-SS304.pdf\nfunction specification(\n size: MetricSize,\n hexSocketWidth: number,\n hexSocketDepth: number,\n cupDiameter: number,\n): Specification {\n return {...metric(size), hexSocketWidth, hexSocketDepth, cupDiameter};\n}\nexport const specifications = {\n M3: specification('M3', 1.5, 1.2, 1.4),\n M4: specification('M4', 2, 1.5, 2),\n M5: specification('M5', 2.5, 2, 2.5),\n M6: specification('M6', 3, 2, 3),\n M8: specification('M8', 4, 3, 5),\n M10: specification('M10', 5, 4, 6),\n M12: specification('M12', 6, 4.8, 8),\n} as const;\nexport type Size = keyof typeof specifications;\nexport type ScrewInput = Size | Specification;\nexport type ScrewElements = CanonicalElements &\n Readonly<{driveTop: Bound; pointBottom: Bound; threadAxis: LineAnchor}>;\nexport type Screw = SolidModel<ScrewElements>;\nexport function resolveSpecification(input: ScrewInput): Specification {\n return typeof input === 'string' ? specifications[input] : input;\n}\nconst cupTool = definePrimitive((radius: number, depth: number) => {\n const profile = replicad\n .draw([0, 0])\n .lineTo([radius, 0])\n .lineTo([0, depth])\n .close();\n return (profile.sketchOnPlane('XZ') as Sketch)\n .revolve([0, 0, 1])\n .rotate(-90, [0, 0, 0], [1, 0, 0])\n .translate([0, -depth / 2, 0]);\n});\n/**\n * Length is the complete headless screw, including its cup point.\n * @code3d.arguments ['M6', 10]\n * @code3d.param length {kind: 'length'}\n */\nexport function screw(input: ScrewInput, length: number): Screw {\n const spec = resolveSpecification(input);\n positive('Screw length', length);\n positive('Cup diameter', spec.cupDiameter);\n if (spec.cupDiameter >= spec.nominalDiameter)\n throw new Error('Cup diameter must be smaller than the nominal diameter.');\n const cupRadius = spec.cupDiameter / 2;\n const cupDepth = cupRadius / Math.sqrt(3);\n if (length <= spec.hexSocketDepth + cupDepth + spec.pitch)\n throw new Error(\n 'Screw length must separate the socket from the cup point.',\n );\n const thread = externalThread(spec, length);\n const outerPoint = frustum(cupRadius, cupRadius + length, length);\n const blank = intersect([thread, outerPoint]);\n const driven = hexSocket(\n blank,\n spec.hexSocketWidth,\n spec.hexSocketDepth,\n length,\n );\n // A narrow annular lip remains at the end of the external point chamfer.\n const cup = atY(\n cupTool(cupRadius * 0.85, cupDepth),\n -length / 2 + cupDepth / 2,\n );\n return cut(driven, [cup]).expose({\n driveTop: thread.up,\n pointBottom: thread.down,\n threadAxis: thread.axis,\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP,SAAQ,iBAAiB,gBAA4B;AAmBrD,SAAS,cACP,MACA,gBACA,gBACA,aACe;AACf,SAAO,E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AK;AAClD,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACF,QAAM,SAAS,eAAe,MAAM,MAAM;AAC1C,QAAM,aAAa,QAAQ,WAAW,YAAY,QAAQ,MAAM;AAChE,QAAM,QAAQ,UAAU,CAAC,QAAQ,UAAU,CAAC;AAC5C,QAAM,SAAS;AAAA,IACb;AAAA,IACA,KAAK;AAAA,IACL,KAAK;AAAA,IACL;AAAA,EACF;AAEA,QAAM,MAAM;AAAA,IACV,QAAQ,YAAY,MAAM,QAAQ;AAAA,IAClC,CAAC,SAAS,IAAI,WAAW;AAAA,EAC3B;AACA,SAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO;AAAA,IAC/B,UAAU,OAAO;AAAA,IACjB,aAAa,OAAO;AAAA,IACpB,YAAY,OAAO;AAAA,EACrB,CAAC;AACH;AA/BgB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,46 @@
1
+ import {
2
+ hexHead,
3
+ specifications
4
+ } from "./chunk-GIIOR3XJ.js";
5
+ import {
6
+ __export,
7
+ __name,
8
+ clearanceHole,
9
+ headedScrew
10
+ } from "./chunk-Z5LEGL77.js";
11
+
12
+ // packages/screws/src/library/iso-4017.ts
13
+ var iso_4017_exports = {};
14
+ __export(iso_4017_exports, {
15
+ clearanceHole: () => clearanceHole2,
16
+ resolveSpecification: () => resolveSpecification,
17
+ screw: () => screw,
18
+ specifications: () => specifications,
19
+ threadLength: () => threadLength
20
+ });
21
+ function resolveSpecification(input) {
22
+ return typeof input === "string" ? specifications[input] : input;
23
+ }
24
+ __name(resolveSpecification, "resolveSpecification");
25
+ function threadLength(spec, length) {
26
+ return length;
27
+ }
28
+ __name(threadLength, "threadLength");
29
+ function screw(input, length) {
30
+ const spec = resolveSpecification(input);
31
+ return headedScrew(hexHead(spec), spec, length, threadLength(spec, length));
32
+ }
33
+ __name(screw, "screw");
34
+ function clearanceHole2(input, options) {
35
+ return clearanceHole(resolveSpecification(input), options);
36
+ }
37
+ __name(clearanceHole2, "clearanceHole");
38
+
39
+ export {
40
+ resolveSpecification,
41
+ threadLength,
42
+ screw,
43
+ clearanceHole2 as clearanceHole,
44
+ iso_4017_exports
45
+ };
46
+ //# sourceMappingURL=chunk-P3M5KQ5U.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/library/iso-4017.ts"],
4
+ "sourcesContent": ["import {\n headedScrew,\n clearanceHole as buildClearanceHole,\n type Screw,\n type ClearanceHole,\n type CounterboredHole,\n type ClearanceHoleOptions,\n type PlainHoleOptions,\n type CounterboredHoleOptions,\n} from './common.js';\nimport {hexHead, specifications, type Specification} from './hex-head.js';\nexport {specifications};\nexport type {Specification};\nexport type {\n ClearanceFit,\n Screw,\n ScrewElements,\n ClearanceHole,\n HoleElements,\n CounterboredHole,\n CounterboredHoleElements,\n ClearanceHoleOptions,\n PlainHoleOptions,\n CounterboredHoleOptions,\n CounterboreOptions,\n} from './common.js';\nexport type Size = keyof typeof specifications;\nexport type ScrewInput = Size | Specification;\nexport function resolveSpecification(input: ScrewInput): Specification {\n return typeof input === 'string' ? specifications[input] : input;\n}\nexport function threadLength(spec: Specification, length: number): number {\n return length;\n}\n/**\n * @code3d.arguments ['M6', 30]\n * @code3d.param length {kind: 'length'}\n */\nexport function screw(input: ScrewInput, length: number): Screw {\n const spec = resolveSpecification(input);\n return headedScrew(hexHead(spec), spec, length, threadLength(spec, length));\n}\n/** @code3d.arguments ['M6', 10] */\nexport function clearanceHole(input: ScrewInput, depth: number): ClearanceHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: PlainHoleOptions,\n): ClearanceHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: CounterboredHoleOptions,\n): CounterboredHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: ClearanceHoleOptions,\n): ClearanceHole | CounterboredHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: number | ClearanceHoleOptions,\n): ClearanceHole | CounterboredHole {\n return buildClearanceHole(resolveSpecification(input), options);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA,uBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AA4BO,SAAS,qBAAqB,OAAkC;AACrE,SAAO,OAAO,UAAU,WAAW,eAAe,KAAK,IAAI;AAC7D;AAFgB;AAGT,SAAS,aAAa,MAAqB,QAAwB;AACxE,SAAO;AACT;AAFgB;AAOT,SAAS,MAAM,OAAmB,QAAuB;AAC9D,QAAM,OAAO,qBAAqB,KAAK;AACvC,SAAO,YAAY,QAAQ,IAAI,GAAG,MAAM,QAAQ,aAAa,MAAM,MAAM,CAAC;AAC5E;AAHgB;AAkBT,SAASC,eACd,OACA,SACkC;AAClC,SAAO,cAAmB,qBAAqB,KAAK,GAAG,OAAO;AAChE;AALgB,OAAAA,gBAAA;",
6
+ "names": ["clearanceHole", "clearanceHole"]
7
+ }
@@ -0,0 +1,25 @@
1
+ import {
2
+ clearanceHole,
3
+ resolveSpecification,
4
+ screw,
5
+ specifications,
6
+ threadLength
7
+ } from "./chunk-MEIKYZ23.js";
8
+ import {
9
+ __export
10
+ } from "./chunk-Z5LEGL77.js";
11
+
12
+ // packages/screws/src/library/gb-70-1.ts
13
+ var gb_70_1_exports = {};
14
+ __export(gb_70_1_exports, {
15
+ clearanceHole: () => clearanceHole,
16
+ resolveSpecification: () => resolveSpecification,
17
+ screw: () => screw,
18
+ specifications: () => specifications,
19
+ threadLength: () => threadLength
20
+ });
21
+
22
+ export {
23
+ gb_70_1_exports
24
+ };
25
+ //# sourceMappingURL=chunk-PFFNLWWR.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/library/gb-70-1.ts"],
4
+ "sourcesContent": ["/**\n * GB/T 70.1-2008 (MOD ISO 4762:2004).\n * Shares the corresponding ISO module's nominal geometry within our preset\n * range. See the package README for sizes, hole allowances and modeling limits.\n * https://std.samr.gov.cn/gb/search/gbDetailed?id=71F772D7F825D3A7E05397BE0A0AB82A\n */\nexport * from './iso-4762.js';\n"],
5
+ "mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,46 @@
1
+ import {
2
+ hexHead,
3
+ specifications
4
+ } from "./chunk-GIIOR3XJ.js";
5
+ import {
6
+ __export,
7
+ __name,
8
+ clearanceHole,
9
+ headedScrew
10
+ } from "./chunk-Z5LEGL77.js";
11
+
12
+ // packages/screws/src/library/iso-4014.ts
13
+ var iso_4014_exports = {};
14
+ __export(iso_4014_exports, {
15
+ clearanceHole: () => clearanceHole2,
16
+ resolveSpecification: () => resolveSpecification,
17
+ screw: () => screw,
18
+ specifications: () => specifications,
19
+ threadLength: () => threadLength
20
+ });
21
+ function resolveSpecification(input) {
22
+ return typeof input === "string" ? specifications[input] : input;
23
+ }
24
+ __name(resolveSpecification, "resolveSpecification");
25
+ function threadLength(spec, length) {
26
+ return 2 * spec.nominalDiameter + (length <= 125 ? 6 : length <= 200 ? 12 : 25);
27
+ }
28
+ __name(threadLength, "threadLength");
29
+ function screw(input, length) {
30
+ const spec = resolveSpecification(input);
31
+ return headedScrew(hexHead(spec), spec, length, threadLength(spec, length));
32
+ }
33
+ __name(screw, "screw");
34
+ function clearanceHole2(input, options) {
35
+ return clearanceHole(resolveSpecification(input), options);
36
+ }
37
+ __name(clearanceHole2, "clearanceHole");
38
+
39
+ export {
40
+ resolveSpecification,
41
+ threadLength,
42
+ screw,
43
+ clearanceHole2 as clearanceHole,
44
+ iso_4014_exports
45
+ };
46
+ //# sourceMappingURL=chunk-SDUJLXOE.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/library/iso-4014.ts"],
4
+ "sourcesContent": ["import {\n headedScrew,\n clearanceHole as buildClearanceHole,\n type Screw,\n type ClearanceHole,\n type CounterboredHole,\n type ClearanceHoleOptions,\n type PlainHoleOptions,\n type CounterboredHoleOptions,\n} from './common.js';\nimport {hexHead, specifications, type Specification} from './hex-head.js';\nexport {specifications};\nexport type {Specification};\nexport type {\n ClearanceFit,\n Screw,\n ScrewElements,\n ClearanceHole,\n HoleElements,\n CounterboredHole,\n CounterboredHoleElements,\n ClearanceHoleOptions,\n PlainHoleOptions,\n CounterboredHoleOptions,\n CounterboreOptions,\n} from './common.js';\nexport type Size = keyof typeof specifications;\nexport type ScrewInput = Size | Specification;\nexport function resolveSpecification(input: ScrewInput): Specification {\n return typeof input === 'string' ? specifications[input] : input;\n}\nexport function threadLength(spec: Specification, length: number): number {\n return (\n 2 * spec.nominalDiameter + (length <= 125 ? 6 : length <= 200 ? 12 : 25)\n );\n}\n/**\n * @code3d.arguments ['M6', 30]\n * @code3d.param length {kind: 'length'}\n */\nexport function screw(input: ScrewInput, length: number): Screw {\n const spec = resolveSpecification(input);\n return headedScrew(hexHead(spec), spec, length, threadLength(spec, length));\n}\n/** @code3d.arguments ['M6', 10] */\nexport function clearanceHole(input: ScrewInput, depth: number): ClearanceHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: PlainHoleOptions,\n): ClearanceHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: CounterboredHoleOptions,\n): CounterboredHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: ClearanceHoleOptions,\n): ClearanceHole | CounterboredHole;\nexport function clearanceHole(\n input: ScrewInput,\n options: number | ClearanceHoleOptions,\n): ClearanceHole | CounterboredHole {\n return buildClearanceHole(resolveSpecification(input), options);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA,uBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AA4BO,SAAS,qBAAqB,OAAkC;AACrE,SAAO,OAAO,UAAU,WAAW,eAAe,KAAK,IAAI;AAC7D;AAFgB;AAGT,SAAS,aAAa,MAAqB,QAAwB;AACxE,SACE,IAAI,KAAK,mBAAmB,UAAU,MAAM,IAAI,UAAU,MAAM,KAAK;AAEzE;AAJgB;AAST,SAAS,MAAM,OAAmB,QAAuB;AAC9D,QAAM,OAAO,qBAAqB,KAAK;AACvC,SAAO,YAAY,QAAQ,IAAI,GAAG,MAAM,QAAQ,aAAa,MAAM,MAAM,CAAC;AAC5E;AAHgB;AAkBT,SAASC,eACd,OACA,SACkC;AAClC,SAAO,cAAmB,qBAAqB,KAAK,GAAG,OAAO;AAChE;AALgB,OAAAA,gBAAA;",
6
+ "names": ["clearanceHole", "clearanceHole"]
7
+ }
@@ -0,0 +1,25 @@
1
+ import {
2
+ clearanceHole,
3
+ resolveSpecification,
4
+ screw,
5
+ specifications,
6
+ threadLength
7
+ } from "./chunk-SGDNOA44.js";
8
+ import {
9
+ __export
10
+ } from "./chunk-Z5LEGL77.js";
11
+
12
+ // packages/screws/src/library/gb-70-4.ts
13
+ var gb_70_4_exports = {};
14
+ __export(gb_70_4_exports, {
15
+ clearanceHole: () => clearanceHole,
16
+ resolveSpecification: () => resolveSpecification,
17
+ screw: () => screw,
18
+ specifications: () => specifications,
19
+ threadLength: () => threadLength
20
+ });
21
+
22
+ export {
23
+ gb_70_4_exports
24
+ };
25
+ //# sourceMappingURL=chunk-SDYJF2XK.js.map