@willcgage/module-schematic 0.69.0 → 0.70.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 CHANGED
@@ -485,9 +485,10 @@ function moduleFootprint(input) {
485
485
  return {
486
486
  centerline,
487
487
  band: benchworkBand(centerline, widthA, widthB, offA, offB),
488
- // A loop's centre-line ends at the throat, not a far endplate — keep only
489
- // endplate A's face (the far face would be a spurious plate at the throat).
490
- endplateFaces: input.loop ? endplateFaceSegments(centerline, widthA, widthB, offA, offB).slice(0, 1) : endplateFaceSegments(centerline, widthA, widthB, offA, offB),
488
+ // Only emit a face where the module actually presents one. A loop's
489
+ // centre-line ends at the THROAT, and an end of the line / pocket simply
490
+ // stops a far face there is a plate the module hasn't got (#191).
491
+ endplateFaces: hasNoFarEndplate(input) ? endplateFaceSegments(centerline, widthA, widthB, offA, offB).slice(0, 1) : endplateFaceSegments(centerline, widthA, widthB, offA, offB),
491
492
  outline: sectionOutlines.length || !authored ? null : sampleBenchworkOutline(authored),
492
493
  // The donut hole, arc-sampled — only when there's a solid outline to punch it
493
494
  // out of (a sectioned module isn't a donut). Renderers cut it from `outline`.
@@ -533,6 +534,9 @@ function endplateWidthFor(widths, id) {
533
534
  const w = widths?.[id];
534
535
  return typeof w === "number" && w > 0 ? w : FREEMO_ENDPLATE_WIDTH_RECOMMENDED_INCHES;
535
536
  }
537
+ function hasNoFarEndplate(input) {
538
+ return input.geometryType === "dead_end" || input.loop === true || input.endplateConfigs?.[1] === "none";
539
+ }
536
540
  function isLoopDoc(doc) {
537
541
  return doc.loop === true;
538
542
  }
@@ -1993,7 +1997,7 @@ function deriveEndplatePoses(geo) {
1993
1997
  trackOffsets: offsetsFor(cfg(0), half)
1994
1998
  })
1995
1999
  );
1996
- const noB = geo.geometryType === "dead_end" || geo.loop === true || geo.endplateConfigs?.[1] === "none";
2000
+ const noB = hasNoFarEndplate(geo);
1997
2001
  const end = sectionedEndPose({ sections: geo.sections });
1998
2002
  if (!noB && end) {
1999
2003
  poses.push(
@@ -2182,6 +2186,7 @@ exports.frogCasting = frogCasting;
2182
2186
  exports.frogNumberFromName = frogNumberFromName;
2183
2187
  exports.fromSectionRelative = fromSectionRelative;
2184
2188
  exports.geometryTurnDegrees = geometryTurnDegrees;
2189
+ exports.hasNoFarEndplate = hasNoFarEndplate;
2185
2190
  exports.importedPartToTrackPart = importedPartToTrackPart;
2186
2191
  exports.inchesToScaleFeet = inchesToScaleFeet;
2187
2192
  exports.isLoopDoc = isLoopDoc;