From c14daf2e5e0b72e09556649415e64aebd1f25027 Mon Sep 17 00:00:00 2001 From: jan Date: Sat, 14 Apr 2018 15:20:39 -0700 Subject: [PATCH] Fix GDS AREF handling --- masque/file/gdsii.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/masque/file/gdsii.py b/masque/file/gdsii.py index 17921a6..6d1fcb0 100644 --- a/masque/file/gdsii.py +++ b/masque/file/gdsii.py @@ -301,8 +301,17 @@ def read(filename: str, pat.subpatterns.append(ref_element_to_subpat(element, element.xy)) elif isinstance(element, gdsii.elements.ARef): - for offset in element.xy: - pat.subpatterns.append(ref_element_to_subpat(element, offset)) + xy = numpy.array(element.xy) + origin = xy[0] + col_spacing = (xy[1] - origin) / element.cols + row_spacing = (xy[2] - origin) / element.rows + + print(element.xy) + for c in range(element.cols): + for r in range(element.rows): + offset = origin + c * col_spacing + r * row_spacing + pat.subpatterns.append(ref_element_to_subpat(element, offset)) + patterns.append(pat) # Create a dict of {pattern.name: pattern, ...}, then fix up all subpattern.pattern entries