kopia lustrzana https://github.com/inkstitch/inkstitch
Set redwork underpath style to dashed (#3053)
* set redwork underpath style to dashed * unset dashes for top stitching paths * update select elements templatepull/3068/head dev-build-kaalleen-params-fill-stroke
rodzic
f8ecf8eaf9
commit
f5939d6341
|
@ -5,14 +5,13 @@
|
||||||
|
|
||||||
import networkx as nx
|
import networkx as nx
|
||||||
from inkex import Group, Path, PathElement, errormsg
|
from inkex import Group, Path, PathElement, errormsg
|
||||||
from shapely import unary_union, length
|
from shapely import length, unary_union
|
||||||
from shapely.geometry import LineString, MultiLineString, Point
|
from shapely.geometry import LineString, MultiLineString, Point
|
||||||
from shapely.ops import linemerge, nearest_points, substring
|
from shapely.ops import linemerge, nearest_points, substring
|
||||||
|
|
||||||
from ..elements import Stroke
|
from ..elements import Stroke
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..svg import PIXELS_PER_MM, get_correction_transform
|
from ..svg import PIXELS_PER_MM, get_correction_transform
|
||||||
from ..svg.tags import INKSTITCH_ATTRIBS
|
|
||||||
from ..utils.geometry import ensure_multi_line_string
|
from ..utils.geometry import ensure_multi_line_string
|
||||||
from .base import InkstitchExtension
|
from .base import InkstitchExtension
|
||||||
|
|
||||||
|
@ -33,11 +32,8 @@ class Redwork(InkstitchExtension):
|
||||||
self.elements = None
|
self.elements = None
|
||||||
self.graph = None
|
self.graph = None
|
||||||
self.connected_components = None
|
self.connected_components = None
|
||||||
self.eulerian_circuits = None
|
|
||||||
self.merge_distance = None
|
self.merge_distance = None
|
||||||
self.minimum_path_length = None
|
self.minimum_path_length = None
|
||||||
self.redwork_running_stitch_length_mm = None
|
|
||||||
self.redwork_bean_stitch_repeats = None
|
|
||||||
|
|
||||||
def effect(self):
|
def effect(self):
|
||||||
if not self.get_elements():
|
if not self.get_elements():
|
||||||
|
@ -92,7 +88,6 @@ class Redwork(InkstitchExtension):
|
||||||
return command.target_point
|
return command.target_point
|
||||||
|
|
||||||
def _eulerian_circuits_to_elements(self, elements):
|
def _eulerian_circuits_to_elements(self, elements):
|
||||||
|
|
||||||
node = elements[0].node
|
node = elements[0].node
|
||||||
index = node.getparent().index(node)
|
index = node.getparent().index(node)
|
||||||
style = node.style
|
style = node.style
|
||||||
|
@ -150,10 +145,13 @@ class Redwork(InkstitchExtension):
|
||||||
)
|
)
|
||||||
|
|
||||||
element.label = label
|
element.label = label
|
||||||
element.set(INKSTITCH_ATTRIBS['running_stitch_length_mm'], self.options.redwork_running_stitch_length_mm)
|
element.set('inkstitch:running_stitch_length_mm', self.options.redwork_running_stitch_length_mm)
|
||||||
|
|
||||||
if redwork:
|
if redwork:
|
||||||
element.set(INKSTITCH_ATTRIBS['bean_stitch_repeats'], self.options.redwork_bean_stitch_repeats)
|
element.set('inkstitch:bean_stitch_repeats', self.options.redwork_bean_stitch_repeats)
|
||||||
|
element.style['stroke-dasharray'] = 'none'
|
||||||
|
else:
|
||||||
|
element.style['stroke-dasharray'] = '2 1.1'
|
||||||
|
|
||||||
group.add(element)
|
group.add(element)
|
||||||
|
|
||||||
|
|
|
@ -271,14 +271,18 @@ def create_element(path, position, direction, element):
|
||||||
index = position + 1
|
index = position + 1
|
||||||
if direction == "autorun":
|
if direction == "autorun":
|
||||||
label = _("AutoRun %d") % index
|
label = _("AutoRun %d") % index
|
||||||
|
dasharray = 'none'
|
||||||
else:
|
else:
|
||||||
label = _("AutoRun Underpath %d") % index
|
label = _("AutoRun Underpath %d") % index
|
||||||
|
dasharray = '2 1.1'
|
||||||
|
|
||||||
node = inkex.PathElement()
|
node = inkex.PathElement()
|
||||||
node.set("id", generate_unique_id(element.node, el_id))
|
node.set("id", generate_unique_id(element.node, el_id))
|
||||||
node.set(INKSCAPE_LABEL, label)
|
node.set(INKSCAPE_LABEL, label)
|
||||||
node.set("d", path)
|
node.set("d", path)
|
||||||
node.set("style", element.node.style)
|
node.set("style", element.node.style)
|
||||||
|
node.style["fill"] = 'none'
|
||||||
|
node.style["stroke-dasharray"] = dasharray
|
||||||
|
|
||||||
# Set Ink/Stitch attributes
|
# Set Ink/Stitch attributes
|
||||||
stitch_length = element.node.get(INKSTITCH_ATTRIBS['running_stitch_length_mm'], '')
|
stitch_length = element.node.get(INKSTITCH_ATTRIBS['running_stitch_length_mm'], '')
|
||||||
|
@ -299,7 +303,6 @@ def create_element(path, position, direction, element):
|
||||||
node.set(INKSTITCH_ATTRIBS['running_stitch_length_mm'], stitch_length)
|
node.set(INKSTITCH_ATTRIBS['running_stitch_length_mm'], stitch_length)
|
||||||
if tolerance:
|
if tolerance:
|
||||||
node.set(INKSTITCH_ATTRIBS['running_stitch_tolerance_mm'], tolerance)
|
node.set(INKSTITCH_ATTRIBS['running_stitch_tolerance_mm'], tolerance)
|
||||||
node.set("style", element.node.style + inkex.Style("stroke-dasharray:0.5,0.5;fill:none;"))
|
|
||||||
return Stroke(node)
|
return Stroke(node)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
<param indent="3" name="running-stitch-condition" type="optiongroup" appearance="combo" gui-text="Type"
|
<param indent="3" name="running-stitch-condition" type="optiongroup" appearance="combo" gui-text="Type"
|
||||||
gui-description="Select only specific running stitches">
|
gui-description="Select only specific running stitches">
|
||||||
<option value="all">No restriction</option>
|
<option value="all">No restriction</option>
|
||||||
<option value="autorun-top">Auto-Run Top Stitching</option>
|
<option value="autorun-top">Top Stitching (Redwork/Auto-Run)</option>
|
||||||
<option value="autorun-underpath">Auto-Run Underpath</option>
|
<option value="autorun-underpath">Underpath (Redwork/Auto-Run)</option>
|
||||||
<option value="autosatin-underpath">Auto-Satin Underpath</option>
|
<option value="autosatin-underpath">Underpath (Auto-Satin)</option>
|
||||||
</param>
|
</param>
|
||||||
<param indent="3" name="bean-stitch-repeats" type="string" gui-text="Bean stitch repeats">0</param>
|
<param indent="3" name="bean-stitch-repeats" type="string" gui-text="Bean stitch repeats">0</param>
|
||||||
<param indent="1" name="select-ripples" type="boolean" gui-text="Ripples">false</param>
|
<param indent="1" name="select-ripples" type="boolean" gui-text="Ripples">false</param>
|
||||||
|
|
Ładowanie…
Reference in New Issue