Number Nodes not working

Asked by Sonya

Hi

I have just installed Inkscape and am running it with OS X 10 (Version 10.10.4). I want to make children's dot to dot pictures with outline pictures created in adobe illustrator. I am opening the svg file, creating an object path, then extensions, visualise path, number nodes. When I press apply it comes up with this warning:

"Inkscape has received additional data from the script executed. The script did not return an error, but this may indicate the results will not be as expected"

The bottom box has the following information:

Traceback (most recent call last):
  File "dots.py", line 124, in <module>
    e.affect()
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 265, in affect
    self.getposinlayer()
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 207, in getposinlayer
    x = self.unittouu( xattr[0] + 'px' )
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 351, in unittouu
    return retval * (self.__uuconv[u.string[u.start():u.end()]] / self.__uuconv[self.getDocumentUnit()])
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 304, in getDocumentUnit
    p = param.match(svgwidth)
TypeError: expected string or buffer

Any help will be greatly appreciated.
Sonya

Question information

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

Hi Sonya,

this is a known bug in the current Inkscape version with some files generated by different software (https://bugs.launchpad.net/inkscape/+bug/1463623).

You can workaround this by either:

- copying the contents into a new file or by

- adding a width attribute with a value of 100% for your file's SVG root element, i.e. open the file with a text editor and add

width="100%"

behind the first occurrance of

<svg

Kind Regards,
 Maren

Revision history for this message
Sonya (dotty972) said :
#2

Thank you so much Maren. I have opened the file with a text editor but a little unsure where to put the width="100%"

Here are the firs few lines. Would you be able to guide me exactly where to put it.

Thanks so much.

Sonya

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 20.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Treasure_Chest" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
  y="0px" viewBox="0 0 792 612" style="enable-background:new 0 0 792 612;" xml:space="preserve">
<style type="text/css">
 .Arched_x0020_Green{fill:url(#SVGID_1_);stroke:#FFFFFF;stroke-width:0.25;stroke-miterlimit:1;}
 .st0{fill:none;stroke:#231F20;stroke-linecap:round;}
 .st1{fill:none;stroke:#231F20;stroke-linecap:round;stroke-dasharray:0,12.644;}
 .st2{fill:none;stroke:#231F20;stroke-linecap:round;stroke-dasharray:0,20.4836;}

Revision history for this message
Sonya (dotty972) said :
#3

Hi Maren

I have tried to copy the image into a new file but have had no luck. Still getting the same message.

Have tried a few adjustments of the text code but still no luck. Perhaps I am inserting it in the wrong place.

If anyone has any other suggestions it would be greatly appreciated.

Revision history for this message
Hachmann (marenhachmann) said :
#4

Hi Sonya,

with 'copy into a new file' I meant you'd open a new document in Inkscape, and copy-paste the contents from the old, opened, document into the new one (select all, copy, switch document, paste).
This will work (but it may destroy any layer structure in your drawing).

Or you replace the beginning of your file with this:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 20.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg width="100%" version="1.1" id="Treasure_Chest" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
  y="0px" viewBox="0 0 792 612" style="enable-background:new 0 0 792 612;" xml:space="preserve">
<style type="text/css">
 .Arched_x0020_Green{fill:url(#SVGID_1_);stroke:#FFFFFF;stroke-width:0.25;stroke-miterlimit:1;}
 .st0{fill:none;stroke:#231F20;stroke-linecap:round;}
 .st1{fill:none;stroke:#231F20;stroke-linecap:round;stroke-dasharray:0,12.644;}
 .st2{fill:none;stroke:#231F20;stroke-linecap:round;stroke-dasharray:0,20.4836;}

Kind Regards,
 Maren

Revision history for this message
Sonya (dotty972) said :
#5

Hi Maren

Thank you so much for providing all this information. It really is very much appreciated. I have spent so long trying to make it work as a beginner to all this and still would very much like to work it out. I have done both the things you suggested but still can't seem to get number nodes to work. It comes up with the same message but different information in the drop down box.

"Inkscape has received additional data from the script executed. The script did not return an error, but this may indicate the results will not be as expected"

Traceback (most recent call last):
  File "dots.py", line 124, in <module>
    e.affect()
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 265, in affect
    self.getposinlayer()
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 209, in getposinlayer
    doc_height = self.unittouu(self.document.getroot().get('height'))
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 343, in unittouu
    p = param.match(string)
TypeError: expected string or buffer

If I sent you the picture or all the coding would that be helpful at all? Once I work this out I hope to use it for many pictures I have.

Thank you so much
Sonya

Revision history for this message
Hachmann (marenhachmann) said :
#6

Hi Sonya,

I guess you didn't try the easier copy-paste option ;-)

This is how you do it:

- Open file.
- Select everything by dragging the mouse around it.
- Open new file.
- Hit Ctrl+V to paste.

- Then do your node-numbering in the new file.

If you really have a reason to not use the copy-pasting technique (what didn't work?), to get rid of that other error, it may help to also insert

height="100%"

behind the

width="100%"

(separated by spaces).

But really, it's a lot easier if you just use copy-paste into a new document, using Inkscape directly.

Kind Regards,
 Maren

Revision history for this message
Hachmann (marenhachmann) said :
#7

Just a thought (in case that was the reason for it not working as expected):

For OS X, make sure that your clipboard settings are correct, see instructions on the download page:
https://inkscape.org/en/download/mac-os/

Revision history for this message
Sonya (dotty972) said :
#8

Hi Maren

I'm completely baffled.
I have tried adding the text you gave me to my file.
I have tried the cut and paste method.
I have tried uninstalling Quartz and reinstalling.
I have tried uninstalling Inkscape and reinstalling.
I configured XQuartz input and pasteboard settings as you advised
I tried using some of the other extensions and they don't work either. They've never worked. I'm missing something somewhere.

I am running OS X Yosemite
I have installed the correct Inkscape .dmg file for Mac OS X 10.7-10.10
I have installed XQuartz Version 2.7.9 for OS X 10.6.3 or later

Is there something that would stop me being able to use all the extensions?

Thanks in advance
Sonya

Revision history for this message
Hachmann (marenhachmann) said :
#9

I don't think so, no.

(In my step-by-step instructions, I forgot to add the 'Copy' action... Sorry about that. Did you actually copy before trying to paste?)

But that depends on the error messages you are getting. I'm not on OS X, and I can't read them from here...

After adding the height="100%", you should at least get a different error message, because for me, it solves the problem with the add nodes extension completely.

It is probable that many extensions will not work with the file from Illustrator, just like the number nodes extension, because they all need to know the width and height of the document (which isn't explicitly given in the Illustrator exported SVG file).

But do they work if you open a new document?

Kind Regards,
 Maren

Revision history for this message
Sonya (dotty972) said :
#10

Hi Maren

I did copy from old document and paste into new document but that hasn't worked. I just checked and yes the number nodes do work if I open a new document and create a shape. So it is working but just not with my pictures! :( With the width and height added it now doesn't give me a message or error it just doesn't work when I press apply. All my pictures are coded the same way from my illustrator. Might see if he has any ideas.

Thank you so much for all your patience and help with this matter.

Sonya

Revision history for this message
Hachmann (marenhachmann) said :
#11

Okay, could you upload (one of) the file(s) somewhere, Sonya? And post a link in a comment here?

Revision history for this message
Sonya (dotty972) said :
#12

Thank you Maren for your time.

Here is the link

https://www.dropbox.com/home?preview=Treasure+Chest.svg

Sonya

Revision history for this message
Hachmann (marenhachmann) said :
#13

Unfortunately, the link is not publicly accessible :/

I cannot get to the file, Sonya.
Can you make it so that anyone can access it?
You could delete the file after I've taken a look, if that's what was bothering you.

Kind Regards,
 Maren

Revision history for this message
Sonya (dotty972) said :
#14
Revision history for this message
Best Hachmann (marenhachmann) said :
#15

Arghs. My first answer seems to have been lost for some reason. So, once again:

I've taken a look now (so you can delete the file, if you like, now).

Your file contains a group of 331 objects and paths.
The extension, however, only works on single paths.

If you really intend to create a 'draw-by-numbers' thing from the treasure chest, you will have to make the whole chest into a single path.
Do this by:
- selecting the chest,
- ungrouping it,
- turning everything into paths (Path -> Object to Path),
- combining everything into a single path (Path -> Combine).

However, this will create a path with more than 3000 nodes, and the extension will not number them in a logical order. I'm not sure if that is what you intended to produce... It will be near impossible to do 'draw-by-numbers' for this, the numbering won't even fit into the drawing, because the numbers all overlay each other (unless you choose a really tiny font - but who can read that?).

So what I'd suggest (for draw-by-numbers) would be to use the original chest as a 'template' and to draw your own one, or to find a simpler drawing somewhere, with less nodes.

----

For any files generated by Illustrator, remember to insert the

width="100%" height="100%"

into the first svg tag, if you get the error message about missing height/width attribute, or to copy-paste the contents into a new Inkscape file.

Kind Regards,
 Maren

Revision history for this message
Sonya (dotty972) said :
#16

Thank you so much Maren. You have been more than helpful with this dilemma. I am truly grateful for the time you have put in and the time you have saved me. Thank you, thank you, thank you.

Revision history for this message
Sonya (dotty972) said :
#17

Thanks Hachmann, that solved my question.