enable per-shape repetitions
This commit is contained in:
parent
ad6fa88e53
commit
629a6a9ba2
9 changed files with 75 additions and 5 deletions
|
|
@ -6,6 +6,7 @@ from numpy import pi
|
|||
|
||||
from . import Shape, Polygon, normalized_shape_tuple, DEFAULT_POLY_NUM_POINTS
|
||||
from .. import PatternError
|
||||
from ..repetition import Repetition
|
||||
from ..utils import is_scalar, vector2, layer_t, AutoSlots
|
||||
|
||||
|
||||
|
|
@ -158,6 +159,7 @@ class Arc(Shape, metaclass=AutoSlots):
|
|||
mirrored: Sequence[bool] = (False, False),
|
||||
layer: layer_t = 0,
|
||||
dose: float = 1.0,
|
||||
repetition: Optional[Repetition] = None,
|
||||
locked: bool = False):
|
||||
object.__setattr__(self, 'locked', False)
|
||||
self.identifier = ()
|
||||
|
|
@ -171,6 +173,7 @@ class Arc(Shape, metaclass=AutoSlots):
|
|||
self.dose = dose
|
||||
self.poly_num_points = poly_num_points
|
||||
self.poly_max_arclen = poly_max_arclen
|
||||
self.repetition = repetition
|
||||
self.locked = locked
|
||||
|
||||
def __deepcopy__(self, memo: Dict = None) -> 'Arc':
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from numpy import pi
|
|||
|
||||
from . import Shape, Polygon, normalized_shape_tuple, DEFAULT_POLY_NUM_POINTS
|
||||
from .. import PatternError
|
||||
from ..repetition import Repetition
|
||||
from ..utils import is_scalar, vector2, layer_t, AutoSlots
|
||||
|
||||
|
||||
|
|
@ -46,6 +47,7 @@ class Circle(Shape, metaclass=AutoSlots):
|
|||
offset: vector2 = (0.0, 0.0),
|
||||
layer: layer_t = 0,
|
||||
dose: float = 1.0,
|
||||
repetition: Optional[Repetition] = None,
|
||||
locked: bool = False):
|
||||
object.__setattr__(self, 'locked', False)
|
||||
self.identifier = ()
|
||||
|
|
@ -55,6 +57,7 @@ class Circle(Shape, metaclass=AutoSlots):
|
|||
self.radius = radius
|
||||
self.poly_num_points = poly_num_points
|
||||
self.poly_max_arclen = poly_max_arclen
|
||||
self.repetition = repetition
|
||||
self.locked = locked
|
||||
|
||||
def __deepcopy__(self, memo: Dict = None) -> 'Circle':
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from numpy import pi
|
|||
|
||||
from . import Shape, Polygon, normalized_shape_tuple, DEFAULT_POLY_NUM_POINTS
|
||||
from .. import PatternError
|
||||
from ..repetition import Repetition
|
||||
from ..utils import is_scalar, rotation_matrix_2d, vector2, layer_t, AutoSlots
|
||||
|
||||
|
||||
|
|
@ -93,6 +94,7 @@ class Ellipse(Shape, metaclass=AutoSlots):
|
|||
mirrored: Sequence[bool] = (False, False),
|
||||
layer: layer_t = 0,
|
||||
dose: float = 1.0,
|
||||
repetition: Optional[Repetition] = None,
|
||||
locked: bool = False):
|
||||
object.__setattr__(self, 'locked', False)
|
||||
self.identifier = ()
|
||||
|
|
@ -104,6 +106,7 @@ class Ellipse(Shape, metaclass=AutoSlots):
|
|||
self.dose = dose
|
||||
self.poly_num_points = poly_num_points
|
||||
self.poly_max_arclen = poly_max_arclen
|
||||
self.repetition = repetition
|
||||
self.locked = locked
|
||||
|
||||
def __deepcopy__(self, memo: Dict = None) -> 'Ellipse':
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from numpy import pi, inf
|
|||
|
||||
from . import Shape, normalized_shape_tuple, Polygon, Circle
|
||||
from .. import PatternError
|
||||
from ..repetition import Repetition
|
||||
from ..utils import is_scalar, rotation_matrix_2d, vector2, layer_t, AutoSlots
|
||||
from ..utils import remove_colinear_vertices, remove_duplicate_vertices
|
||||
|
||||
|
|
@ -147,6 +148,7 @@ class Path(Shape, metaclass=AutoSlots):
|
|||
mirrored: Sequence[bool] = (False, False),
|
||||
layer: layer_t = 0,
|
||||
dose: float = 1.0,
|
||||
repetition: Optional[Repetition] = None,
|
||||
locked: bool = False,
|
||||
):
|
||||
object.__setattr__(self, 'locked', False)
|
||||
|
|
@ -163,6 +165,7 @@ class Path(Shape, metaclass=AutoSlots):
|
|||
self.cap_extensions = cap_extensions
|
||||
self.rotate(rotation)
|
||||
[self.mirror(a) for a, do in enumerate(mirrored) if do]
|
||||
self.repetition = repetition
|
||||
self.locked = locked
|
||||
|
||||
def __deepcopy__(self, memo: Dict = None) -> 'Path':
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from numpy import pi
|
|||
|
||||
from . import Shape, normalized_shape_tuple
|
||||
from .. import PatternError
|
||||
from ..repetition import Repetition
|
||||
from ..utils import is_scalar, rotation_matrix_2d, vector2, layer_t, AutoSlots
|
||||
from ..utils import remove_colinear_vertices, remove_duplicate_vertices
|
||||
|
||||
|
|
@ -75,6 +76,7 @@ class Polygon(Shape, metaclass=AutoSlots):
|
|||
mirrored: Sequence[bool] = (False, False),
|
||||
layer: layer_t = 0,
|
||||
dose: float = 1.0,
|
||||
repetition: Optional[Repetition] = None,
|
||||
locked: bool = False,
|
||||
):
|
||||
object.__setattr__(self, 'locked', False)
|
||||
|
|
@ -85,6 +87,7 @@ class Polygon(Shape, metaclass=AutoSlots):
|
|||
self.offset = offset
|
||||
self.rotate(rotation)
|
||||
[self.mirror(a) for a, do in enumerate(mirrored) if do]
|
||||
self.repetition = repetition
|
||||
self.locked = locked
|
||||
|
||||
def __deepcopy__(self, memo: Optional[Dict] = None) -> 'Polygon':
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from ..error import PatternError, PatternLockedError
|
|||
from ..utils import is_scalar, rotation_matrix_2d, vector2, layer_t
|
||||
from ..traits import (PositionableImpl, LayerableImpl, DoseableImpl,
|
||||
Rotatable, Mirrorable, Copyable, Scalable,
|
||||
PivotableImpl, LockableImpl)
|
||||
PivotableImpl, LockableImpl, RepeatableImpl)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from . import Polygon
|
||||
|
|
@ -26,7 +26,8 @@ DEFAULT_POLY_NUM_POINTS = 24
|
|||
T = TypeVar('T', bound='Shape')
|
||||
|
||||
|
||||
class Shape(PositionableImpl, LayerableImpl, DoseableImpl, Rotatable, Mirrorable, Copyable, Scalable, PivotableImpl, LockableImpl, metaclass=ABCMeta):
|
||||
class Shape(PositionableImpl, LayerableImpl, DoseableImpl, Rotatable, Mirrorable, Copyable, Scalable,
|
||||
PivotableImpl, RepeatableImpl, LockableImpl, metaclass=ABCMeta):
|
||||
"""
|
||||
Abstract class specifying functions common to all shapes.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from numpy import pi, inf
|
|||
|
||||
from . import Shape, Polygon, normalized_shape_tuple
|
||||
from .. import PatternError
|
||||
from ..repetition import Repetition
|
||||
from ..traits import RotatableImpl
|
||||
from ..utils import is_scalar, vector2, get_bit, normalize_mirror, layer_t, AutoSlots
|
||||
|
||||
|
|
@ -65,6 +66,7 @@ class Text(RotatableImpl, Shape, metaclass=AutoSlots):
|
|||
mirrored: Tuple[bool, bool] = (False, False),
|
||||
layer: layer_t = 0,
|
||||
dose: float = 1.0,
|
||||
repetition: Optional[Repetition] = None,
|
||||
locked: bool = False,
|
||||
):
|
||||
object.__setattr__(self, 'locked', False)
|
||||
|
|
@ -77,6 +79,7 @@ class Text(RotatableImpl, Shape, metaclass=AutoSlots):
|
|||
self.rotation = rotation
|
||||
self.font_path = font_path
|
||||
self.mirrored = mirrored
|
||||
self.repetition = repetition
|
||||
self.locked = locked
|
||||
|
||||
def __deepcopy__(self, memo: Dict = None) -> 'Text':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue