Skip to content

Commit

Permalink
Fix grouping issue
Browse files Browse the repository at this point in the history
Fixes #58
  • Loading branch information
MitjaNemec committed Jun 19, 2023
1 parent da0a0bc commit 62278e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions replicate_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ def prepare_for_replication(self, level, settings):
# get source drawings
logger.info("Getting source drawing items")
self.update_progress(self.stage, 5 / 6, None)
# if needed filter them by group
self.src_drawings = self.get_drawings_for_replication(self.src_bounding_box, settings)

# get all the existing groups
Expand All @@ -352,6 +351,7 @@ def prepare_for_replication(self, level, settings):
for sheet in self.dst_sheets:
dst_group_name = "Replicated Group {}".format(sheet)
# check if this group already exists
# TODO this should no be an issue as existing group can/should be used for deletion of items
if dst_group_name in g_names:
raise LookupError(f"Destination group {dst_group_name} already exists")
dst_group = pcbnew.PCB_GROUP(None)
Expand All @@ -365,9 +365,10 @@ def prepare_for_replication(self, level, settings):
dst_sheet_fps = self.get_footprints_on_sheet(sheet)
for fp in dst_sheet_fps:
fp_group = fp.fp.GetParentGroup()
if fp_group != "Replicated Group {}".format(sheet):
raise LookupError(f"Destination footprint {fp} is a member of a different group. "
f"All destination plugin have either have to be members of destination group"
dst_group = "Replicated Group {}".format(sheet)
if (fp_group is not None) and (fp_group != dst_group):

This comment has been minimized.

Copy link
@SiTLOOMS

SiTLOOMS Jun 22, 2023

Contributor

There should be a problem I think.
Only (fp_group is not None) matters.
fp_group and dst_group should never be equal and I getting an error even if the destination footprint is a member of "proper" group already. Because fp_group is <pcbnew.PCB_GROUP; proxy of <Swig Object of type 'PCB_GROUP *' at 0x000001EB4B098420> > and
dst_group is Replicated Group ['sheet_name']

This comment has been minimized.

Copy link
@MitjaNemec

MitjaNemec Jun 22, 2023

Author Owner

Again, should probably add GetName()

raise LookupError(f"Destination footprint {fp} is a member of a different group ({fp_group}). "
f"All destination plugin have either have to be members of destination group ({dst_group})"
f" or no group at all.")

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.2
2.1.3

0 comments on commit 62278e9

Please sign in to comment.