fix(schematic): update every placed component unit - #273
Open
nordic-style wants to merge 1 commit into
Open
Conversation
Reference-only component mutations selected the first matching symbol block, so deleting left orphan units behind while moving, rotating, editing, annotating, grouping, and replacing tore one logical component into inconsistent placements. Apply shared mutations to every placed unit, preserve relative placement and rotation, target region moves by UUID, aggregate component and pin-location reads, and reject ambiguous unit overrides before writing. Shared property edits now escape values and repair partially populated legacy units in one revision-aware command. Refs mixelpixx#182
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
move_regionplacements by UUID so selecting unit 2 never moves unit 1Refs #182
Approach
A reference designator identifies one logical component, but KiCad stores a multi-unit component as one top-level symbol block per placed unit. Every reference-based component operation now resolves the complete block/placement set. Component-wide moves use the lowest-numbered unit as the requested anchor and apply its snapped delta to the other units; rotation follows the same rule so relative orientation is preserved.
Shared properties are built as one edit set against the original document revision. Existing copies are updated everywhere, missing custom-field copies are repaired per unit, and all user text is escaped before insertion or replacement. Reference renames update both rendered properties and every netlist
instancespath.Component replacement validates all preserved unit numbers against the new symbol, updates every
lib_id, and writes once. Supplying a singleunitfor a reference with multiple placements is rejected before any write because the request is ambiguous.This is the mutation half of #182. #272 covers analysis/export/validation/review call sites; #267 covers the additional intentional-NC and power-pin behavior in
validate_component_connections.Compatibility and safety
move_schematic_componentandrotate_schematic_componentnow operate on the logical component instead of silently changing only the first block.get_schematic_componentand pin-location tools now include every placement; the original top-level position remains the lowest-numbered unit's anchor.replace_component.unitis intentionally rejected for multi-placement references; omit it to preserve every existing unit.51c8f60.Validation
cargo test --workspace --locked --lib --tests: all suites pass except the same three pre-existing localupdate_symbols_from_library_*failures caused by the installed KiCadDevice:Rlibrary shadowing the test fixture;konnect-corereaches 554/557 passing testscargo test --workspace --locked --doc: passcargo clippy --workspace --locked --all-targets -- -D warnings: passcargo fmt --all -- --check: pass