brepjs 18.99.5 → 18.100.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.
package/dist/brepjs.cjs CHANGED
@@ -17,7 +17,7 @@ const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
17
17
  const require_surfaceBuilders = require("./surfaceBuilders-DvpxHHIm.cjs");
18
18
  const require_solidBuilders = require("./solidBuilders-DtK5cc9v.cjs");
19
19
  const require_healingFns = require("./healingFns-CRH5H0ik.cjs");
20
- const require_threadFns = require("./threadFns-p7X2MRCA.cjs");
20
+ const require_threadFns = require("./threadFns-CNUPl-z6.cjs");
21
21
  const require_blueprintSketcher = require("./blueprintSketcher-B7QRguA5.cjs");
22
22
  const require_helpers = require("./helpers-Bykw93Yc.cjs");
23
23
  const require_drawFns = require("./drawFns-C6K03snv.cjs");
package/dist/brepjs.js CHANGED
@@ -15,7 +15,7 @@ import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayA
15
15
  import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, r as makeFace, s as assembleWire } from "./surfaceBuilders-BQx3TjMH.js";
16
16
  import { _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, m as fuse$2, p as cutAll$2, r as makeCylinder, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-cM4rOTJ5.js";
17
17
  import { A as edgesOfFace, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, F as chamferDistAngle, I as toBufferGeometryData, L as toGroupedBufferGeometryData, M as sharedEdges, N as verticesOfEdge, O as getNurbsSurfaceData, P as wiresOfFace, R as toLODGeometryData, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, c as isValid$1, d as draft$1, f as fillet$1, g as variableFillet, h as thicken$1, i as heal$1, j as facesOfEdge, k as adjacentFaces, l as solidFromShell, m as shell$1, n as fixSelfIntersection, o as healSolid, p as offset$1, r as fixShape, s as healWire, t as autoHeal, u as chamfer$1, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution, z as toLineGeometryData } from "./healingFns-jp-NXq1c.js";
18
- import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatRotate, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-YDyX33Wl.js";
18
+ import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, F as quatRotate, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, N as quatFromAxisAngle, O as prismaticJoint, P as quatFromTo, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, a as deserializeHistory, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, p as serializeHistory, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-Cdh4WOpx.js";
19
19
  import { n as BaseSketcher2d, r as organiseBlueprints, t as BlueprintSketcher } from "./blueprintSketcher-CIsOckAh.js";
20
20
  import { a as createTypedFinder, i as wireFinder, n as edgeFinder, r as faceFinder, t as getSingleFace } from "./helpers-mPnUPOIM.js";
21
21
  import { A as sketchEllipse, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-D23xqM0C.js";
@@ -10,8 +10,15 @@ export interface ThreadOptions {
10
10
  height: number;
11
11
  /** Radial thread height (crest minus root). Defaults to `0.6 * pitch` (≈ISO 60° V). */
12
12
  depth?: number;
13
- /** Axial half-width of the V tooth. Defaults to `0.42 * pitch`. */
13
+ /** Axial half-width of the tooth at the root. Defaults to `0.42 * pitch`. */
14
14
  toothHalfWidth?: number;
15
+ /**
16
+ * Axial half-width of a flat crest, giving a trapezoidal tooth instead of a
17
+ * pointed V. `0` (default) is a sharp V (ISO/UN). Use a positive value for a
18
+ * power-screw profile: `≈0.18 * pitch` ≈ Acme/trapezoidal, up near
19
+ * `toothHalfWidth` ≈ square thread. Must be `< toothHalfWidth`.
20
+ */
21
+ crest?: number;
15
22
  /** Loft sections per turn — higher is smoother but slower. Defaults to `20`. */
16
23
  sectionsPerTurn?: number;
17
24
  /** Left-handed thread. Defaults to `false` (right-handed). */
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_threadFns = require("./threadFns-p7X2MRCA.cjs");
2
+ const require_threadFns = require("./threadFns-CNUPl-z6.cjs");
3
3
  const require_loftFns = require("./loftFns-CyrWJCXb.cjs");
4
4
  exports.addChild = require_threadFns.addChild;
5
5
  exports.addJoint = require_threadFns.addJoint;
@@ -1,3 +1,3 @@
1
- import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, G as gridPattern, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, O as prismaticJoint, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-YDyX33Wl.js";
1
+ import { A as setJointValue, B as findNode, C as cylindricalJoint, D as planarJoint, E as mechanismDOF, G as gridPattern, H as updateNode, I as addChild, J as createAssembly, K as linearPattern, L as collectShapes, M as sphericalJoint, O as prismaticJoint, R as countNodes, S as addJoint, T as jointTransform, U as walkAssembly, V as removeChild, W as circularPattern, _ as exportURDF, b as inverseKinematics, c as modifyStep, d as replayFrom, f as replayHistory, g as undoLast, h as stepsFrom, i as createRegistry, j as setJointValues, k as revoluteJoint, l as registerOperation, m as stepCount, n as addStep, o as findStep, q as exportAssemblySTEP, r as createHistory, s as getShape, t as thread, u as registerShape, v as importURDF, w as forwardKinematics, x as jointTrajectory, y as jointsFromDH, z as createAssemblyNode } from "./threadFns-Cdh4WOpx.js";
2
2
  import { d as twistExtrude, l as supportExtrude, o as complexExtrude, u as sweep } from "./loftFns-CxnBxE9h.js";
3
3
  export { addChild, addJoint, addStep, circularPattern, collectShapes, complexExtrude, countNodes, createAssembly, createAssemblyNode, createHistory, createRegistry, cylindricalJoint, exportAssemblySTEP, exportURDF, findNode, findStep, forwardKinematics, getShape as getHistoryShape, gridPattern, importURDF, inverseKinematics, jointTrajectory, jointTransform, jointsFromDH, linearPattern, mechanismDOF, modifyStep, planarJoint, prismaticJoint, registerOperation, registerShape, removeChild, replayFrom, replayHistory, revoluteJoint, setJointValue, setJointValues, sphericalJoint, stepCount, stepsFrom, supportExtrude, sweep, thread, twistExtrude, undoLast, updateNode, walkAssembly };
@@ -1447,11 +1447,12 @@ function deserializeHistory(data) {
1447
1447
  function thread(options) {
1448
1448
  try {
1449
1449
  var _usingCtx$1 = require_shapeTypes._usingCtx();
1450
- const { radius, pitch, height, depth = .6 * pitch, toothHalfWidth = .42 * pitch, sectionsPerTurn = 20, lefthand = false, inward = false } = options;
1450
+ const { radius, pitch, height, depth = .6 * pitch, toothHalfWidth = .42 * pitch, crest = 0, sectionsPerTurn = 20, lefthand = false, inward = false } = options;
1451
1451
  if (!(radius > 0)) return require_errors.err(require_errors.validationError("THREAD_INVALID_RADIUS", "radius must be > 0"));
1452
1452
  if (!(pitch > 0)) return require_errors.err(require_errors.validationError("THREAD_INVALID_PITCH", "pitch must be > 0"));
1453
1453
  if (!(height > 0)) return require_errors.err(require_errors.validationError("THREAD_INVALID_HEIGHT", "height must be > 0"));
1454
1454
  if (!(depth > 0)) return require_errors.err(require_errors.validationError("THREAD_INVALID_DEPTH", "depth must be > 0"));
1455
+ if (crest < 0 || crest >= toothHalfWidth) return require_errors.err(require_errors.validationError("THREAD_INVALID_CREST", "crest must be >= 0 and < toothHalfWidth"));
1455
1456
  if (sectionsPerTurn < 3) return require_errors.err(require_errors.validationError("THREAD_TOO_FEW_SECTIONS", "sectionsPerTurn must be >= 3"));
1456
1457
  const turns = height / pitch;
1457
1458
  const nSec = Math.max(2, Math.round(turns * sectionsPerTurn));
@@ -1473,14 +1474,17 @@ function thread(options) {
1473
1474
  cy + u * ry,
1474
1475
  z + v
1475
1476
  ];
1476
- const p1 = pt(baseU, -a);
1477
- const apex = pt(apexU, 0);
1478
- const p3 = pt(baseU, a);
1479
- const w = require_primitiveFns.wire([
1480
- scope.register(require_primitiveFns.line(p1, apex)),
1481
- scope.register(require_primitiveFns.line(apex, p3)),
1482
- scope.register(require_primitiveFns.line(p3, p1))
1483
- ]);
1477
+ const profile = crest > 0 ? [
1478
+ pt(baseU, -a),
1479
+ pt(apexU, -crest),
1480
+ pt(apexU, crest),
1481
+ pt(baseU, a)
1482
+ ] : [
1483
+ pt(baseU, -a),
1484
+ pt(apexU, 0),
1485
+ pt(baseU, a)
1486
+ ];
1487
+ const w = require_primitiveFns.wire(profile.map((p, k) => scope.register(require_primitiveFns.line(p, profile[(k + 1) % profile.length]))));
1484
1488
  if (!require_errors.isOk(w)) return w;
1485
1489
  sections.push(scope.register(w.value));
1486
1490
  }
@@ -1447,11 +1447,12 @@ function deserializeHistory(data) {
1447
1447
  function thread(options) {
1448
1448
  try {
1449
1449
  var _usingCtx$1 = _usingCtx();
1450
- const { radius, pitch, height, depth = .6 * pitch, toothHalfWidth = .42 * pitch, sectionsPerTurn = 20, lefthand = false, inward = false } = options;
1450
+ const { radius, pitch, height, depth = .6 * pitch, toothHalfWidth = .42 * pitch, crest = 0, sectionsPerTurn = 20, lefthand = false, inward = false } = options;
1451
1451
  if (!(radius > 0)) return err(validationError("THREAD_INVALID_RADIUS", "radius must be > 0"));
1452
1452
  if (!(pitch > 0)) return err(validationError("THREAD_INVALID_PITCH", "pitch must be > 0"));
1453
1453
  if (!(height > 0)) return err(validationError("THREAD_INVALID_HEIGHT", "height must be > 0"));
1454
1454
  if (!(depth > 0)) return err(validationError("THREAD_INVALID_DEPTH", "depth must be > 0"));
1455
+ if (crest < 0 || crest >= toothHalfWidth) return err(validationError("THREAD_INVALID_CREST", "crest must be >= 0 and < toothHalfWidth"));
1455
1456
  if (sectionsPerTurn < 3) return err(validationError("THREAD_TOO_FEW_SECTIONS", "sectionsPerTurn must be >= 3"));
1456
1457
  const turns = height / pitch;
1457
1458
  const nSec = Math.max(2, Math.round(turns * sectionsPerTurn));
@@ -1473,14 +1474,17 @@ function thread(options) {
1473
1474
  cy + u * ry,
1474
1475
  z + v
1475
1476
  ];
1476
- const p1 = pt(baseU, -a);
1477
- const apex = pt(apexU, 0);
1478
- const p3 = pt(baseU, a);
1479
- const w = wire([
1480
- scope.register(line(p1, apex)),
1481
- scope.register(line(apex, p3)),
1482
- scope.register(line(p3, p1))
1483
- ]);
1477
+ const profile = crest > 0 ? [
1478
+ pt(baseU, -a),
1479
+ pt(apexU, -crest),
1480
+ pt(apexU, crest),
1481
+ pt(baseU, a)
1482
+ ] : [
1483
+ pt(baseU, -a),
1484
+ pt(apexU, 0),
1485
+ pt(baseU, a)
1486
+ ];
1487
+ const w = wire(profile.map((p, k) => scope.register(line(p, profile[(k + 1) % profile.length]))));
1484
1488
  if (!isOk(w)) return w;
1485
1489
  sections.push(scope.register(w.value));
1486
1490
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs",
3
- "version": "18.99.5",
3
+ "version": "18.100.0",
4
4
  "description": "Web CAD library with pluggable geometry kernel",
5
5
  "keywords": [
6
6
  "cad",