summaryrefslogtreecommitdiff
path: root/lib/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/extensions')
-rw-r--r--lib/extensions/__init__.py2
-rw-r--r--lib/extensions/selection_to_anchor_line.py26
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/extensions/__init__.py b/lib/extensions/__init__.py
index 94e0b4bb..353d3894 100644
--- a/lib/extensions/__init__.py
+++ b/lib/extensions/__init__.py
@@ -58,6 +58,7 @@ from .remove_embroidery_settings import RemoveEmbroiderySettings
from .reorder import Reorder
from .satin_multicolor import SatinMulticolor
from .select_elements import SelectElements
+from .selection_to_anchor_line import SelectionToAnchorLine
from .selection_to_guide_line import SelectionToGuideLine
from .selection_to_pattern import SelectionToPattern
from .simulator import Simulator
@@ -128,6 +129,7 @@ __all__ = extensions = [About,
Reorder,
SatinMulticolor,
SelectElements,
+ SelectionToAnchorLine,
SelectionToGuideLine,
SelectionToPattern,
Simulator,
diff --git a/lib/extensions/selection_to_anchor_line.py b/lib/extensions/selection_to_anchor_line.py
new file mode 100644
index 00000000..fe9442f1
--- /dev/null
+++ b/lib/extensions/selection_to_anchor_line.py
@@ -0,0 +1,26 @@
+# Authors: see git history
+#
+# Copyright (c) 2021 Authors
+# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
+
+import inkex
+
+from ..i18n import _
+from ..marker import set_marker
+from ..svg.tags import EMBROIDERABLE_TAGS
+from .base import InkstitchExtension
+
+
+class SelectionToAnchorLine(InkstitchExtension):
+
+ def effect(self):
+ if not self.get_elements():
+ return
+
+ if not self.svg.selected:
+ inkex.errormsg(_("Please select at least one object to be marked as a anchor line."))
+ return
+
+ for pattern in self.get_nodes():
+ if pattern.tag in EMBROIDERABLE_TAGS:
+ set_marker(pattern, 'start', 'anchor-line')