Structure#
- class zeroheliumkit.src.core.Structure[source]#
Bases:
EntityRepresents a structure that contains layers with a collection of geometries (Points, LineStrings, Polygons, etc.). The Structure class provides methods to append other entities or structures. Inherits from the Entity class.
Methods
add(layer)Adds a layer to the class with the given name and geometry.
append(structure[, anchoring, ...])Appends an Entity or Structure to the Structure.
clean()Removes all layers with empty polygons
copy([rename_anchors, with_suffix])Creates a deep copy of the Entity instance.
crop(geom[, loc])Crops polygons in all layers.
cut(geom[, loc])Cuts the specified polygon from polygons in all layers.
export_dict([remove_holes])Returns all layer names and their corresponding geometries in a Dictionary.
export_dxf(filename, layer_cfg)Exports layers as a DXF file.
export_gds(filename, layer_cfg)Exports all layers as a GDS file.
export_pickle(filename)Exports all layers as a pickle file.
get(lname)Retrieves a layer by its name.
has_layer(name)Check if a layer exists in the class.
mirror(aroundaxis[, keep_original, ...])Mirror all objects around a specified axis.
move(dx, dy)Moves all objects in the class by the specified (dx, dy) offset.
quickplot([size, color_config, zoom, ...])Plots the Entity object with predefined colors for each layer.
remove(lname)Removes a layer from the class.
rename(old, new)Changes the name of a layer/attribute in the class.
return_mirrored(aroundaxis, **kwargs)Returns a mirrored copy of the Structure class.
rotate([angle, origin])Rotates all objects in the class
scale([xfact, yfact, origin])Scales all objects by the specified factors along the x and y axes.
slice(slice_line)Slices polygons in a layer using a given line.
snap_to(point_from, point_to)Snaps all objects in the class so that point_from aligns with point_to.
Attributes
anchorscolorserrorslayersskeletone- append(structure: Entity, anchoring: tuple = None, direction_snap: bool = False, remove_anchor: bool | str = False, upd_alabels: list[tuple] = None, move_s: tuple = None, rotate_s: float = None) None[source]#
Appends an Entity or Structure to the Structure.
- Parameters:
structure (Entity) – Entity or Structure with a collection of geometries
anchoring (list, optional) – List of points to snap the appending object to the existing structure. [StructureObj Point, AppendingObj Point] Defaults to None.
direction_snap (bool, optional) – If True, aligns the direction of the appending object with the direction of the anchor points. Defaults to False.
remove_anchor (bool or str, optional) – If True, removes the anchor points after appending. If a string is provided, removes the specified anchor point. Defaults to False.
upd_alabels (list, optional) – Renames anchor labels of the appending structure before appending. A list of tuples with the old and new anchor labels: (old_label, new_label) Defaults to None.
- return_mirrored(aroundaxis: str, **kwargs) Structure[source]#
Returns a mirrored copy of the Structure class.
- Parameters:
aroundaxis (str) – The axis around which to mirror the class. Valid values are ‘x’ or ‘y’.
**kwargs – Additional keyword arguments.
- Returns:
A mirrored copy of the Structure class.
- Return type: