Reader_SVG#
- class zeroheliumkit.src.importing.Reader_SVG(svg_file: str, bezier_samples: int = 20)[source]#
Bases:
objectA class to read and convert SVG files into Shapely polygons. Contributor: yneter
- Parameters:
svg_file (str) – The path to the SVG file to be read.
geometries (dict) – A dictionary containing the extracted geometries from the SVG file.
Methods
extract_points_from_path(path_data[, ...])Extracts points from a single path (handling lines and Bezier curves).
svg_to_shapely_polygons([bezier_samples])Extract multiple polygons from an SVG file.
Attributes
svg_filegeometries- svg_to_shapely_polygons(bezier_samples=20)[source]#
Extract multiple polygons from an SVG file.
- Parameters:
bezier_samples (int) – Number of points to sample along Bezier curves. Default is 20.
- Returns:
A Shapely MultiPolygon object containing all extracted polygons.
- Return type:
MultiPolygon
- extract_points_from_path(path_data, bezier_samples=20)[source]#
Extracts points from a single path (handling lines and Bezier curves).
- Parameters:
path_data (str) – The SVG path data string.
bezier_samples (int) – Number of points to sample along Bezier curves. Default is 20.
- Returns:
A list of (x, y) tuples representing points along the path.
- Return type:
list