@willcgage/module-schematic 0.70.0 → 0.71.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/index.cjs +36 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -12
- package/dist/index.d.ts +46 -12
- package/dist/index.js +36 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -471,8 +471,12 @@ function moduleFootprint(input) {
|
|
|
471
471
|
const widthA = endplateWidthFor(input.endplateWidths, "A");
|
|
472
472
|
const widthB = endplateWidthFor(input.endplateWidths, "B");
|
|
473
473
|
const authored = benchworkOutline(input);
|
|
474
|
-
const
|
|
475
|
-
|
|
474
|
+
const offOf = (i, id) => input.endplateTrackOffsets?.[id] ?? endplateCentreOffsetInches({
|
|
475
|
+
config: input.endplateConfigs?.[i],
|
|
476
|
+
main2Below: input.mainsSwapped === true
|
|
477
|
+
});
|
|
478
|
+
const offA = offOf(0, "A");
|
|
479
|
+
const offB = offOf(1, "B");
|
|
476
480
|
const secs = input.sections ?? [];
|
|
477
481
|
const sectionsOwnShape = secs.length > 1 || secs.some((s) => (s.outline?.length ?? 0) >= 3);
|
|
478
482
|
const sectionOutlines = sectionsOwnShape ? sectionFootprints(input, {
|
|
@@ -496,13 +500,19 @@ function moduleFootprint(input) {
|
|
|
496
500
|
sectionOutlines
|
|
497
501
|
};
|
|
498
502
|
}
|
|
499
|
-
function
|
|
500
|
-
const v = -endplateTrackOffsetInches(
|
|
503
|
+
function endplateCentreOffsetInches(input) {
|
|
504
|
+
const v = -endplateTrackOffsetInches(
|
|
505
|
+
input.authoredTrackOffsetInches,
|
|
506
|
+
input.config ?? void 0,
|
|
507
|
+
input.main2Below
|
|
508
|
+
);
|
|
501
509
|
return v === 0 ? 0 : v;
|
|
502
510
|
}
|
|
503
|
-
function endplateTrackOffsetInches(authored, config) {
|
|
511
|
+
function endplateTrackOffsetInches(authored, config, main2Below = false) {
|
|
504
512
|
if (typeof authored === "number" && Number.isFinite(authored)) return authored;
|
|
505
|
-
|
|
513
|
+
if (config !== "double") return 0;
|
|
514
|
+
const half = FREEMO_TRACK_SPACING_INCHES / 2;
|
|
515
|
+
return main2Below ? half : -half;
|
|
506
516
|
}
|
|
507
517
|
function checkEndplateWidth(input) {
|
|
508
518
|
const width = endplateWidthInches(input);
|
|
@@ -514,8 +524,13 @@ function checkEndplateWidth(input) {
|
|
|
514
524
|
requiredInches: FREEMO_ENDPLATE_WIDTH_MIN_INCHES
|
|
515
525
|
});
|
|
516
526
|
}
|
|
517
|
-
const off = endplateTrackOffsetInches(
|
|
518
|
-
|
|
527
|
+
const off = endplateTrackOffsetInches(
|
|
528
|
+
input.trackOffsetInches,
|
|
529
|
+
input.config ?? void 0,
|
|
530
|
+
input.main2Below
|
|
531
|
+
);
|
|
532
|
+
const second = off + (input.main2Below ? -1 : 1) * FREEMO_TRACK_SPACING_INCHES;
|
|
533
|
+
const centres = input.config === "double" ? [off, second] : [off];
|
|
519
534
|
const worst = Math.max(...centres.map((c) => Math.abs(c)));
|
|
520
535
|
const clearance = width / 2 - worst;
|
|
521
536
|
if (clearance < FREEMO_ENDPLATE_TRACK_FASCIA_CLEARANCE_INCHES) {
|
|
@@ -526,6 +541,18 @@ function checkEndplateWidth(input) {
|
|
|
526
541
|
requiredInches: required
|
|
527
542
|
});
|
|
528
543
|
}
|
|
544
|
+
if (input.config === "double") {
|
|
545
|
+
const mid = (off + second) / 2;
|
|
546
|
+
if (Math.abs(mid) > 0.01) {
|
|
547
|
+
issues.push({
|
|
548
|
+
code: "offcentre",
|
|
549
|
+
message: `The two tracks sit ${round2(Math.abs(mid))}\u2033 off the centre of this endplate. The standard recommends they straddle it \u2014 Main 1 at ${round2((input.main2Below ? 1 : -1) * (FREEMO_TRACK_SPACING_INCHES / 2))}\u2033. Clear the offset to use that.`,
|
|
550
|
+
// Not a width problem — no wider plate fixes it — so hand back the
|
|
551
|
+
// width unchanged rather than imply one would.
|
|
552
|
+
requiredInches: width
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
}
|
|
529
556
|
return issues;
|
|
530
557
|
}
|
|
531
558
|
var round2 = (n) => Math.round(n * 100) / 100;
|
|
@@ -2177,9 +2204,9 @@ exports.deriveEndplatePoses = deriveEndplatePoses;
|
|
|
2177
2204
|
exports.divergeSideForHand = divergeSideForHand;
|
|
2178
2205
|
exports.docToState = docToState;
|
|
2179
2206
|
exports.emptyEditorState = emptyEditorState;
|
|
2207
|
+
exports.endplateCentreOffsetInches = endplateCentreOffsetInches;
|
|
2180
2208
|
exports.endplateFaceSegments = endplateFaceSegments;
|
|
2181
2209
|
exports.endplateLead = endplateLead;
|
|
2182
|
-
exports.endplateTrackOffsetFor = endplateTrackOffsetFor;
|
|
2183
2210
|
exports.endplateTrackOffsetInches = endplateTrackOffsetInches;
|
|
2184
2211
|
exports.endplateWidthInches = endplateWidthInches;
|
|
2185
2212
|
exports.frogCasting = frogCasting;
|