diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/commands.py | 4 | ||||
| -rw-r--r-- | lib/elements/polyline.py | 2 | ||||
| -rw-r--r-- | lib/extensions/break_apart.py | 10 | ||||
| -rw-r--r-- | lib/svg/rendering.py | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/lib/commands.py b/lib/commands.py index 73fea5ee..c9da782a 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -296,7 +296,7 @@ def add_connector(document, symbol, element): # Make sure the element's XML node has an id so that we can reference it. if element.node.get('id') is None: - element.node.set('id', generate_unique_id(document, "object")) + element.node.set('id', document.get_unique_id("object")) path = inkex.PathElement(attrib={ "id": generate_unique_id(document, "command_connector"), @@ -315,7 +315,7 @@ def add_connector(document, symbol, element): def add_symbol(document, group, command, pos): symbol = inkex.Use(attrib={ - "id": generate_unique_id(document, "command_use"), + "id": document.get_unique_id("command_use"), XLINK_HREF: "#inkstitch_%s" % command, "height": "100%", "width": "100%", diff --git a/lib/elements/polyline.py b/lib/elements/polyline.py index c7a9ea48..e923aac0 100644 --- a/lib/elements/polyline.py +++ b/lib/elements/polyline.py @@ -50,7 +50,7 @@ class Polyline(EmbroideryElement): def points(self): # example: "1,2 0,0 1.5,3 4,2" - points = self.node.get('points') + points = self.node.get('points').strip() points = points.split(" ") points = [[float(coord) for coord in point.split(",")] for point in points] diff --git a/lib/extensions/break_apart.py b/lib/extensions/break_apart.py index c645c7a1..b16c901d 100644 --- a/lib/extensions/break_apart.py +++ b/lib/extensions/break_apart.py @@ -7,7 +7,7 @@ import logging from copy import copy import inkex -from shapely.geometry import LineString, MultiPolygon, Polygon +from shapely.geometry import LinearRing, MultiPolygon, Polygon from shapely.ops import polygonize, unary_union from ..elements import EmbroideryElement @@ -63,10 +63,10 @@ class BreakApart(InkstitchExtension): for path in paths: if len(path) < 3: continue - linestring = LineString(path) - if not linestring.is_simple: - linestring = unary_union(linestring) - for polygon in polygonize(linestring): + linearring = LinearRing(path) + if not linearring.is_simple: + linearring = unary_union(linearring) + for polygon in polygonize(linearring): polygons.append(polygon) else: polygon = Polygon(path).buffer(0) diff --git a/lib/svg/rendering.py b/lib/svg/rendering.py index 7be1e8b0..2b638ebf 100644 --- a/lib/svg/rendering.py +++ b/lib/svg/rendering.py @@ -197,8 +197,8 @@ def color_block_to_paths(color_block, svg, destination, visual_commands): add_commands(Stroke(destination[-1]), ["trim"]) color = color_block.color.visible_on_white.to_hex_str() - path = inkex.PathElement(attrib={ + 'id': svg.get_unique_id("object"), 'style': "stroke: %s; stroke-width: 0.4; fill: none;" % color, 'd': "M" + " ".join(" ".join(str(coord) for coord in point) for point in point_list), 'transform': get_correction_transform(svg), |
