diff --git a/extensions/fablabchemnitz/chain_paths/chain_paths.py b/extensions/fablabchemnitz/chain_paths/chain_paths.py index 89d73d9..40a66cc 100644 --- a/extensions/fablabchemnitz/chain_paths/chain_paths.py +++ b/extensions/fablabchemnitz/chain_paths/chain_paths.py @@ -164,7 +164,7 @@ class ChainPaths(inkex.EffectExtension): inkex.utils.debug("Warning: node {} has transform {}. Use 'Apply Transforms' extension before to handle this.".format(node.get('id'), node.get('transform'))) return - if so.debug: inkex.utils.debug("id={}, tag=".format(idnode.get('id'), node.tag)) + if so.debug: inkex.utils.debug("id={}, tag=".format(node.get('id'), node.tag)) path_d = CubicSuperPath(Path(node.get('d'))) sub_idx = -1 for sub in path_d: diff --git a/extensions/fablabchemnitz/destructive_clip/destructive_clip.py b/extensions/fablabchemnitz/destructive_clip/destructive_clip.py index 4ffd559..8b5c5a5 100644 --- a/extensions/fablabchemnitz/destructive_clip/destructive_clip.py +++ b/extensions/fablabchemnitz/destructive_clip/destructive_clip.py @@ -72,13 +72,13 @@ class DestructiveClip(inkex.EffectExtension): elif cmd[0] == 'C': # https://developer.mozilla.org/en/docs/Web/SVG/Tutorial/Paths lineSegments.append([prev, [this[4], this[5]]]) - errors.add("Curve node detected (svg type C), this node will be handled as a regular node") + errors.add("Curve node detected (svg type C), this node will be handled as a regular node. Try to flatten bezier curves before running this extension!") else: - errors.add("Invalid node type detected: {}. This script only handle type M, L, Z".format(cmd[0])) + errors.add("Invalid node type detected: {}. This script only handles types M, L, Z".format(cmd[0])) prev = this return (lineSegments, errors) - def linesgmentsToSimplePath(self, lineSegments): + def lineSegmentsToSimplePath(self, lineSegments): # reverses simplepathToLines - converts line segments to Move/Line-to's path = [] end = None @@ -202,8 +202,13 @@ class DestructiveClip(inkex.EffectExtension): self.error_messages.extend(['{}: {}'.format(id, err) for err in errors]) clippedSegments = self.clipLineSegments(segmentsToClip, clippingLineSegments) if len(clippedSegments) != 0: - path = str(inkex.Path(self.linesgmentsToSimplePath(clippedSegments))) - node.set('d', path) + segsOkay = True + for clippedSegment in clippedSegments: + if len(clippedSegment[0]) != 2: #must be 2, otherwise this errors in Path generation. + segsOkay = False + if segsOkay is True: + path = str(inkex.Path(self.lineSegmentsToSimplePath(clippedSegments))) + node.set('d', path) else: # don't put back an empty path(?) could perhaps put move, move? inkex.errormsg('Object {} clipped to nothing, will not be updated.'.format(node.get('id')))