Skip to content

Destination group check compares PCB_GROUP to string → ReplicateLayout fails when destination footprints are grouped #86

@kerby2000

Description

@kerby2000

Environment

  • KiCad: 9.0.5 (Windows)
  • ReplicateLayout: 4.0.3 (installed via PCM)

Steps to reproduce

  1. Have a project with a repeated hierarchical sheet (multiple instances of the same sheet file).
  2. Place and route the “source” sheet instance.
  3. Ensure the destination sheet instance footprints are in a group, e.g.:
    • Run ReplicateLayout once with “Group layouts” enabled (so it groups the destination), OR
    • Manually group destination footprints in PCB Editor (select → Ctrl+G).
  4. Run ReplicateLayout again targeting that destination instance.

Actual result

  • Plugin errors with something like:
    “Destination footprint ... is a member of a different group (... PCB_GROUP ...). All destination footprints have to be members of destination group (...) or no group at all.”

Expected result

  • If a destination footprint is already in the correct destination group, ReplicateLayout should not error.
  • If “Group layouts” is disabled, destination footprints being grouped should not block replication.

Root cause

  • In replicate_layout.py the code compares a pcbnew.PCB_GROUP object from GetParentGroup() to a string group name.
    This makes the “different group” condition true for any footprint that is in any group (including the correct one).
  • Similar object-vs-string mismatch exists when adding destination footprints to the destination group.

Proposed fix

  • Compare via fp_group.GetName() (and handle None) instead of comparing the object to a string.
  • Only enforce destination grouping rules when group_layouts is enabled.
  • Optionally reuse existing “Replicated Group …” groups instead of erroring if they already exist (useful for reruns/updates).

Proposed Fixed with ChatGPT 5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions