@bitbybit-dev/base 1.5.0 → 1.6.0-rc.0

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 (312) hide show
  1. package/lib/api/GlobalCDNProvider.js +1 -1
  2. package/lib/api/bearings/ansi-bearings.constants.d.ts +2 -0
  3. package/lib/api/bearings/ansi-bearings.constants.js +26 -0
  4. package/lib/api/bearings/ansi-bearings.d.ts +4 -0
  5. package/lib/api/bearings/ansi-bearings.js +14 -0
  6. package/lib/api/bearings/bearing-types.d.ts +25 -0
  7. package/lib/api/bearings/bearing-types.js +1 -0
  8. package/lib/api/bearings/bearings.constants.d.ts +1 -0
  9. package/lib/api/bearings/bearings.constants.js +1 -0
  10. package/lib/api/bearings/iso-bearings.constants.d.ts +2 -0
  11. package/lib/api/bearings/iso-bearings.constants.js +30 -0
  12. package/lib/api/bearings/iso-bearings.d.ts +4 -0
  13. package/lib/api/bearings/iso-bearings.js +14 -0
  14. package/lib/api/color-space.d.ts +2 -0
  15. package/lib/api/color-space.js +5 -8
  16. package/lib/api/fasteners/ansi-fasteners.constants.d.ts +16 -0
  17. package/lib/api/fasteners/ansi-fasteners.constants.js +118 -0
  18. package/lib/api/fasteners/ansi-fasteners.d.ts +8 -0
  19. package/lib/api/fasteners/ansi-fasteners.js +64 -0
  20. package/lib/api/fasteners/fastener-types.d.ts +161 -0
  21. package/lib/api/fasteners/fastener-types.js +1 -0
  22. package/lib/api/fasteners/fasteners.constants.d.ts +5 -0
  23. package/lib/api/fasteners/fasteners.constants.js +5 -0
  24. package/lib/api/fasteners/fasteners.d.ts +2 -0
  25. package/lib/api/fasteners/fasteners.js +9 -0
  26. package/lib/api/fasteners/iso-fasteners.constants.d.ts +23 -0
  27. package/lib/api/fasteners/iso-fasteners.constants.js +110 -0
  28. package/lib/api/fasteners/iso-fasteners.d.ts +9 -0
  29. package/lib/api/fasteners/iso-fasteners.js +61 -0
  30. package/lib/api/gears/bevel-gears.d.ts +6 -0
  31. package/lib/api/gears/bevel-gears.js +69 -0
  32. package/lib/api/gears/gear-checks.d.ts +8 -0
  33. package/lib/api/gears/gear-checks.js +69 -0
  34. package/lib/api/gears/gear-pairs.d.ts +4 -0
  35. package/lib/api/gears/gear-pairs.js +140 -0
  36. package/lib/api/gears/gear-types.d.ts +425 -0
  37. package/lib/api/gears/gear-types.js +1 -0
  38. package/lib/api/gears/gears.constants.d.ts +19 -0
  39. package/lib/api/gears/gears.constants.js +19 -0
  40. package/lib/api/gears/gears.d.ts +10 -0
  41. package/lib/api/gears/gears.js +156 -0
  42. package/lib/api/gears/helical-gears.d.ts +5 -0
  43. package/lib/api/gears/helical-gears.js +33 -0
  44. package/lib/api/gears/involute-flank.d.ts +26 -0
  45. package/lib/api/gears/involute-flank.js +158 -0
  46. package/lib/api/gears/racks.d.ts +3 -0
  47. package/lib/api/gears/racks.js +64 -0
  48. package/lib/api/index.d.ts +10 -1
  49. package/lib/api/index.js +0 -1
  50. package/lib/api/inputs/base-inputs.d.ts +450 -3
  51. package/lib/api/inputs/base-inputs.js +12 -0
  52. package/lib/api/inputs/color-inputs.d.ts +14 -0
  53. package/lib/api/inputs/color-inputs.js +19 -0
  54. package/lib/api/inputs/engineering-inputs.d.ts +1539 -0
  55. package/lib/api/inputs/engineering-inputs.js +2181 -0
  56. package/lib/api/inputs/index.d.ts +2 -0
  57. package/lib/api/inputs/index.js +2 -0
  58. package/lib/api/inputs/io-inputs.d.ts +8 -1
  59. package/lib/api/inputs/io-inputs.js +4 -1
  60. package/lib/api/inputs/math-inputs.d.ts +61 -0
  61. package/lib/api/inputs/math-inputs.js +85 -0
  62. package/lib/api/inputs/mesh-inputs.d.ts +170 -0
  63. package/lib/api/inputs/mesh-inputs.js +206 -0
  64. package/lib/api/inputs/point-inputs.d.ts +4 -4
  65. package/lib/api/inputs/polyline-inputs.d.ts +144 -0
  66. package/lib/api/inputs/polyline-inputs.js +151 -0
  67. package/lib/api/inputs/recipes-inputs.d.ts +76 -0
  68. package/lib/api/inputs/recipes-inputs.js +74 -0
  69. package/lib/api/inputs/transforms-inputs.d.ts +34 -0
  70. package/lib/api/inputs/transforms-inputs.js +35 -0
  71. package/lib/api/keys/ansi-keys.constants.d.ts +3 -0
  72. package/lib/api/keys/ansi-keys.constants.js +16 -0
  73. package/lib/api/keys/ansi-keys.d.ts +3 -0
  74. package/lib/api/keys/ansi-keys.js +14 -0
  75. package/lib/api/keys/din-keys.constants.d.ts +3 -0
  76. package/lib/api/keys/din-keys.constants.js +14 -0
  77. package/lib/api/keys/din-keys.d.ts +3 -0
  78. package/lib/api/keys/din-keys.js +13 -0
  79. package/lib/api/keys/key-types.d.ts +17 -0
  80. package/lib/api/keys/key-types.js +1 -0
  81. package/lib/api/keys/keys.constants.d.ts +1 -0
  82. package/lib/api/keys/keys.constants.js +1 -0
  83. package/lib/api/knurls/ansi-knurls.constants.d.ts +4 -0
  84. package/lib/api/knurls/ansi-knurls.constants.js +8 -0
  85. package/lib/api/knurls/ansi-knurls.d.ts +3 -0
  86. package/lib/api/knurls/ansi-knurls.js +20 -0
  87. package/lib/api/knurls/din-knurls.constants.d.ts +2 -0
  88. package/lib/api/knurls/din-knurls.constants.js +2 -0
  89. package/lib/api/knurls/din-knurls.d.ts +3 -0
  90. package/lib/api/knurls/din-knurls.js +19 -0
  91. package/lib/api/knurls/knurl-types.d.ts +24 -0
  92. package/lib/api/knurls/knurl-types.js +1 -0
  93. package/lib/api/knurls/knurls.constants.d.ts +1 -0
  94. package/lib/api/knurls/knurls.constants.js +1 -0
  95. package/lib/api/knurls/knurls.d.ts +2 -0
  96. package/lib/api/knurls/knurls.js +9 -0
  97. package/lib/api/recipes/checks.d.ts +15 -0
  98. package/lib/api/recipes/checks.js +85 -0
  99. package/lib/api/recipes/limits.constants.d.ts +4 -0
  100. package/lib/api/recipes/limits.constants.js +4 -0
  101. package/lib/api/recipes/sources.d.ts +0 -13
  102. package/lib/api/recipes/sources.js +3 -15
  103. package/lib/api/recipes/surface-mesh.d.ts +0 -14
  104. package/lib/api/recipes/surface-mesh.js +8 -21
  105. package/lib/api/recipes/validate-brep.d.ts +2 -0
  106. package/lib/api/recipes/validate-brep.js +330 -0
  107. package/lib/api/recipes/validate.d.ts +0 -31
  108. package/lib/api/recipes/validate.js +7 -115
  109. package/lib/api/resolved-inputs/index.d.ts +80 -0
  110. package/lib/api/retaining-rings/ansi-retaining-rings.constants.d.ts +4 -0
  111. package/lib/api/retaining-rings/ansi-retaining-rings.constants.js +93 -0
  112. package/lib/api/retaining-rings/ansi-retaining-rings.d.ts +4 -0
  113. package/lib/api/retaining-rings/ansi-retaining-rings.js +20 -0
  114. package/lib/api/retaining-rings/din-retaining-rings.constants.d.ts +3 -0
  115. package/lib/api/retaining-rings/din-retaining-rings.constants.js +115 -0
  116. package/lib/api/retaining-rings/din-retaining-rings.d.ts +4 -0
  117. package/lib/api/retaining-rings/din-retaining-rings.js +20 -0
  118. package/lib/api/retaining-rings/retaining-ring-types.d.ts +30 -0
  119. package/lib/api/retaining-rings/retaining-ring-types.js +1 -0
  120. package/lib/api/retaining-rings/retaining-rings.constants.d.ts +1 -0
  121. package/lib/api/retaining-rings/retaining-rings.constants.js +1 -0
  122. package/lib/api/retaining-rings/retaining-rings.d.ts +2 -0
  123. package/lib/api/retaining-rings/retaining-rings.js +9 -0
  124. package/lib/api/services/base-bitbybit.d.ts +42 -0
  125. package/lib/api/services/base-bitbybit.js +43 -0
  126. package/lib/api/services/color.d.ts +35 -2
  127. package/lib/api/services/color.js +48 -12
  128. package/lib/api/services/engineering/engineering.d.ts +12 -0
  129. package/lib/api/services/engineering/engineering.js +13 -0
  130. package/lib/api/services/engineering/index.d.ts +2 -0
  131. package/lib/api/services/engineering/index.js +2 -0
  132. package/lib/api/services/engineering/mechanical/bearings-ansi.d.ts +40 -0
  133. package/lib/api/services/engineering/mechanical/bearings-ansi.js +47 -0
  134. package/lib/api/services/engineering/mechanical/bearings-iso.d.ts +39 -0
  135. package/lib/api/services/engineering/mechanical/bearings-iso.js +46 -0
  136. package/lib/api/services/engineering/mechanical/bearings.d.ts +14 -0
  137. package/lib/api/services/engineering/mechanical/bearings.js +15 -0
  138. package/lib/api/services/engineering/mechanical/fasteners-ansi.d.ts +109 -0
  139. package/lib/api/services/engineering/mechanical/fasteners-ansi.js +133 -0
  140. package/lib/api/services/engineering/mechanical/fasteners-iso.d.ts +123 -0
  141. package/lib/api/services/engineering/mechanical/fasteners-iso.js +151 -0
  142. package/lib/api/services/engineering/mechanical/fasteners.d.ts +13 -0
  143. package/lib/api/services/engineering/mechanical/fasteners.js +14 -0
  144. package/lib/api/services/engineering/mechanical/gears.d.ts +267 -0
  145. package/lib/api/services/engineering/mechanical/gears.js +318 -0
  146. package/lib/api/services/engineering/mechanical/index.d.ts +24 -0
  147. package/lib/api/services/engineering/mechanical/index.js +24 -0
  148. package/lib/api/services/engineering/mechanical/keys-ansi.d.ts +27 -0
  149. package/lib/api/services/engineering/mechanical/keys-ansi.js +32 -0
  150. package/lib/api/services/engineering/mechanical/keys-din.d.ts +26 -0
  151. package/lib/api/services/engineering/mechanical/keys-din.js +31 -0
  152. package/lib/api/services/engineering/mechanical/keys.d.ts +14 -0
  153. package/lib/api/services/engineering/mechanical/keys.js +15 -0
  154. package/lib/api/services/engineering/mechanical/knurls-ansi.d.ts +26 -0
  155. package/lib/api/services/engineering/mechanical/knurls-ansi.js +31 -0
  156. package/lib/api/services/engineering/mechanical/knurls-din.d.ts +26 -0
  157. package/lib/api/services/engineering/mechanical/knurls-din.js +31 -0
  158. package/lib/api/services/engineering/mechanical/knurls.d.ts +14 -0
  159. package/lib/api/services/engineering/mechanical/knurls.js +15 -0
  160. package/lib/api/services/engineering/mechanical/mechanical.d.ts +29 -0
  161. package/lib/api/services/engineering/mechanical/mechanical.js +30 -0
  162. package/lib/api/services/engineering/mechanical/retaining-rings-ansi.d.ts +43 -0
  163. package/lib/api/services/engineering/mechanical/retaining-rings-ansi.js +51 -0
  164. package/lib/api/services/engineering/mechanical/retaining-rings-din.d.ts +43 -0
  165. package/lib/api/services/engineering/mechanical/retaining-rings-din.js +51 -0
  166. package/lib/api/services/engineering/mechanical/retaining-rings.d.ts +13 -0
  167. package/lib/api/services/engineering/mechanical/retaining-rings.js +14 -0
  168. package/lib/api/services/engineering/mechanical/splines-ansi.d.ts +27 -0
  169. package/lib/api/services/engineering/mechanical/splines-ansi.js +32 -0
  170. package/lib/api/services/engineering/mechanical/splines-din.d.ts +26 -0
  171. package/lib/api/services/engineering/mechanical/splines-din.js +31 -0
  172. package/lib/api/services/engineering/mechanical/splines.d.ts +13 -0
  173. package/lib/api/services/engineering/mechanical/splines.js +14 -0
  174. package/lib/api/services/engineering/mechanical/springs.d.ts +27 -0
  175. package/lib/api/services/engineering/mechanical/springs.js +31 -0
  176. package/lib/api/services/engineering/mechanical/threads-ansi.d.ts +40 -0
  177. package/lib/api/services/engineering/mechanical/threads-ansi.js +48 -0
  178. package/lib/api/services/engineering/mechanical/threads-iso.d.ts +40 -0
  179. package/lib/api/services/engineering/mechanical/threads-iso.js +48 -0
  180. package/lib/api/services/engineering/mechanical/threads.d.ts +13 -0
  181. package/lib/api/services/engineering/mechanical/threads.js +14 -0
  182. package/lib/api/services/frame.js +3 -3
  183. package/lib/api/services/geometry-helper.js +8 -111
  184. package/lib/api/services/helpers/color/color-space.d.ts +2 -0
  185. package/lib/api/services/helpers/color/color-space.js +12 -0
  186. package/lib/api/services/helpers/{nurbs.d.ts → curves/nurbs.d.ts} +1 -1
  187. package/lib/api/services/helpers/{surface-triangulation.d.ts → curves/surface-triangulation.d.ts} +2 -2
  188. package/lib/api/services/helpers/{surface-triangulation.js → curves/surface-triangulation.js} +14 -8
  189. package/lib/api/services/helpers/{dxf → files/dxf}/dxf-generator.d.ts +2 -1
  190. package/lib/api/services/helpers/{dxf → files/dxf}/dxf-generator.js +19 -5
  191. package/lib/api/services/helpers/files/dxf/dxf.constants.d.ts +4 -0
  192. package/lib/api/services/helpers/files/dxf/dxf.constants.js +4 -0
  193. package/lib/api/services/helpers/{dxf → files/dxf}/dxf.d.ts +1 -1
  194. package/lib/api/services/helpers/{dxf → files/dxf}/dxf.js +2 -2
  195. package/lib/api/services/helpers/files/glb.constants.d.ts +11 -0
  196. package/lib/api/services/helpers/files/glb.constants.js +11 -0
  197. package/lib/api/services/helpers/files/glb.d.ts +1 -0
  198. package/lib/api/services/helpers/files/glb.js +69 -0
  199. package/lib/api/services/helpers/files/gzip.constants.d.ts +11 -0
  200. package/lib/api/services/helpers/files/gzip.constants.js +11 -0
  201. package/lib/api/services/helpers/files/gzip.d.ts +2 -0
  202. package/lib/api/services/helpers/files/gzip.js +52 -0
  203. package/lib/api/services/helpers/{inflate.constants.d.ts → files/inflate.constants.d.ts} +1 -0
  204. package/lib/api/services/helpers/{inflate.constants.js → files/inflate.constants.js} +1 -0
  205. package/lib/api/services/helpers/{inflate.d.ts → files/inflate.d.ts} +1 -1
  206. package/lib/api/services/helpers/{inflate.js → files/inflate.js} +5 -4
  207. package/lib/api/services/helpers/{zip.d.ts → files/zip.d.ts} +1 -1
  208. package/lib/api/services/helpers/geometry/arcs.d.ts +9 -0
  209. package/lib/api/services/helpers/{arcs.js → geometry/arcs.js} +7 -0
  210. package/lib/api/services/helpers/{frame-axes.d.ts → geometry/frame-axes.d.ts} +8 -5
  211. package/lib/api/services/helpers/{frame-axes.js → geometry/frame-axes.js} +21 -9
  212. package/lib/api/services/helpers/geometry/lengths.constants.d.ts +4 -0
  213. package/lib/api/services/helpers/geometry/lengths.constants.js +3 -0
  214. package/lib/api/services/helpers/geometry/lengths.d.ts +7 -0
  215. package/lib/api/services/helpers/geometry/lengths.js +20 -0
  216. package/lib/api/services/helpers/geometry/matrices.constants.d.ts +8 -0
  217. package/lib/api/services/helpers/geometry/matrices.constants.js +7 -0
  218. package/lib/api/services/helpers/geometry/matrices.d.ts +17 -0
  219. package/lib/api/services/helpers/{matrices.js → geometry/matrices.js} +28 -17
  220. package/lib/api/services/helpers/{paths.d.ts → geometry/paths.d.ts} +2 -1
  221. package/lib/api/services/helpers/{paths.js → geometry/paths.js} +36 -30
  222. package/lib/api/services/helpers/{polygons.d.ts → geometry/polygons.d.ts} +1 -1
  223. package/lib/api/services/helpers/geometry/polygons.js +111 -0
  224. package/lib/api/services/helpers/geometry/scalars.d.ts +9 -0
  225. package/lib/api/services/helpers/geometry/scalars.js +34 -0
  226. package/lib/api/services/helpers/{triangulation.js → geometry/triangulation.js} +11 -6
  227. package/lib/api/services/helpers/geometry/vector-grid.d.ts +12 -0
  228. package/lib/api/services/helpers/geometry/vector-grid.js +149 -0
  229. package/lib/api/services/helpers/{vectors.d.ts → geometry/vectors.d.ts} +8 -1
  230. package/lib/api/services/helpers/geometry/vectors.js +43 -0
  231. package/lib/api/services/helpers/helper-types.d.ts +57 -0
  232. package/lib/api/services/helpers/mesh/mesh-normals.d.ts +21 -0
  233. package/lib/api/services/helpers/{mesh-normals.js → mesh/mesh-normals.js} +54 -65
  234. package/lib/api/services/helpers/mesh/mesh-orientation.d.ts +24 -0
  235. package/lib/api/services/helpers/mesh/mesh-orientation.js +104 -0
  236. package/lib/api/services/helpers/{mesh-primitives.d.ts → mesh/mesh-primitives.d.ts} +1 -1
  237. package/lib/api/services/helpers/{mesh-primitives.js → mesh/mesh-primitives.js} +6 -5
  238. package/lib/api/services/helpers/mesh/mesh-proximity.constants.d.ts +7 -0
  239. package/lib/api/services/helpers/mesh/mesh-proximity.constants.js +11 -0
  240. package/lib/api/services/helpers/mesh/mesh-proximity.d.ts +11 -0
  241. package/lib/api/services/helpers/mesh/mesh-proximity.js +382 -0
  242. package/lib/api/services/index.d.ts +3 -0
  243. package/lib/api/services/index.js +3 -0
  244. package/lib/api/services/io.d.ts +1 -1
  245. package/lib/api/services/io.js +1 -1
  246. package/lib/api/services/line.js +2 -3
  247. package/lib/api/services/math.d.ts +47 -0
  248. package/lib/api/services/math.js +77 -10
  249. package/lib/api/services/mesh.d.ts +174 -2
  250. package/lib/api/services/mesh.js +305 -7
  251. package/lib/api/services/point.js +4 -10
  252. package/lib/api/services/polyline-types.d.ts +6 -0
  253. package/lib/api/services/polyline-types.js +1 -0
  254. package/lib/api/services/polyline.d.ts +163 -1
  255. package/lib/api/services/polyline.js +270 -13
  256. package/lib/api/services/recipes.d.ts +80 -0
  257. package/lib/api/services/recipes.js +107 -0
  258. package/lib/api/services/transforms.d.ts +74 -2
  259. package/lib/api/services/transforms.js +100 -3
  260. package/lib/api/services/vector.d.ts +4 -3
  261. package/lib/api/services/vector.js +14 -14
  262. package/lib/api/splines/ansi-splines.constants.d.ts +9 -0
  263. package/lib/api/splines/ansi-splines.constants.js +9 -0
  264. package/lib/api/splines/ansi-splines.d.ts +3 -0
  265. package/lib/api/splines/ansi-splines.js +28 -0
  266. package/lib/api/splines/din-splines.constants.d.ts +12 -0
  267. package/lib/api/splines/din-splines.constants.js +12 -0
  268. package/lib/api/splines/din-splines.d.ts +3 -0
  269. package/lib/api/splines/din-splines.js +38 -0
  270. package/lib/api/splines/spline-types.d.ts +32 -0
  271. package/lib/api/splines/spline-types.js +1 -0
  272. package/lib/api/splines/splines.constants.d.ts +1 -0
  273. package/lib/api/splines/splines.constants.js +1 -0
  274. package/lib/api/springs/spring-types.d.ts +26 -0
  275. package/lib/api/springs/spring-types.js +1 -0
  276. package/lib/api/springs/springs.constants.d.ts +9 -0
  277. package/lib/api/springs/springs.constants.js +9 -0
  278. package/lib/api/springs/springs.d.ts +2 -0
  279. package/lib/api/springs/springs.js +50 -0
  280. package/lib/api/threads/ansi-threads.constants.d.ts +6 -0
  281. package/lib/api/threads/ansi-threads.constants.js +27 -0
  282. package/lib/api/threads/ansi-threads.d.ts +4 -0
  283. package/lib/api/threads/ansi-threads.js +50 -0
  284. package/lib/api/threads/iso-threads.constants.d.ts +5 -0
  285. package/lib/api/threads/iso-threads.constants.js +20 -0
  286. package/lib/api/threads/iso-threads.d.ts +4 -0
  287. package/lib/api/threads/iso-threads.js +32 -0
  288. package/lib/api/threads/thread-profile.constants.d.ts +3 -0
  289. package/lib/api/threads/thread-profile.constants.js +3 -0
  290. package/lib/api/threads/thread-types.d.ts +66 -0
  291. package/lib/api/threads/thread-types.js +1 -0
  292. package/package.json +1 -1
  293. package/lib/api/recipes/index.d.ts +0 -4
  294. package/lib/api/recipes/index.js +0 -3
  295. package/lib/api/services/helpers/arcs.d.ts +0 -6
  296. package/lib/api/services/helpers/matrices.constants.d.ts +0 -2
  297. package/lib/api/services/helpers/matrices.constants.js +0 -2
  298. package/lib/api/services/helpers/matrices.d.ts +0 -25
  299. package/lib/api/services/helpers/mesh-normals.d.ts +0 -11
  300. package/lib/api/services/helpers/polygons.js +0 -59
  301. package/lib/api/services/helpers/vectors.js +0 -17
  302. /package/lib/api/services/helpers/{nurbs.js → curves/nurbs.js} +0 -0
  303. /package/lib/api/services/helpers/{crc32.d.ts → files/crc32.d.ts} +0 -0
  304. /package/lib/api/services/helpers/{crc32.js → files/crc32.js} +0 -0
  305. /package/lib/api/services/helpers/{zip.constants.d.ts → files/zip.constants.d.ts} +0 -0
  306. /package/lib/api/services/helpers/{zip.constants.js → files/zip.constants.js} +0 -0
  307. /package/lib/api/services/helpers/{zip.js → files/zip.js} +0 -0
  308. /package/lib/api/services/helpers/{triangulation.d.ts → geometry/triangulation.d.ts} +0 -0
  309. /package/lib/api/services/helpers/{mesh-measures.d.ts → mesh/mesh-measures.d.ts} +0 -0
  310. /package/lib/api/services/helpers/{mesh-measures.js → mesh/mesh-measures.js} +0 -0
  311. /package/lib/api/services/helpers/{mesh-primitives.constants.d.ts → mesh/mesh-primitives.constants.d.ts} +0 -0
  312. /package/lib/api/services/helpers/{mesh-primitives.constants.js → mesh/mesh-primitives.constants.js} +0 -0
