From a2c079d8c996d52ded61e691b49ca0600bb66a3f Mon Sep 17 00:00:00 2001 From: Mario Voigt Date: Wed, 23 Jun 2021 11:34:50 +0200 Subject: [PATCH] small refactorings in inx of contour scanner --- .../contour_scanner_and_trimmer.inx | 9 ++++++--- .../contour_scanner_and_trimmer.py | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/extensions/fablabchemnitz/contour_scanner_and_trimmer/contour_scanner_and_trimmer.inx b/extensions/fablabchemnitz/contour_scanner_and_trimmer/contour_scanner_and_trimmer.inx index 5cff195f..024e06fe 100644 --- a/extensions/fablabchemnitz/contour_scanner_and_trimmer/contour_scanner_and_trimmer.inx +++ b/extensions/fablabchemnitz/contour_scanner_and_trimmer/contour_scanner_and_trimmer.inx @@ -97,8 +97,11 @@ - - true + + + + + @@ -108,7 +111,7 @@ - Uses Bentley-Ottmann algorithm to detect intersections - Allows to separate different contour types by colors - Works with paths which have Live Path Effects (LPE) - - Does not find overlapping colinear lines (sweep line algorithm does not intersect them) + - Finds overlapping / collinear lines Tips: - If nothings is selected, the whole document will be processed, regardless of groups. In contrast, if you made a custom selection, check to handle or not to handle groups. diff --git a/extensions/fablabchemnitz/contour_scanner_and_trimmer/contour_scanner_and_trimmer.py b/extensions/fablabchemnitz/contour_scanner_and_trimmer/contour_scanner_and_trimmer.py index 19dfee51..b5ccd3a8 100644 --- a/extensions/fablabchemnitz/contour_scanner_and_trimmer/contour_scanner_and_trimmer.py +++ b/extensions/fablabchemnitz/contour_scanner_and_trimmer/contour_scanner_and_trimmer.py @@ -296,9 +296,9 @@ class ContourScannerAndTrimmer(inkex.EffectExtension): #if trimGroupParentTransform is not None: # trimLine.path = trimLine.path.transform(-trimGroupParentTransform) - if self.options.apply_style_to_trimmed is False: + if self.options.trimmed_style == "apply_from_trimmed": trimLine.style = trimLineStyle - else: + elif self.options.trimmed_style == "apply_from_original": trimLine.style = subSplitLineArray[subSplitIndex].attrib['originalPathStyle'] trimGroup.add(trimLine) return trimGroup @@ -526,7 +526,7 @@ class ContourScannerAndTrimmer(inkex.EffectExtension): self.msg("trim group {} has {} combinable segments:".format(trimGroup.get('id'), len(newPathData))) self.msg("{}".format(newPathData)) combinedPath.path = Path(newPathData) - if self.options.apply_style_to_trimmed is False: + if self.options.trimmed_style is False: combinedPath.style = trimNonIntersectedStyle if totalIntersectionsAtPath == 0: combinedPath.style = nonTrimLineStyle @@ -634,7 +634,7 @@ class ContourScannerAndTrimmer(inkex.EffectExtension): pars.add_argument("--removefillsetstroke", type=inkex.Boolean, default=False, help="Remove fill and define stroke for original paths") pars.add_argument("--bezier_trimming", type=inkex.Boolean, default=False, help="If true we try to use the calculated t parameters from intersection points to receive splitted bezier curves") pars.add_argument("--subsplit_style", default="default", help="Sub split line style") - pars.add_argument("--apply_style_to_trimmed", type=inkex.Boolean, default=True, help="Apply original path style to trimmed lines") + pars.add_argument("--trimmed_style", default="apply_from_trimmed", help="Trimmed line style") #Style - Scanning Colors (Highlighting things) pars.add_argument("--color_subsplit", type=Color, default='1630897151', help="sub split lines")