Inkscape 0.46 breaks gcode.py effect script

Asked by Brad Belcher

Hello, I recently upgraded my linux distro,(ubuntu 6.06 - ubuntu 8.04) and in doing so upgraded from Inkscape 0.43 to 0.46. I use an effects script gcode.py to export paths as gcode for use on a CNC router. The update seems to have broken the script, which can be found at:

http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?action=browse&diff=1&id=InkscapeHowto

I get the following message when I apply the effect:

Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/gcode.py", line 151, in <module>
    e.affect()
  File "/usr/share/inkscape/extensions/inkex.py", line 154, in affect
    self.effect()
  File "/usr/share/inkscape/extensions/gcode.py", line 103, in effect
    if node.tagName == 'path':
AttributeError: 'etree._Element' object has no attribute 'tagName'

I've been looking at the lxml documentation, but havent been able to get the script to run.

Any help would be appreciated. Thanks.

Brad

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
Brad Belcher
Solved:
Last query:
Last reply:
Revision history for this message
Brad Belcher (bradbelcher) said :
#1

Hey, I got it to work. I looked at the dots.py script. Made a few changes to gcode.py and it started working.
   if node.tagName == 'path':
    self.group = self.document.createElement('svg:g')
    node.parentNode.appendChild(self.group)
    new = self.document.createElement('svg:path')
    try:
     t = node.attributes.getNamedItem('transform').value
     self.group.setAttribute('transform', t)
    except AttributeError:
     pass
    p = simplepath.parsePath(node.attributes.getNamedItem('d').value)

changed to

                        if node.tag == inkex.addNS('path','svg'):
                                self.group = inkex.etree.SubElement(node.getparent(),inkex.addNS('g','svg'))
                                new = inkex.etree.SubElement(self.group,inkex.addNS('path','svg'))
                                try:
                                       t = node.attributes.getNamedItem('transform').value
                                       self.group.setAttribute('transform', t)
    except AttributeError:
                                       pass
                                p = simplepath.parsePath(node.get('d'))

Thanks