@@ -117,8 +117,8 @@ export declare class Color {
117
117
  /**
118
118
  * Writes three channel values as a hex color.
119
119
  *
120
- * `min` and `max` say which range the values use; a range other than 0 to 255 is remapped
121
- * first, so channels from 0 to 1 work as well.
120
+ * `min` and `max` give the values' range; a range other than 0 to 255 is remapped first, and
121
+ * each channel is rounded and held between 0 and 255.
122
122
  * Example: r 255, g 87, b 51 in [0,255] -> '#ff5733'; r 1, g 0.5, b 0.2 in [0,1] -> '#ff8033'
123
123
  * @param inputs - The red, green and blue values and their range
124
124
  * @returns The hex color
@@ -259,4 +259,37 @@ export declare class Color {
259
259
  * ```
260
260
  */
261
261
  invert(inputs: Inputs.Color.InvertHexDto): Inputs.Base.Color;
262
+ /**
263
+ * Turns one sRGB-encoded color channel into linear light, the form glTF, STEP colors read by
264
+ * XCAF and the renderers' lighting work in. A hex color's channels are sRGB-encoded.
265
+ *
266
+ * Example: 0.5 -> 0.214
267
+ * @param inputs - The encoded channel, from 0 to 1
268
+ * @returns The linear channel, from 0 to 1
269
+ * @group linear light
270
+ * @shortname srgb to linear
271
+ * @drawable false
272
+ * @example
273
+ * ```typescript
274
+ * const { r, g, b } = bitbybit.color.hexToRgbMapped({ color: "#ff8800", from: 0, to: 1 });
275
+ * const linear = [r, g, b].map(channel => bitbybit.color.srgbToLinear({ channel }));
276
+ * ```
277
+ */
278
+ srgbToLinear(inputs: Inputs.Color.ChannelDto): number;
279
+ /**
280
+ * Turns one linear-light color channel back into its sRGB encoding, the inverse of
281
+ * `srgbToLinear`, as a hex color holds it.
282
+ *
283
+ * Example: 0.214 -> 0.5
284
+ * @param inputs - The linear channel, from 0 to 1
285
+ * @returns The encoded channel, from 0 to 1
286
+ * @group linear light
287
+ * @shortname linear to srgb
288
+ * @drawable false
289
+ * @example
290
+ * ```typescript
291
+ * const half = bitbybit.color.linearToSrgb({ channel: 0.214 });
292
+ * ```
293
+ */
294
+ linearToSrgb(inputs: Inputs.Color.ChannelDto): number;
262
295
  }
