Skip to content

Commit

Permalink
Allow multiple children cells with equal names
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeutel committed Dec 28, 2020
1 parent 758e6d1 commit 033eb80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions gdshelpers/geometry/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,13 @@ def get_desc(self):
"""
def walk_cells(cell, out_dict):
if cell.name not in out_dict:
out_dict[cell.name] = {
'cells': {child['cell'].name: dict(offset=tuple(child['origin']),
angle=child['angle'] or 0) for child in cell.cells},
**cell.desc
}
cellrefs = []
for child in cell.cells:
child_dict = child.copy()
child_dict['cell'] = child_dict['cell'].name
cellrefs.append(child_dict)

out_dict[cell.name] = {'cells': cellrefs, **cell.desc}

for child in cell.cells:
walk_cells(child['cell'], out_dict)
Expand Down
1 change: 1 addition & 0 deletions gdshelpers/tests/test_chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,4 @@ def test_desc(self):
self.assertTrue("desctest" in d["cells"])
self.assertEqual("desctest", d["root"])
self.assertEqual(2, len(d["cells"]["desctest"]["cells"]))
self.assertEqual("child1", d["cells"]["desctest"]["cells"][0]["cell"])

0 comments on commit 033eb80

Please sign in to comment.