fibomat.layout.groups.dim_group module#
- class fibomat.layout.groups.dim_group.DimGroup(elements: List[DimTransformable], description: str | None = None)[source]#
Bases:
GroupBase[DimTransformable,DimVector,DimBoundingBox],DimTransformable- __init__(elements: List[DimTransformable], description: str | None = None)[source]#
- Args:
description (str, optional): description
- property bounding_box: BBoxT#
BoundingBox: bounding box of transformable- Access:
get
- property center: VectorT#
center of the (geometric) object
- Access:
get
- Returns:
Any
- clone() T#
Create a deepcopy of the object.
- Returns:
Describable
- property elements#
- layout_elements() Iterator[ElementT]#
Access to the saved elements.
- Yields:
Any: Type depends on saved element.
- mirrored(mirror_plane: VectorT) SelfT#
Return a mirrored object mirrored about mirror_plane.
- Args:
mirror_plane (VectorLike): mirror plane to be used.
- Returns:
TransformableBase
- property pivot: VectorT#
Origin of the (geometric) object. If origin is set to None,
Transformable.centerwill be returned.Pivot must be set to a callable function without parameters.
transformable_obj = ... transformable_obj.pivot = lambda: return Vector(1, 2) print(transformable_obj.pivot) # will print Vector(1, 2)
- Access:
get/set
- Returns:
Vector
- rotated(theta: float, origin: VectorT | str | None = None) SelfT#
Return a rotated copy around origin with angle theta in math. positive direction (counterclockwise).
- Args:
theta (float): rotation angle in rad origin (Optional[Union[linalg.VectorLike, str]], optional):
origin of rotation. If not set, (0,0) is used as origin. If origin == ‘center’, the
Transformable.centerof the object will be used. The same applies for the case that origin == ‘origin’ with theTransformable.originproperty. Default to None.- Returns:
TransformableBase
- scaled(fac: float, origin: VectorT | str | None = None) SelfT#
Return a scale object homogeneously about origin with factor s.
- Args:
fac (float): rotation angle in rad origin (Optional[Union[linalg.VectorLike, str]], optional):
origin of rotation. If not set, (0,0) is used as origin. If origin == ‘center’, the
Transformable.centerof the object will be used. The same applies for the case that origin == ‘origin’ with theTransformable.originproperty. Default to None.- Returns:
TransformableBase
- transformed(transformations: _TransformationBuilder[VectorT]) SelfT#
- Return a transformed object. the transformation can be build by the following functions:
translate()rotate()scale()mirror()
E.g.
transformable_obj.transform(translate([1, 2]) | rotate(np.pi/3) | mirror([3,4])
- Args:
transformations (_TransformationBuilder): transformation
- Returns:
TransformableBase
- translated(trans_vec: VectorT) SelfT#
Return a translated copy of the object by trans_vec.
- Args:
trans_vec (VectorLike): translation vector
- Returns:
TransformableBase
- translated_to(pos: VectorT) SelfT#
Return a translated copy of the object so that self.pivot == pos
- Args:
pos: new position of object
- Returns:
TransformableBase