fablabnbg / inkscape-chain-paths

Make longer continuous paths from shorter path segments
GNU General Public License v2.0
34 stars 14 forks source link

update needed for Inkscape version 1.0 #4

Open brynnd opened 4 years ago

brynnd commented 4 years ago

Hello, Thank you for providing this extension for Inkscape users!

This is just to let you know that most 3rd party Inkscape extensions, like this one, probably will not work with the upcoming new Inkscape version, the long-awaited version 1.0.

Here is the info you need to update this extension, so that it will work with 1.0 and future versions.
https://wiki.inkscape.org/wiki/index.php?title=Updating_your_Extension_for_1.0

If you have further questions, you can contact Inkscape developers via mailing lists, forum, or the chatroom.

If you have already updated it, please disregard this message.

All best, brynn

mgmax commented 4 years ago

Actually it would be great to integrate this extension into Inkscape, i.e, in the stock extensions repo https://gitlab.com/inkscape/extensions/. It's almost indispensable when working with DXF export from CAD tools. @jnweiger what do you think?

Main requirements would be:

jnweiger commented 4 years ago

Yes! Most of my extensions should go to the stock extensions repo. Brynn is probably right, this code here was never tested with 1.0, -- no idea, if it would work or not. Probably not.

LaureFR38 commented 4 years ago

This extension is also very useful to me. I hope it will work with the V1.

Errors on V1:

chain_paths.py:49: DeprecationWarning: inkex.localize was moved to inkex.localization.localize inkex.localize() chain_paths.py:86: DeprecationWarning: Effect.OptionParser or optparse has been deprecated and replaced with argparser.You must change self.OptionParser.add_option to self.arg_parser.add_argument; the arguments are similar. self.OptionParser.add_option('-V', '--version', chain_paths.py:89: DeprecationWarning: Effect.OptionParser or optparse has been deprecated and replaced with argparser.You must change self.OptionParser.add_option to self.arg_parser.add_argument; the arguments are similar. self.OptionParser.add_option('-s', '--snap', action='store', dest='snap_ends', type='inkbool', default=True, help='snap end-points together when connecting') chain_paths.py:90: DeprecationWarning: Effect.OptionParser or optparse has been deprecated and replaced with argparser.You must change self.OptionParser.add_option to self.arg_parser.add_argument; the arguments are similar. self.OptionParser.add_option('-c', '--close', action='store', dest='close_loops', type='inkbool', default=True, help='close loops (start/end of the same path)') chain_paths.py:91: DeprecationWarning: Effect.OptionParser or optparse has been deprecated and replaced with argparser.You must change self.OptionParser.add_option to self.arg_parser.add_argument; the arguments are similar. self.OptionParser.add_option('-u', '--units', action='store', dest="units", type="string", default="mm", help="measurement unit for epsilon") chain_paths.py:92: DeprecationWarning: Effect.OptionParser or optparse has been deprecated and replaced with argparser.You must change self.OptionParser.add_option to self.arg_parser.add_argument; the arguments are similar. self.OptionParser.add_option('-e', '--epsilon', action='store', chain_paths.py:320: DeprecationWarning: Effect.affect is now Effect.run(). The output argument has changed. e.affect() chain_paths.py:55: DeprecationWarning: Effect.uutounit est maintenant une méthode dans le document SVG. Utilisez à la place self.svg.uutounit(value, unit). return self.uutounit(nn, uu) # inkscape 0.91 chain_paths.py:177: DeprecationWarning: Effect.selected is now a dict in the svg. Use self.svg.selected. if not len(self.selected.items()): chain_paths.py:182: DeprecationWarning: Effect.selected is now a dict in the svg. Use self.svg.selected. for id, node in self.selected.iteritems(): Traceback (most recent call last): File "chain_paths.py", line 320, in e.affect() File "D:\Programmes\inkscape-1.0rc1-x64\inkscape\share\inkscape\extensions\inkex\deprecated.py", line 180, in affect return self.run(args=args) File "D:\Programmes\inkscape-1.0rc1-x64\inkscape\share\inkscape\extensions\inkex\base.py", line 123, in run self.save_raw(self.effect()) File "chain_paths.py", line 182, in effect for id, node in self.selected.iteritems(): AttributeError: 'collections.OrderedDict' object has no attribute 'iteritems' sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='nul' mode='w' encoding='cp1252'>

veronika commented 4 years ago

I have created pull-requests with the required changes: https://github.com/fablabnbg/inkscape-chain-paths/pull/5 https://github.com/fablabnbg/inkscape-chain-paths/pull/6

LaureFR38 commented 4 years ago

@veronika I copied / pasted your changes. It is OK for me. Thank you very much !

Rigoberdo commented 3 years ago

@veronika Thank you for your work. I tried your updated release in Inkscape 1.1 (c68e22c387, 2021-05-23) (Windows 10) but I got from Inkscape this message: _Traceback (most recent call last): File "chain_paths.py", line 312, in e.run() File "C:\Program Files\Inkscape\share\inkscape\extensions\inkex\base.py", line 131, in run self.save_raw(self.effect()) File "chain_paths.py", line 257, in effect self.set_segment_done(seg['id'], seg['n'], 'appended to ' + id + ' ' + str(cur_idx)) TypeError: can only concatenate str (not "PathElement") to str__

veronika commented 3 years ago

@Rigoberdo, I just tried it in 1.1 and I get the same error. I will look into it. It seems we can't concat path segments anymore so we probably need to turn the segment into a string first.

veronika commented 3 years ago

I have created pull-requests with the required changes:

7

The problem only affected the creation of messages for debug purposes.

Rigoberdo commented 3 years ago

Thank you, @veronika! Now, when I apply "Chain paths" to the four segments in the attached file, I got the following message: "_Traceback (most recent call last): File "chain_paths.py", line 312, in e.run() File "C:\Program Files\Inkscape\share\inkscape\extensions\inkex\base.py", line 131, in run self.save_raw(self.effect()) File "chainpaths.py", line 292, in effect node.getparent().remove(node) AttributeError: 'NoneType' object has no attribute 'remove'" disegno.zip

veronika commented 3 years ago

@Rigoberdo, I replaced the old style code of removing a node from the parent to the new style code of calling delete on the node. Please try again.

Rigoberdo commented 3 years ago

Hi @veronika, it works fine... nearly. In the attached example, it effectively chains five segment, with slightly detached end points, in a single five node polygon. But it also leaves - for reasons I cannot suppose - two residual segments of original five ones. In the attached figure below, the settings I used. immagine Anyway, thank you indeed Veronika, you did it! Mauro disegno-1.zip

pocketpixels commented 2 years ago

It is not working for me using Inkscape 1.2 on Mac (using the version of this extension from the master branch). The extension shows up in the menu, but when selecting it (with multiple paths selected) nothing happens.

veronika commented 2 years ago

In chain_paths.inx on line 6, change "inkex.py" to "inkex". This change is required for version 1.2 of Inkscape.

pocketpixels commented 2 years ago

Perfect, thank you @veronika!