@@ -1,5 +1,7 @@
1
1
  import * as Inputs from "../inputs";
2
2
  import { resolveDto } from "../kernel-calls";
3
+ import { linearToSrgb, srgbToLinear } from "./helpers/color/color-space";
4
+ const HEX_RADIX = 16;
3
5
  /**
4
6
  * Colors in the two forms the library uses: a hex text such as `#ff5733`, and an object `{ r, g, b
5
7
  * }` or `{ r, g, b, a }` whose channels run either from 0 to 255 or from 0 to 1. The methods here
@@ -150,8 +152,8 @@ export class Color {
150
152
  /**
151
153
  * Writes three channel values as a hex color.
152
154
  *
153
- * `min` and `max` say which range the values use; a range other than 0 to 255 is remapped
154
- * first, so channels from 0 to 1 work as well.
155
+ * `min` and `max` give the values' range; a range other than 0 to 255 is remapped first, and
156
+ * each channel is rounded and held between 0 and 255.
155
157
  * Example: r 255, g 87, b 51 in [0,255] -> '#ff5733'; r 1, g 0.5, b 0.2 in [0,1] -> '#ff8033'
156
158
  * @param inputs - The red, green and blue values and their range
157
159
  * @returns The hex color
@@ -165,16 +167,11 @@ export class Color {
165
167
  */
