add polygon() and label() convenience methods

master
Jan Petykiewicz 1 year ago committed by jan
parent 4482ede3a7
commit 45081c2d31

@ -540,6 +540,21 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
self.refs.append(Ref(*args, **kwargs))
return self
def polygon(self, *args: Any, **kwargs: Any) -> Self:
"""
Convenience function which constructs a `Polygon` object and adds it
to this pattern.
Args:
*args: Passed to `Polygon()`
**kwargs: Passed to `Polygon()`
Returns:
self
"""
self.shapes.append(Polygon(*args, **kwargs))
return self
def rect(self, *args: Any, **kwargs: Any) -> Self:
"""
Convenience function which calls `Polygon.rect` to construct a
@ -555,6 +570,22 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
self.shapes.append(Polygon.rect(*args, **kwargs))
return self
def label(self, *args: Any, **kwargs: Any) -> Self:
"""
Convenience function which constructs a `Label` object
and adds it to this pattern.
Args:
*args: Passed to `Label()`
**kwargs: Passed to `Label()`
Returns:
self
"""
self.labels.append(Label(*args, **kwargs))
return self
def flatten(
self,
library: Mapping[str, 'Pattern'],

Loading…
Cancel
Save