Skip to content

feat(utils): renameWinding — rename a winding and propagate name-based references - #15

Open
gpitel wants to merge 1 commit into
OpenMagnetics:mainfrom
gpitel:feat/rename-winding-helper
Open

feat(utils): renameWinding — rename a winding and propagate name-based references#15
gpitel wants to merge 1 commit into
OpenMagnetics:mainfrom
gpitel:feat/rename-winding-helper

Conversation

@gpitel

@gpitel gpitel commented Jul 16, 2026

Copy link
Copy Markdown

Summary

Adds renameWinding(mas, windingIndex, newName) to assets/js/utils.js: renames a winding's functionalDescription[i].name and propagates the new name to every name-based reference:

  • groupsDescription / sectionsDescription / layersDescriptionpartialWindings[].winding
  • turnsDescription[].winding
  • bobbin.functionalDescription.connections[].winding

For a single-winding coil it resyncs all references regardless of the old name, which also repairs coils whose construction was desynced by a rename made before this helper existed.

Why

Renaming functionalDescription[i].name alone leaves construction references dangling, breaking name-matched derived views (e.g. the Summary's Winding Construction Steps).

Merge order / dependencies

No dependencies — purely additive export, safe to merge anytime.

Required by OpenMagnetics/WebFrontend#24, which imports renameWinding; #24 must not merge (nor WebFrontend's WebSharedComponents submodule pin advance onto it) until this is in, or the import fails at load time.

It mirrors the local propagation in OpenMagnetics/MagneticBuilderApp#4's editor, so the two rename paths behave identically (a later cleanup can have that component delegate to this helper).

…me references

MAS references windings by name (construction partialWindings, turns
description, bobbin connections), so renaming functionalDescription[i].name
alone leaves those references dangling and breaks name-matched derived views
(e.g. the Summary's Winding Construction Steps). renameWinding(mas,
windingIndex, newName) renames the winding and updates every reference; for a
single-winding coil it resyncs all references, which also repairs coils
desynced by renames made before this helper existed.

Needed by OpenMagnetics/WebFrontend#24, which imports it to make the Design
Requirements winding-label edit rename-safe. Mirrors the propagation in
OpenMagnetics/MagneticBuilderApp#4's Wire Configuration editor so the two
rename paths behave identically.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant