summaryrefslogtreecommitdiff
path: root/lib/elements/utils.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2022-11-27 08:37:59 +0100
committerGitHub <noreply@github.com>2022-11-27 08:37:59 +0100
commite9278c55c34b72bb0beccf0d9b8bfe300aacac70 (patch)
tree0bd9728003f1cf8b03ba2ed610fafdcd217267fd /lib/elements/utils.py
parent9c0b64560cadc246b3555951ddb1e21960662553 (diff)
This and that (#1727)
* dont fail on satin with fill * fill stitch error message * convert to satin mac issue * auto_satin: add rung for two node old style satins * avoid divide by zero in intersect_region_with_grating * fix for incorrect stagger in guided fill * better rail sectioning algorithm * fix #1780 * fix #1816 Co-authored-by: Lex Neva
Diffstat (limited to 'lib/elements/utils.py')
-rw-r--r--lib/elements/utils.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/elements/utils.py b/lib/elements/utils.py
index dafde759..f7ee8dbc 100644
--- a/lib/elements/utils.py
+++ b/lib/elements/utils.py
@@ -6,11 +6,11 @@
from ..commands import is_command
from ..marker import has_marker
from ..svg.tags import (EMBROIDERABLE_TAGS, SVG_IMAGE_TAG, SVG_PATH_TAG,
- SVG_POLYLINE_TAG, SVG_TEXT_TAG)
-from .fill_stitch import FillStitch
+ SVG_POLYGON_TAG, SVG_POLYLINE_TAG, SVG_TEXT_TAG)
from .clone import Clone, is_clone
from .element import EmbroideryElement
from .empty_d_object import EmptyDObject
+from .fill_stitch import FillStitch
from .image import ImageObject
from .marker import MarkerObject
from .polyline import Polyline
@@ -27,7 +27,8 @@ def node_to_elements(node, clone_to_element=False): # noqa: C901
# clone_to_element: get an actual embroiderable element once a clone has been defined as a clone
return [Clone(node)]
- elif node.tag == SVG_PATH_TAG and not node.get('d', ''):
+ elif ((node.tag == SVG_PATH_TAG and not node.get('d', None)) or
+ (node.tag in [SVG_POLYLINE_TAG, SVG_POLYGON_TAG] and not node.get('points', None))):
return [EmptyDObject(node)]
elif has_marker(node):
@@ -36,18 +37,17 @@ def node_to_elements(node, clone_to_element=False): # noqa: C901
elif node.tag in EMBROIDERABLE_TAGS or is_clone(node):
element = EmbroideryElement(node)
- if element.get_boolean_param("satin_column") and element.get_style("stroke"):
- return [SatinColumn(node)]
- else:
- elements = []
- if element.get_style("fill", "black") and not element.get_style('fill-opacity', 1) == "0":
- elements.append(FillStitch(node))
- if element.get_style("stroke"):
- if not is_command(element.node):
- elements.append(Stroke(node))
- if element.get_boolean_param("stroke_first", False):
- elements.reverse()
- return elements
+ elements = []
+ if element.get_style("fill", "black") and not element.get_style('fill-opacity', 1) == "0":
+ elements.append(FillStitch(node))
+ if element.get_style("stroke"):
+ if element.get_boolean_param("satin_column"):
+ elements.append(SatinColumn(node))
+ elif not is_command(element.node):
+ elements.append(Stroke(node))
+ if element.get_boolean_param("stroke_first", False):
+ elements.reverse()
+ return elements
elif node.tag == SVG_IMAGE_TAG:
return [ImageObject(node)]