166
168
  rgbToHex(inputs) {
167
169
  const resolved = resolveDto(Inputs.Color.RGBMinMaxDto, inputs);
168
- let r = resolved.r;
169
- let g = resolved.g;
170
- let b = resolved.b;
171
- if (resolved.max !== 255) {
172
- r = Math.round(this.math.remap({ number: r, fromLow: resolved.min, fromHigh: resolved.max, toLow: 0, toHigh: 255 }));
173
- g = Math.round(this.math.remap({ number: g, fromLow: resolved.min, fromHigh: resolved.max, toLow: 0, toHigh: 255 }));
174
- b = Math.round(this.math.remap({ number: b, fromLow: resolved.min, fromHigh: resolved.max, toLow: 0, toHigh: 255 }));
175
- }
176
- const s = `#${Number(0x1000000 + r * 0x10000 + g * 0x100 + b).toString(16).substring(1, 7)}`;
177
- return s;
170
+ const byteOf = (channel) => {
171
+ const scaled = resolved.min === 0 && resolved.max === 255 ? channel : this.math.remap({ number: channel, fromLow: resolved.min, fromHigh: resolved.max, toLow: 0, toHigh: 255 });
172
+ return Math.min(255, Math.max(0, Math.round(scaled)));
173
+ };
174
+ return `#${Number(0x1000000 + byteOf(resolved.r) * 0x10000 + byteOf(resolved.g) * 0x100 + byteOf(resolved.b)).toString(HEX_RADIX).substring(1, 7)}`;
178
175
  }
