add polygon() and label() convenience methods
This commit is contained in:
parent
4482ede3a7
commit
45081c2d31
@ -540,6 +540,21 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
|
|||||||
self.refs.append(Ref(*args, **kwargs))
|
self.refs.append(Ref(*args, **kwargs))
|
||||||
return self
|
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:
|
def rect(self, *args: Any, **kwargs: Any) -> Self:
|
||||||
"""
|
"""
|
||||||
Convenience function which calls `Polygon.rect` to construct a
|
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))
|
self.shapes.append(Polygon.rect(*args, **kwargs))
|
||||||
return self
|
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(
|
def flatten(
|
||||||
self,
|
self,
|
||||||
library: Mapping[str, 'Pattern'],
|
library: Mapping[str, 'Pattern'],
|
||||||
|
Loading…
Reference in New Issue
Block a user