Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

2.9 KB
Raw Blame
// FrontendX4 chimera: NEMA17 motor mount, 70 x 60 x 6 mm.
//
// One ordinary part written the way the public docs (and the X0-X4 register)
// say an author should be able to write it. Every [Xn #k / Fm] tag marks a
// construct that does not build at 0a72e6f. Acceptance: this file validates,
// builds, and produces the same geometry as chimera.baseline.firmament
// (see expected.json). Do not edit this file to make it pass; fix the
// frontend, or record an explicit language decision in
// docs/development/reports/2026-10/FIRMAMENT-LANGUAGE-DECISIONS-2026-10.md and update the
// tagged line together with that decision.

Static Pitch: Length = 31mm
Static Chamfer: Length = 5mm

// [X2 #9 / F18] arithmetic on Statics inside collection entries.
Static MotorBolts: Set<Point2> {
  NE => Point2(Pitch / 2, Pitch / 2)
  NW => Point2(-Pitch / 2, Pitch / 2)
  SW => Point2(-Pitch / 2, -Pitch / 2)
  SE => Point2(Pitch / 2, -Pitch / 2)
}

// [X3 #10 / F23] array point literals mean the same as Point2(...).
Static FrameHoles: Set<Point2> {
  NE => [28mm, 23mm]
  NW => [-28mm, 23mm]
  SW => [-28mm, -23mm]
  SE => [28mm, -23mm]
}

// [X2 #21 / F19] `Top` is a planar-face reference like +Z.
Feature M3Clearance(center: Point2) -> Hole<Shaft> {
  return Hole<Shaft> { On: Top; Center: center; Diameter: 3.4mm; End: ThroughAll }
}

Feature M5Clearance(center: Point2) -> Hole<Shaft> {
  return Hole<Shaft> { On: +Z; Center: center; Diameter: 5.5mm; End: ThroughAll }
}

Model MotorMount {
  Units: mm

  // [X2 #19 / F1] a scope-local named value, consumed by the Compose interval.
  Static Thickness: Length = 6mm

  // [X3 #20 / F11] inline vertices; [X2 #9] arithmetic inside the list.
  Polygon2 Outline {
    Points: [
      [-35mm + Chamfer, -30mm], [35mm - Chamfer, -30mm], [35mm, -30mm + Chamfer],
      [35mm, 30mm - Chamfer], [35mm - Chamfer, 30mm], [-35mm + Chamfer, 30mm],
      [-35mm, 30mm - Chamfer], [-35mm, -30mm + Chamfer]
    ]
  }
  Slot2 CableSlot { Center: [0mm, -22mm]; Length: 30mm; Width: 6mm }

  Profile Stock { Loop Outer { Outline |> TraceLoop } }
  Profile SlotProfile { Loop Outer { CableSlot |> TraceLoop } }

  Compose Body {
    Base Plate { Profile: Stock; From: 0mm; To: Thickness; Role: Stock }
    // [X3 #13 / F21] a through Pocket uses Hole's termination vocabulary.
    Pocket Cable { On: Top; Profile: SlotProfile; End: ThroughAll }
  }

  Modify Body {
    // [X2 #21 / F19] face(+Z) must not switch the hole into another route;
    // [X3 #10 / F23] array literal Center.
    Hole<Shaft> Pilot { On: face(+Z); Center: [0mm, 0mm]; Diameter: 22mm; End: ThroughAll }
    Pattern Motor Over MotorBolts { p => M3Clearance(center: p) }
    // [X3 #11 / F22] generic EdgeFinish variant, Kind: kept as alias.
    EdgeFinish<Chamfer> TopBreak { Target: Stock.Outer; On: Top; Distance: 0.5mm }
  }

  // [X3 #12, #15 / F15] the documented Model-scope Pattern form; its single
  // body target is the Model's only body.
  Pattern Frame Over FrameHoles { p => M5Clearance(center: p) }
}