179
176
  /**
180
177
  * Writes an `{ r, g, b }` color as a hex color.
@@ -345,4 +342,43 @@ export class Color {
345
342
  const bInv = (255 - b);
346
343
  return this.rgbToHex({ r: rInv, g: gInv, b: bInv, min: 0, max: 255 });
347
344
  }
345
+ /**
346
+ * Turns one sRGB-encoded color channel into linear light, the form glTF, STEP colors read by
347
+ * XCAF and the renderers' lighting work in. A hex color's channels are sRGB-encoded.
348
+ *
349
+ * Example: 0.5 -> 0.214
350
+ * @param inputs - The encoded channel, from 0 to 1
351
+ * @returns The linear channel, from 0 to 1
352
+ * @group linear light
353
+ * @shortname srgb to linear
354
+ * @drawable false
355
+ * @example
356
+ * ```typescript
357
+ * const { r, g, b } = bitbybit.color.hexToRgbMapped({ color: "#ff8800", from: 0, to: 1 });
358
+ * const linear = [r, g, b].map(channel => bitbybit.color.srgbToLinear({ channel }));
359
+ * ```
360
+ */
361
+ srgbToLinear(inputs) {
362
+ const resolved = resolveDto(Inputs.Color.ChannelDto, inputs);
363
+ return srgbToLinear(resolved.channel);
364
+ }
365
+ /**
366
+ * Turns one linear-light color channel back into its sRGB encoding, the inverse of
367
+ * `srgbToLinear`, as a hex color holds it.
368
+ *
369
+ * Example: 0.214 -> 0.5
370
+ * @param inputs - The linear channel, from 0 to 1
371
+ * @returns The encoded channel, from 0 to 1
372
+ * @group linear light
373
+ * @shortname linear to srgb
374
+ * @drawable false
375
+ * @example
376
+ * ```typescript
377
+ * const half = bitbybit.color.linearToSrgb({ channel: 0.214 });
378
+ * ```
379
+ */
380
+ linearToSrgb(inputs) {
381
+ const resolved = resolveDto(Inputs.Color.ChannelDto, inputs);
382
+ return linearToSrgb(resolved.channel);
383
+ }
348
384
  }
