feat(utils): renameWinding — rename a winding and propagate name-based references - #15
Open
gpitel wants to merge 1 commit into
Open
feat(utils): renameWinding — rename a winding and propagate name-based references#15gpitel wants to merge 1 commit into
gpitel wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
renameWinding(mas, windingIndex, newName)toassets/js/utils.js: renames a winding'sfunctionalDescription[i].nameand propagates the new name to every name-based reference:groupsDescription/sectionsDescription/layersDescription→partialWindings[].windingturnsDescription[].windingbobbin.functionalDescription.connections[].windingFor 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].namealone 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'sWebSharedComponentssubmodule 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).