add missing option to filter by length/area

This commit is contained in:
Mario Voigt 2023-11-27 10:34:55 +01:00
parent 8b89f6ebfd
commit 07d29540ed

View File

@ -88,6 +88,7 @@ class FilterByLengthArea(inkex.EffectExtension):
subPaths = subPaths[::-1] subPaths = subPaths[::-1]
for subpath in subPaths: for subpath in subPaths:
inkex.utils.debug(subpath)
#self.msg(subpath) #self.msg(subpath)
replacedelement = copy.copy(element) replacedelement = copy.copy(element)
oldId = replacedelement.get('id') oldId = replacedelement.get('id')
@ -129,16 +130,27 @@ class FilterByLengthArea(inkex.EffectExtension):
elements = [] elements = []
if len(self.svg.selected) > 0: if len(self.svg.selected) > 0:
for element in self.svg.selection.values(): for element in self.svg.selection.values():
elements.extend(self.breakContours(element, None)) if self.options.breakapart is True:
elements.append(self.breakContours(element, None))
else:
elements.append(element)
else: else:
data = self.document.xpath("//svg:path", namespaces=inkex.NSS) data = self.document.xpath("//svg:path", namespaces=inkex.NSS)
for element in data: for element in data:
elements.extend(self.breakContours(element, None)) if self.options.breakapart is True:
elements.append(self.breakContours(element, None))
else:
elements.append(element)
if len(elements) == 0:
inkex.utils.debug("No paths to process...")
exit(1)
if so.debug is True: if so.debug is True:
inkex.utils.debug("Collecting svg:path elements ...") inkex.utils.debug("Collecting svg:path elements ...")
for element in elements: for element in elements:
# additional option to apply transformations. As we clear up some groups to form new layers, we might lose translations, rotations, etc. # additional option to apply transformations. As we clear up some groups to form new layers, we might lose translations, rotations, etc.
if so.apply_transformations is True and applyTransformationsAvailable is True: if so.apply_transformations is True and applyTransformationsAvailable is True:
apply_transformations.ApplyTransformations().recursiveFuseTransform(element) apply_transformations.ApplyTransformations().recursiveFuseTransform(element)