@@ -0,0 +1,12 @@
1
+ import { EngineeringMechanical } from "./mechanical/mechanical";
2
+ /**
3
+ * Engineering knowledge by its numbers, grouped by domain, with no CAD kernel needed. `mechanical`
4
+ * holds the machine elements: gears and racks, fasteners and threads, ball bearings, keys, retaining
5
+ * rings, splines, knurls and springs, each standard's sizes in the unit asked for. Each domain gives
6
+ * sizes and outlines for any kernel to build from.
7
+ * @beta
8
+ */
9
+ export declare class Engineering {
10
+ readonly mechanical: EngineeringMechanical;
11
+ constructor();
12
+ }
@@ -0,0 +1,13 @@
1
+ import { EngineeringMechanical } from "./mechanical/mechanical";
2
+ /**
3
+ * Engineering knowledge by its numbers, grouped by domain, with no CAD kernel needed. `mechanical`
4
+ * holds the machine elements: gears and racks, fasteners and threads, ball bearings, keys, retaining
5
+ * rings, splines, knurls and springs, each standard's sizes in the unit asked for. Each domain gives
6
+ * sizes and outlines for any kernel to build from.
7
+ * @beta
8
+ */
9
+ export class Engineering {
10
+ constructor() {
11
+ this.mechanical = new EngineeringMechanical();
12
+ }
13
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./engineering";
2
+ export * from "./mechanical";
@@ -0,0 +1,2 @@
1
+ export * from "./engineering";
2
+ export * from "./mechanical";
@@ -0,0 +1,40 @@
1
+ import * as Inputs from "../../../inputs";
2
+ import type { AnsiBallBearingDesignation, BallBearingSizes } from "../../../bearings/bearing-types";
3
+ /**
4
+ * The sizes of inch deep groove ball bearings of the R-series, from the miniature R1-4 to R20, with
5
+ * no CAD kernel needed, in the unit asked for. `occt.parts.mechanical.bearings.ansi` builds them as
6
+ * solids.
7
+ * @beta
8
+ */
9
+ export declare class EngineeringBearingsAnsi {
10
+ /**
11
+ * Gives an R-series ball bearing by its designation: its bore, its outside diameter and its width,
12
+ * open or shielded.
13
+ *
14
+ * Several sizes are wider shielded than open. Example: R8 -> 1/2 bore, 1-1/8 outside, 1/4 wide
15
+ * open, 5/16 shielded
16
+ * @param inputs - The designation, whether it is shielded and the unit
17
+ * @returns The bearing's sizes in `unit`
18
+ * @group ball bearings
19
+ * @shortname ansi ball bearing sizes
20
+ * @drawable false
21
+ * @example
22
+ * ```typescript
23
+ * const bearing = bitbybit.engineering.mechanical.bearings.ansi.ballBearingSizes({ designation: Bit.Inputs.Engineering.ansiBallBearingEnum.r8 });
24
+ * const housingBore = bearing.outside;
25
+ * ```
26
+ */
27
+ ballBearingSizes(inputs: Inputs.Engineering.AnsiBallBearingSizesDto): BallBearingSizes;
28
+ /**
29
+ * Lists the designations of the R-series ball bearings the tables hold.
30
+ * @returns The designations, the miniature series first
31
+ * @group ball bearings
32
+ * @shortname ansi ball bearing designations
33
+ * @drawable false
34
+ * @example
35
+ * ```typescript
36
+ * const designations = bitbybit.engineering.mechanical.bearings.ansi.designations();
37
+ * ```
38
+ */
39
+ designations(): AnsiBallBearingDesignation[];
40
+ }
@@ -0,0 +1,47 @@
1
+ import * as Inputs from "../../../inputs";
2
+ import { resolveDto } from "../../../kernel-calls";
3
+ import { ansiBallBearingDesignations, ansiBallBearingSizes } from "../../../bearings/ansi-bearings";
4
+ import { checkedUnitOfLength } from "../../helpers/geometry/lengths";
5
+ /**
6
+ * The sizes of inch deep groove ball bearings of the R-series, from the miniature R1-4 to R20, with
7
+ * no CAD kernel needed, in the unit asked for. `occt.parts.mechanical.bearings.ansi` builds them as
8
+ * solids.
9
+ * @beta
10
+ */
11
+ export class EngineeringBearingsAnsi {
12
+ /**
13
+ * Gives an R-series ball bearing by its designation: its bore, its outside diameter and its width,
14
+ * open or shielded.
15
+ *
16
+ * Several sizes are wider shielded than open. Example: R8 -> 1/2 bore, 1-1/8 outside, 1/4 wide
17
+ * open, 5/16 shielded
18
+ * @param inputs - The designation, whether it is shielded and the unit
19
+ * @returns The bearing's sizes in `unit`
20
+ * @group ball bearings
21
+ * @shortname ansi ball bearing sizes
22
+ * @drawable false
23
+ * @example
24
+ * ```typescript
25
+ * const bearing = bitbybit.engineering.mechanical.bearings.ansi.ballBearingSizes({ designation: Bit.Inputs.Engineering.ansiBallBearingEnum.r8 });
26
+ * const housingBore = bearing.outside;
27
+ * ```
28
+ */
29
+ ballBearingSizes(inputs) {
30
+ const resolved = resolveDto(Inputs.Engineering.AnsiBallBearingSizesDto, inputs);
31
+ return ansiBallBearingSizes(resolved.designation, resolved.shields === true, checkedUnitOfLength(resolved.unit, "unit"));
32
+ }
33
+ /**
34
+ * Lists the designations of the R-series ball bearings the tables hold.
35
+ * @returns The designations, the miniature series first
36
+ * @group ball bearings
37
+ * @shortname ansi ball bearing designations
38
+ * @drawable false
39
+ * @example
40
+ * ```typescript
41
+ * const designations = bitbybit.engineering.mechanical.bearings.ansi.designations();
42
+ * ```
43
+ */
44
+ designations() {
45
+ return ansiBallBearingDesignations();
46
+ }
47
+ }
@@ -0,0 +1,39 @@
1
+ import * as Inputs from "../../../inputs";
2
+ import type { BallBearingSizes, IsoBallBearingDesignation } from "../../../bearings/bearing-types";
3
+ /**
4
+ * The sizes of metric deep groove ball bearings, from the 60 and 62 series and the small 62x and 60x
5
+ * sizes, with no CAD kernel needed, in the unit asked for. `occt.parts.mechanical.bearings.iso`
6
+ * builds them as solids.
7
+ * @beta
8
+ */
9
+ export declare class EngineeringBearingsIso {
10
+ /**
11
+ * Gives a deep groove ball bearing by its designation: its bore, its outside diameter and its
12
+ * width.
13
+ *
14
+ * Example: 608 -> 8 bore, 22 outside, 7 wide, in millimetres
15
+ * @param inputs - The designation and the unit
16
+ * @returns The bearing's sizes in `unit`
17
+ * @group ball bearings
18
+ * @shortname iso ball bearing sizes
19
+ * @drawable false
20
+ * @example
21
+ * ```typescript
22
+ * const bearing = bitbybit.engineering.mechanical.bearings.iso.ballBearingSizes({ designation: Bit.Inputs.Engineering.isoBallBearingEnum.b6204 });
23
+ * const housingBore = bearing.outside;
24
+ * ```
25
+ */
26
+ ballBearingSizes(inputs: Inputs.Engineering.IsoBallBearingSizesDto): BallBearingSizes;
27
+ /**
28
+ * Lists the designations of the metric ball bearings the tables hold.
29
+ * @returns The designations, small series first
30
+ * @group ball bearings
31
+ * @shortname iso ball bearing designations
32
+ * @drawable false
33
+ * @example
34
+ * ```typescript
35
+ * const designations = bitbybit.engineering.mechanical.bearings.iso.designations();
36
+ * ```
37
+ */
38
+ designations(): IsoBallBearingDesignation[];
39
+ }
@@ -0,0 +1,46 @@
1
+ import * as Inputs from "../../../inputs";
2
+ import { resolveDto } from "../../../kernel-calls";
3
+ import { isoBallBearingDesignations, isoBallBearingSizes } from "../../../bearings/iso-bearings";
4
+ import { checkedUnitOfLength } from "../../helpers/geometry/lengths";
5
+ /**
6
+ * The sizes of metric deep groove ball bearings, from the 60 and 62 series and the small 62x and 60x
7
+ * sizes, with no CAD kernel needed, in the unit asked for. `occt.parts.mechanical.bearings.iso`
8
+ * builds them as solids.
9
+ * @beta
10
+ */
11
+ export class EngineeringBearingsIso {
12
+ /**
13
+ * Gives a deep groove ball bearing by its designation: its bore, its outside diameter and its
14
+ * width.
15
+ *
16
+ * Example: 608 -> 8 bore, 22 outside, 7 wide, in millimetres
17
+ * @param inputs - The designation and the unit
18
+ * @returns The bearing's sizes in `unit`
19
+ * @group ball bearings
20
+ * @shortname iso ball bearing sizes
21
+ * @drawable false
22
+ * @example
23
+ * ```typescript
24
+ * const bearing = bitbybit.engineering.mechanical.bearings.iso.ballBearingSizes({ designation: Bit.Inputs.Engineering.isoBallBearingEnum.b6204 });
25
+ * const housingBore = bearing.outside;
26
+ * ```
27
+ */
28
+ ballBearingSizes(inputs) {
29
+ const resolved = resolveDto(Inputs.Engineering.IsoBallBearingSizesDto, inputs);
30
+ return isoBallBearingSizes(resolved.designation, checkedUnitOfLength(resolved.unit, "unit"));
31
+ }
32
+ /**
33
+ * Lists the designations of the metric ball bearings the tables hold.
34
+ * @returns The designations, small series first
35
+ * @group ball bearings
36
+ * @shortname iso ball bearing designations
37
+ * @drawable false
38
+ * @example
39
+ * ```typescript
40
+ * const designations = bitbybit.engineering.mechanical.bearings.iso.designations();
41
+ * ```
42
+ */
43
+ designations() {
44
+ return isoBallBearingDesignations();
45
+ }
46
+ }
@@ -0,0 +1,14 @@
1
+ import { EngineeringBearingsIso } from "./bearings-iso";
2
+ import { EngineeringBearingsAnsi } from "./bearings-ansi";
3
+ /**
4
+ * The sizes of deep groove ball bearings by the standard that sets them, with no CAD kernel needed:
5
+ * `iso` holds the metric 60 and 62 series and the small 62x and 60x sizes, `ansi` the inch R-series,
6
+ * each in the unit asked for.
7
+ * `occt.parts.mechanical.bearings` builds them as solids.
8
+ * @beta
9
+ */
10
+ export declare class EngineeringBearings {
11
+ readonly iso: EngineeringBearingsIso;
12
+ readonly ansi: EngineeringBearingsAnsi;
13
+ constructor();
14
+ }
@@ -0,0 +1,15 @@
1
+ import { EngineeringBearingsIso } from "./bearings-iso";
2
+ import { EngineeringBearingsAnsi } from "./bearings-ansi";
3
+ /**
4
+ * The sizes of deep groove ball bearings by the standard that sets them, with no CAD kernel needed:
5
+ * `iso` holds the metric 60 and 62 series and the small 62x and 60x sizes, `ansi` the inch R-series,
6
+ * each in the unit asked for.
7
+ * `occt.parts.mechanical.bearings` builds them as solids.
8
+ * @beta
9
+ */
10
+ export class EngineeringBearings {
11
+ constructor() {
12
+ this.iso = new EngineeringBearingsIso();
13
+ this.ansi = new EngineeringBearingsAnsi();
14
+ }
15
+ }
@@ -0,0 +1,109 @@
1
+ import * as Inputs from "../../../inputs";
2
+ import type { HexBoltSizes, HexNutSizes, SetScrewSizes, SocketHeadCapScrewSizes, WasherSizes } from "../../../fasteners/fastener-types";
3
+ /**
4
+ * The sizes of ASME inch fasteners from #0 to 1 inch, with no CAD kernel needed: clearance holes
5
+ * (B18.2.8), cap screws with a hexagon recess and set screws (B18.3), hex cap screws (B18.2.1), hex nuts (B18.2.2
6
+ * and B18.6.3) and plain washers (B18.22.1), in the unit asked for. `occt.parts.mechanical.fasteners.ansi`
7
+ * builds them as solids.
8
+ * @beta
9
+ */
10
+ export declare class EngineeringFastenersAnsi {
11
+ /**
12
+ * Gives the diameter of an ASME B18.2.8 clearance hole for a screw: close, normal or loose.
13
+ *
14
+ * Example: 1/4, normal -> 0.281 inches, a 9/32 drill
15
+ * @param inputs - The size, the fit and the unit
16
+ * @returns The hole's diameter in `unit`
17
+ * @group holes
18
+ * @shortname ansi clearance hole
19
+ * @drawable false
20
+ * @example
21
+ * ```typescript
22
+ * const hole = bitbybit.engineering.mechanical.fasteners.ansi.clearanceHole({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.in1_4, fit: Bit.Inputs.Engineering.clearanceFitEnum.normal });
23
+ * ```
24
+ */
25
+ clearanceHole(inputs: Inputs.Engineering.AnsiClearanceHoleDto): number;
26
+ /**
27
+ * Gives the head of an ASME B18.3 cap screw: its diameter and height, its hexagon recess, the
28
+ * threaded length and the counterbore that sinks it.
29
+ *
30
+ * The counterbore is 0.02 deeper than the head, so the head sits below the face. Example: 1/4 ->
31
+ * head 0.375 by 0.25, a 3/16 recess, counterbore 7/16 by 0.27
32
+ * @param inputs - The size and the unit
33
+ * @returns The head's sizes in `unit`
34
+ * @group screws
35
+ * @shortname ansi cap screw sizes
36
+ * @drawable false
37
+ * @example
38
+ * ```typescript
39
+ * const head = bitbybit.engineering.mechanical.fasteners.ansi.socketHeadCapScrewSizes({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.n10 });
40
+ * ```
41
+ */
42
+ socketHeadCapScrewSizes(inputs: Inputs.Engineering.AnsiSizeDto): SocketHeadCapScrewSizes;
43
+ /**
44
+ * Gives an ASME B18.2.1 hex cap screw's width across flats, head height and threaded length.
45
+ *
46
+ * A screw up to 6 inches long is threaded twice its diameter and a quarter of an inch, a longer
47
+ * one half an inch more. Example: 1/4, 1 inch long -> 7/16 across flats, 0.75 threaded
48
+ * @param inputs - The size, the length and the unit
49
+ * @returns The screw's sizes in `unit`
50
+ * @group screws
51
+ * @shortname ansi hex bolt sizes
52
+ * @drawable false
53
+ * @example
54
+ * ```typescript
55
+ * const bolt = bitbybit.engineering.mechanical.fasteners.ansi.hexBoltSizes({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.in3_8, length: 1.5 });
56
+ * ```
57
+ */
58
+ hexBoltSizes(inputs: Inputs.Engineering.AnsiHexBoltSizesDto): HexBoltSizes;
59
+ /**
60
+ * Gives an ASME hex nut: a B18.6.3 machine screw nut from #0 to #12, a B18.2.2 hex nut from 1/4
61
+ * up, as its width across flats and its height.
62
+ *
63
+ * Example: 1/4 -> 7/16 across flats, 7/32 high
64
+ * @param inputs - The size and the unit
65
+ * @returns The nut's sizes in `unit`
66
+ * @group nuts and washers
67
+ * @shortname ansi hex nut sizes
68
+ * @drawable false
69
+ * @example
70
+ * ```typescript
71
+ * const nut = bitbybit.engineering.mechanical.fasteners.ansi.hexNutSizes({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.in1_4 });
72
+ * ```
73
+ */
74
+ hexNutSizes(inputs: Inputs.Engineering.AnsiSizeDto): HexNutSizes;
75
+ /**
76
+ * Gives an ASME B18.22.1 type A plain washer, narrow or wide: its inner and outer diameters and
77
+ * its thickness.
78
+ *
79
+ * The table starts at #6, which takes one washer in both series. Example: 1/4 narrow -> 0.281
80
+ * inside, 0.625 outside, 0.065 thick
81
+ * @param inputs - The size, the series and the unit
82
+ * @returns The washer's sizes in `unit`
83
+ * @group nuts and washers
84
+ * @shortname ansi washer sizes
85
+ * @drawable false
86
+ * @example
87
+ * ```typescript
88
+ * const washer = bitbybit.engineering.mechanical.fasteners.ansi.washerSizes({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.in1_4, series: Bit.Inputs.Engineering.ansiWasherSeriesEnum.wide });
89
+ * ```
90
+ */
91
+ washerSizes(inputs: Inputs.Engineering.AnsiWasherSizesDto): WasherSizes;
92
+ /**
93
+ * Gives an ASME B18.3 set screw by its size and point: its hexagon recess's size and least depth,
94
+ * and the point's diameter, length, angle and, for an oval point, radius.
95
+ *
96
+ * A screw shorter than its point's shortest long screw takes the shallower recess makers give it,
97
+ * and a short cone is blunter, 118 degrees.
98
+ * @param inputs - The size, the point, the thread series, the length and the unit
99
+ * @returns The sizes in `unit` and the point's angle in degrees
100
+ * @group screws
101
+ * @shortname ansi set screw sizes
102
+ * @drawable false
103
+ * @example
104
+ * ```typescript
105
+ * const grub = bitbybit.engineering.mechanical.fasteners.ansi.setScrewSizes({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.in1_4, point: Bit.Inputs.Engineering.ansiSetScrewPointEnum.halfDog, length: 0.5 });
106
+ * ```
107
+ */
108
+ setScrewSizes(inputs: Inputs.Engineering.AnsiSetScrewSizesDto): SetScrewSizes;
109
+ }
@@ -0,0 +1,133 @@
1
+ import * as Inputs from "../../../inputs";
2
+ import { resolveDto } from "../../../kernel-calls";
3
+ import { ansiClearanceHoleDiameter, ansiHexBoltSizes, ansiHexNutSizes, ansiSetScrewSizes, ansiSocketHeadCapScrewSizes, ansiWasherSizes } from "../../../fasteners/ansi-fasteners";
4
+ import { checkedUnitOfLength, lengthsConverted, snappedLength, tableLength } from "../../helpers/geometry/lengths";
5
+ import { HEX_BOLT_LENGTHS, HEX_NUT_LENGTHS, SCREW_HEAD_LENGTHS, SET_SCREW_LENGTHS, WASHER_LENGTHS } from "../../../fasteners/fasteners.constants";
6
+ /**
7
+ * The sizes of ASME inch fasteners from #0 to 1 inch, with no CAD kernel needed: clearance holes
8
+ * (B18.2.8), cap screws with a hexagon recess and set screws (B18.3), hex cap screws (B18.2.1), hex nuts (B18.2.2
9
+ * and B18.6.3) and plain washers (B18.22.1), in the unit asked for. `occt.parts.mechanical.fasteners.ansi`
10
+ * builds them as solids.
11
+ * @beta
12
+ */
13
+ export class EngineeringFastenersAnsi {
14
+ /**
15
+ * Gives the diameter of an ASME B18.2.8 clearance hole for a screw: close, normal or loose.
16
+ *
17
+ * Example: 1/4, normal -> 0.281 inches, a 9/32 drill
18
+ * @param inputs - The size, the fit and the unit
19
+ * @returns The hole's diameter in `unit`
20
+ * @group holes
21
+ * @shortname ansi clearance hole
22
+ * @drawable false
23
+ * @example
24
+ * ```typescript
25
+ * const hole = bitbybit.engineering.mechanical.fasteners.ansi.clearanceHole({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.in1_4, fit: Bit.Inputs.Engineering.clearanceFitEnum.normal });
26
+ * ```
27
+ */
28
+ clearanceHole(inputs) {
29
+ const resolved = resolveDto(Inputs.Engineering.AnsiClearanceHoleDto, inputs);
30
+ return snappedLength(ansiClearanceHoleDiameter(resolved.size, resolved.fit), "in", checkedUnitOfLength(resolved.unit, "unit"));
31
+ }
32
+ /**
33
+ * Gives the head of an ASME B18.3 cap screw: its diameter and height, its hexagon recess, the
34
+ * threaded length and the counterbore that sinks it.
35
+ *
36
+ * The counterbore is 0.02 deeper than the head, so the head sits below the face. Example: 1/4 ->
37
+ * head 0.375 by 0.25, a 3/16 recess, counterbore 7/16 by 0.27
38
+ * @param inputs - The size and the unit
39
+ * @returns The head's sizes in `unit`
40
+ * @group screws
41
+ * @shortname ansi cap screw sizes
42
+ * @drawable false
43
+ * @example
44
+ * ```typescript
45
+ * const head = bitbybit.engineering.mechanical.fasteners.ansi.socketHeadCapScrewSizes({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.n10 });
46
+ * ```
47
+ */
48
+ socketHeadCapScrewSizes(inputs) {
49
+ const resolved = resolveDto(Inputs.Engineering.AnsiSizeDto, inputs);
50
+ return lengthsConverted(ansiSocketHeadCapScrewSizes(resolved.size), SCREW_HEAD_LENGTHS, "in", checkedUnitOfLength(resolved.unit, "unit"));
51
+ }
52
+ /**
53
+ * Gives an ASME B18.2.1 hex cap screw's width across flats, head height and threaded length.
54
+ *
55
+ * A screw up to 6 inches long is threaded twice its diameter and a quarter of an inch, a longer
56
+ * one half an inch more. Example: 1/4, 1 inch long -> 7/16 across flats, 0.75 threaded
57
+ * @param inputs - The size, the length and the unit
58
+ * @returns The screw's sizes in `unit`
59
+ * @group screws
60
+ * @shortname ansi hex bolt sizes
61
+ * @drawable false
62
+ * @example
63
+ * ```typescript
64
+ * const bolt = bitbybit.engineering.mechanical.fasteners.ansi.hexBoltSizes({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.in3_8, length: 1.5 });
65
+ * ```
66
+ */
67
+ hexBoltSizes(inputs) {
68
+ const resolved = resolveDto(Inputs.Engineering.AnsiHexBoltSizesDto, inputs);
69
+ const unit = checkedUnitOfLength(resolved.unit, "unit");
70
+ return lengthsConverted(ansiHexBoltSizes(resolved.size, tableLength(resolved.length, unit, "in")), HEX_BOLT_LENGTHS, "in", unit);
71
+ }
72
+ /**
73
+ * Gives an ASME hex nut: a B18.6.3 machine screw nut from #0 to #12, a B18.2.2 hex nut from 1/4
74
+ * up, as its width across flats and its height.
75
+ *
76
+ * Example: 1/4 -> 7/16 across flats, 7/32 high
77
+ * @param inputs - The size and the unit
78
+ * @returns The nut's sizes in `unit`
79
+ * @group nuts and washers
80
+ * @shortname ansi hex nut sizes
81
+ * @drawable false
82
+ * @example
83
+ * ```typescript
84
+ * const nut = bitbybit.engineering.mechanical.fasteners.ansi.hexNutSizes({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.in1_4 });
85
+ * ```
86
+ */
87
+ hexNutSizes(inputs) {
88
+ const resolved = resolveDto(Inputs.Engineering.AnsiSizeDto, inputs);
89
+ return lengthsConverted(ansiHexNutSizes(resolved.size), HEX_NUT_LENGTHS, "in", checkedUnitOfLength(resolved.unit, "unit"));
90
+ }
91
+ /**
92
+ * Gives an ASME B18.22.1 type A plain washer, narrow or wide: its inner and outer diameters and
93
+ * its thickness.
94
+ *
95
+ * The table starts at #6, which takes one washer in both series. Example: 1/4 narrow -> 0.281
96
+ * inside, 0.625 outside, 0.065 thick
97
+ * @param inputs - The size, the series and the unit
98
+ * @returns The washer's sizes in `unit`
99
+ * @group nuts and washers
100
+ * @shortname ansi washer sizes
101
+ * @drawable false
102
+ * @example
103
+ * ```typescript
104
+ * const washer = bitbybit.engineering.mechanical.fasteners.ansi.washerSizes({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.in1_4, series: Bit.Inputs.Engineering.ansiWasherSeriesEnum.wide });
105
+ * ```
106
+ */
107
+ washerSizes(inputs) {
108
+ const resolved = resolveDto(Inputs.Engineering.AnsiWasherSizesDto, inputs);
109
+ return lengthsConverted(ansiWasherSizes(resolved.size, resolved.series), WASHER_LENGTHS, "in", checkedUnitOfLength(resolved.unit, "unit"));
110
+ }
111
+ /**
112
+ * Gives an ASME B18.3 set screw by its size and point: its hexagon recess's size and least depth,
113
+ * and the point's diameter, length, angle and, for an oval point, radius.
114
+ *
115
+ * A screw shorter than its point's shortest long screw takes the shallower recess makers give it,
116
+ * and a short cone is blunter, 118 degrees.
117
+ * @param inputs - The size, the point, the thread series, the length and the unit
118
+ * @returns The sizes in `unit` and the point's angle in degrees
119
+ * @group screws
120
+ * @shortname ansi set screw sizes
121
+ * @drawable false
122
+ * @example
123
+ * ```typescript
124
+ * const grub = bitbybit.engineering.mechanical.fasteners.ansi.setScrewSizes({ size: Bit.Inputs.Engineering.ansiThreadSizeEnum.in1_4, point: Bit.Inputs.Engineering.ansiSetScrewPointEnum.halfDog, length: 0.5 });
125
+ * ```
126
+ */
127
+ setScrewSizes(inputs) {
128
+ const resolved = resolveDto(Inputs.Engineering.AnsiSetScrewSizesDto, inputs);
129
+ const unit = checkedUnitOfLength(resolved.unit, "unit");
130
+ const length = resolved.length === undefined ? undefined : tableLength(resolved.length, unit, "in");
131
+ return lengthsConverted(ansiSetScrewSizes(resolved.size, resolved.point, resolved.series, length), SET_SCREW_LENGTHS, "in", unit);
132
+ }
133
+ }