Skip to content

feat: add DIN rail (TH35) mount option#40

Open
vZhurbenko wants to merge 1 commit into
bruceborrett:mainfrom
vZhurbenko:worktree-din-rail-mount
Open

feat: add DIN rail (TH35) mount option#40
vZhurbenko wants to merge 1 commit into
bruceborrett:mainfrom
vZhurbenko:worktree-din-rail-mount

Conversation

@vZhurbenko

Copy link
Copy Markdown

Summary

Closes #37

Adds a parametric TH35 top-hat rail mount as a second, independent toggle inside the existing Wall Mounts section (renamed to Mounting). The mount is a slotted boss that protrudes from the chosen enclosure face with a trapezoidal undercut channel cut through it, so a standard 35 mm top-hat rail slides in end-on and is retained by the narrower mouth.

The existing wallMounts flag is left untouched — wall flanges and the DIN boss are independent and can be active simultaneously.

What is new

  • src/app/core/enclosure/dinrail.ts — new geometry module (channel + boss + placement).
  • src/app/core/enclosure/dinrail.spec.ts — 7 Jasmine specs covering defaults, protrusion, placement (bottom/back), channel cuts volume, coexistence with wall mounts, and undercut retention.
  • src/app/core/params.ts — 6 new params (dinRailMount, dinRailSurface, dinRailWidth, dinRailCrownWidth, dinRailDepth, dinRailLength) + TH35 defaults.
  • src/app/core/enclosure/base.ts — extra if (params.dinRailMount) branch alongside the existing wallMounts branch.
  • src/app/features/renderer/renderer.component.ts — the 6 DIN params added to baseDeps.
  • src/app/features/params/params-form.component.{html,ts,css} — accordion renamed to Mounting; new DIN toggle group (Surface select, Rail Width, Crown Width, Rail Depth, Slot Length number inputs); checkboxes forced onto their own full-width row.
  • src/app/core/state/enclosure-state.service.tsresetToSimpleEnclosure now also resets dinRailMount.
  • README.md — feature ticked off.

Design notes

  • TH35 defaults: brim/base width 35, crown/top width 27, height 8.5. All four numbers are exposed as user inputs for non-TH35 rails (TH35-15, asymmetric rails, etc.).
  • Mechanism: rail slides in end-on; no spring/snap. Channel cross-section is built as hull(two thin Z-slabs) — the same idiom already used by wallmount.ts and utils.ts: roundedCube.
  • Retention via undercut: mouth width = crown + clearance (27.5), chamber width = brim + clearance (35.5). The wider brim cannot pass back through the narrower mouth — a snap-in fit.
  • Placement: bottom (default) and back. Each mode has its own translate/rotate so the channel exits to the correct face.
  • Independent of wallMounts: flanges live on the left/right walls; the DIN boss lives on the bottom (or back) face — no geometric overlap.
  • Defaults preserved: wallMounts stays at its current default; dinRailMount is opt-in (off by default) per the issue acceptance criteria.

Verification

  • npm test28/28 SUCCESS (7 new + 21 existing).
  • npm start → toggling Wall and DIN Rail independently and together in the Mounting accordion updates the live preview; switching Surface (with Height ≥ ~39 for Back) re-renders correctly; tweaking Rail Width / Crown Width / Depth / Length updates the slot.
  • npm run format (prettier) — clean.
  • npm run build — clean.

Coded with AI

Adds a parametric TH35 top-hat rail mount as a second, independent toggle
inside the existing Wall Mounts section (renamed to "Mounting"). The mount
is a slotted boss that protrudes from the chosen enclosure face (default:
bottom; alternative: back) with a trapezoidal undercut channel cut through
it, so a standard 35 mm top-hat rail slides in end-on and is retained by
the narrow mouth.

- New geometry module: src/app/core/enclosure/dinrail.ts (channel
  + boss, surface placement)
- 6 new Params fields + DEFAULT_PARAMS entries (TH35 defaults:
  width 35, crown 27, depth 8.5, length 60)
- Mounting accordion: independent Wall + DIN toggles, Surface select,
  Rail Width / Crown Width / Rail Depth / Slot Length number inputs
- Independent of wallMounts: both can be active simultaneously
- README.md: tick off "Din rail mounts"
- dinrail.spec.ts: 7 Jasmine specs covering defaults, protrusion,
  placement (bottom/back), channel cuts volume, coexistence with wall
  mounts, and undercut retention

Closes bruceborrett#37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement DIN rail mount feature

1 participant