Optimisation des déplacements

This commit is contained in:
Alex committed 2026-10-23 17:02:48 +02:00
1 parent 99c30068fc
commit 437345c9b7
4 files changed
+229 -9

No files matched your search

+9 -3
View File
@@ -24,8 +24,9 @@ from inkex.units import convert_unit
# n'est pas forcement dans sys.path : on l'y ajoute pour trouver relief_core.
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from relief_core import (fill_rings, parse_color, polylines_to_d, # noqa: E402
rings_bbox, segments_to_polylines)
from relief_core import (chain_segments, fill_rings, # noqa: E402
order_polylines, parse_color, polylines_to_d,
rings_bbox)
def use_system_language():
@@ -149,6 +150,7 @@ class ReliefFill(inkex.EffectExtension):
"stroke-linejoin": "round",
})
flatness = length_to_uu(self.svg, 0.02) # 0.02 mm : invisible a l'impression
self.head = (0.0, 0.0) # position de la tete du laser (origine)
for elem in elements:
shapes = [e for e in elem.descendants() if isinstance(e, SHAPE_TYPES)]
@@ -206,8 +208,12 @@ class ReliefFill(inkex.EffectExtension):
outline.style = style
group.add(outline)
if segments:
# Traits enchaines, puis ordonnes depuis la position de la
# tete laissee par la forme precedente : moins de trajets a vide.
polylines = order_polylines(chain_segments(segments), self.head)
self.head = polylines[-1][-1]
node = inkex.PathElement()
node.path = polylines_to_d(segments_to_polylines(segments), precision=3)
node.path = polylines_to_d(polylines, precision=3)
node.style = style
group.add(node)