Label¶
- class photonforge.Label(text='', origin=(0, 0), anchor='NW', rotation=0, scaling=1, x_reflection=False)¶
Text label.
- Parameters:
text (str) – Label text.
origin (Sequence[float] | complex) – Label position.
anchor (Literal["NW", "N", "NE", "W", "O", "E", "SW", "S", "SE"]) – Anchor point for text alignment.
rotation (float) – Rotation (in degrees) of this label.
scaling (float) – Label scaling factor.
x_reflection (bool) – Flag controlling mirroring across the x axis.
Methods
add_gds_property
(value)Add a custom property to this object compatible with GDSII files.
copy
()Create a copy of this label.
mirror
([axis_endpoint, axis_origin])Mirror this label.
rotate
(rotation[, center])Rotate this label around a specific center.
scale
(scaling[, center])Scale this label.
transform
([translation, rotation, scaling, ...])Apply a transformation to this label:
self = translate(rotate(mirror(scale(self))))
translate
(translation)Translate this label.
Attributes
Label anchor.
Label origin.
Object properties.
Label rotation.
Label scaling.
Label text.
Label x_reflection.
- add_gds_property(value)¶
Add a custom property to this object compatible with GDSII files.
- Parameters:
attribute (int) – Property number.
value (str) – Property value.
- anchor¶
Label anchor.
- Type:
Literal[‘NW’, ‘N’, ‘NE’, ‘W’, ‘O’, ‘E’, ‘SW’, ‘S’, ‘SE’]
- mirror(axis_endpoint=(1, 0), axis_origin=(0, 0))¶
Mirror this label.
- Parameters:
axis_endpoint (Sequence[float] | complex) – Mirror axis endpoint.
axis_origin (Sequence[float] | complex) – Mirror axis origin.
- Returns:
This label.
- Return type:
- origin¶
Label origin.
- Type:
ndarray
- properties¶
Object properties.
- Type:
- rotate(rotation, center=(0, 0))¶
Rotate this label around a specific center.
- Parameters:
rotation (float) – Rotation angle in degrees.
center (Sequence[float] | complex) – Center of rotation.
- Returns:
This label.
- Return type:
- rotation¶
Label rotation.
- Type:
float
- scale(scaling, center=(0, 0))¶
Scale this label.
- Parameters:
scaling (float) – Scaling factor.
center (Sequence[float] | complex) – Center of scaling.
- Returns:
This label.
- Return type:
- scaling¶
Label scaling.
- Type:
float
- text¶
Label text.
- Type:
str
- transform(translation=(0, 0), rotation=0, scaling=1, x_reflection=False)¶
Apply a transformation to this label:
self = translate(rotate(mirror(scale(self))))
- Parameters:
translation (Sequence[float], complex) – Translation vector.
rotation (float) – Rotation angle in degrees.
scaling (float) – Magnification factor.
x_reflection (bool) – Mirror across the horizontal axis.
- Returns:
This label.
- Return type:
- translate(translation)¶
Translate this label.
- Parameters:
translation (Sequence[float]) – Translation vector.
- Returns:
This label.
- Return type:
- x_reflection¶
Label x_reflection.