fibomat.default_backends.svg_backend module

class fibomat.default_backends.svg_backend.SVGBackend(pixel_scale: pint.quantity.build_quantity_class.<locals>.Quantity = <Quantity(0.01, 'micrometer')>, stroke_width: float = 0.1, description: Optional[str] = None)[source]

Bases: fibomat.backend.backendbase.BackendBase

__init__(pixel_scale: pint.quantity.build_quantity_class.<locals>.Quantity = <Quantity(0.01, 'micrometer')>, stroke_width: float = 0.1, description: Optional[str] = None)[source]
Args:
**kwargs: optional parameters for the backend given by **kwargs in

fibomat.project.Project.export()

process_site(new_site: fibomat.site.Site) None[source]

Adds a fibomat.site.Site to the backend. Note, that this method processes all patterns contained in the site. Use the following example as reference, if a backend overwrites this method.

...
def process_site(self, site: Site):
    # ...
    # do the backend specific stuff here (e.g. initialize a new patterning site)

    # call base method to add all patterns automatically
    super().process_site(site)
...
Args:

new_site (Site): site to be added.

Returns:

None

rect(ptn: fibomat.pattern.Pattern[fibomat.shapes.rect.Rect]) None[source]

Adds pattern with Rect as shape to the backend.

Args:

ptn (Pattern): pattern with Rect as shape

Returns:

None

polygon(ptn: fibomat.pattern.Pattern[fibomat.shapes.polygon.Polygon]) None[source]

Adds pattern with Ellipse as shape to the backend.

Args:

ptn (Pattern): pattern with Ellipse as shape

Returns:

None

circle(ptn: fibomat.pattern.Pattern[fibomat.shapes.circle.Circle]) None[source]

Adds pattern with Ellipse as shape to the backend.

Args:

ptn (Pattern): pattern with Ellipse as shape

Returns:

None

save(filename: Union[str, pathlib.Path]) None[source]

Saves the exported project to file. Args:

filename (PathLike): filename

Returns:

None

to_pillow_image(background_color=(255, 255, 255, 255))[source]
arc(ptn: fibomat.pattern.Pattern[fibomat.shapes.arc.Arc]) None

Adds pattern with Arc as shape to the backend.

Args:

ptn (Pattern): pattern with Arc as shape

Returns:

None

arc_spline(ptn: fibomat.pattern.Pattern[fibomat.shapes.arc_spline.ArcSpline]) None

Adds pattern with ArcSpline as shape to the backend.

Args:

ptn (Pattern): pattern with ArcSpline as shape

Returns:

None

ellipse(ptn: fibomat.pattern.Pattern[fibomat.shapes.ellipse.Ellipse]) None

Adds pattern with Ellipse as shape to the backend.

Args:

ptn (Pattern): pattern with Ellipse as shape

Returns:

None

hollow_arc_spline(ptn: fibomat.pattern.Pattern[fibomat.shapes.hollow_arc_spline.HollowArcSpline]) None

Adds pattern with HollowArcSpline as shape to the backend.

Args:

ptn (Pattern): pattern with HollowArcSpline as shape

Returns:

None

property implemented_shape_methods: Dict[fibomat.shapes.shape.Shape, Callable]

Dict[Shape, str]: implemented shape methods of backend

line(ptn: fibomat.pattern.Pattern[fibomat.shapes.line.Line]) None

Adds pattern with Line as shape to the backend.

Args:

ptn (Pattern): pattern with Line as shape

Returns:

None

parametric_curve(ptn: fibomat.pattern.Pattern[fibomat.shapes.parametric_curve.ParametricCurve]) None

Adds pattern with Curve as shape to the backend.

Args:

ptn (Pattern): pattern with Curve as shape

Returns:

None

polyline(ptn: fibomat.pattern.Pattern[fibomat.shapes.polyline.Polyline]) None

Adds pattern with Ellipse as shape to the backend.

Args:

ptn (Pattern): pattern with Ellipse as shape

Returns:

None

process_pattern(ptn: fibomat.pattern.Pattern) None

Add a pattern to the backend. The appropriate method is determined by the pattern’s shape class automatically.

If pattern contains a Layout, the contained shapes will be extracted automatically.

Args:

ptn (Pattern): pattern to be added. on_unknown_shape:

Returns:

None

process_unknown(ptn: fibomat.pattern.Pattern) None

Process a shape, which do not have a registered shape handler. Raises an exception by default.

Args:

ptn (Pattern): pattern to be added.

Returns:

None

rasterized_pattern(ptn: fibomat.pattern.Pattern[fibomat.rasterizedpattern.RasterizedPattern])

Adds pattern with RasterizedPattern as shape to the backend.

Args:

ptn (Pattern): pattern with RasterizedPattern as shape

Returns:

None

rasterized_points(ptn: fibomat.pattern.Pattern[fibomat.shapes.rasterizedpoints.RasterizedPoints])

Adds pattern with RasterizedPoints as shape to the backend.

Args:

ptn (Pattern): pattern with RasterizedPoints as shape

Returns:

None

property shape_methods: Dict[fibomat.shapes.shape.Shape, Callable]

Dict[Shape, str]: all (abstract) shape methods

spot(ptn: fibomat.pattern.Pattern[fibomat.shapes.spot.Spot]) None

Adds pattern with Spot as shape to the backend.

Args:

ptn (Pattern): pattern with Spot as shape

Returns:

None