Importing SVG: // Error: Unexpected number of points for SVG path.

Importing SVG: // Error: Unexpected number of points for SVG path.

warpcat
Contributor Contributor
5,564 Views
11 Replies
Message 1 of 12

Importing SVG: // Error: Unexpected number of points for SVG path.

warpcat
Contributor
Contributor

I've just started importing svg files from Inkscape:  I can make as many simple squares as I want, and they'll import just fine.  But if I do anything remotely more complex, like a simple scribble with the calligraphic brush (with say 10 points total), or a simply polygon with the freehand tool, I get this error on import:

 

// Error: Unexpected number of points for SVG path.

 

Something seems seriously amiss. Any thoughts?  I've attached a simple 5-sided polygon that gives me this error.

 

2016 ext1 sp4, OSX 10.10.5

5,565 Views
11 Replies
Replies (11)
Message 2 of 12

pshwayka
Advisor
Advisor

FWIW, I tried your file in Ext1 Sp5 and got the same result. Not sure what's going on there, but I find error messages like that quite entertaining. It makes you want to ask "Well, how many points were you expecting?"

(I actually got an error message while doing something else today that said "This shouldn't happen." I have no idea what that was about, and it didn't seem to cause a problem.)

0 Likes
Message 3 of 12

warpcat
Contributor
Contributor

I agree:  I wish it said how many points it was expecting.  Right now the feature seems useless, unless I want to make everything out of squares 😞

 

Autodesk, you there?

 

Message 4 of 12

warpcat
Contributor
Contributor

It appears there is zero traction on this, but doing a bit more digging, it appears that it's the svgToPoly node itself that is failing.  Running this mel will trigger it when pointing to an 'invalid' svg:

setAttr svg1.svgFilepath -type "string" "c:/path/to/my/file.svg"

 

I've done tests:  Simple primitive circles and squares will read in fine, any numer of them.  But if I create a three point triangle with the pencil tool, it'll trigger this.  Or making a hexagon primitive:  Fail.

 

😞

0 Likes
Message 5 of 12

Anonymous
Not applicable

I had the same problem which is how I found this thread.

 

I found that 'Importing' the .svg failed, but ctl-c'ing the shape in Illustrator and using the 'Paste' option in Maya worked.

0 Likes
Message 6 of 12

Anonymous
Not applicable

Yuuup, hit the same problem. Dug around a bit and it seems like the SVG import only manages files that have straight lines in them. SVG uses commands like "M30,30" (moveTo x30,y30) and "v400" (vertical line from current point to +x400). Any time there is something like "c40,-30" that tells Maya to draw a curve it just results in

 

"Error: Unexpected number of points for SVG path." (Script Editor)

 

"API error detected in S:\Maya_2016_DI\src\Maya\src\Type\svgNode.cpp at line 218

: (kFailure): Unexpected Internal Failure" (Output Window)

 

I attached a couple of example files, 410.svg should work and asd.svg should fail

 

Illustrator import seems to work fine though, using that as a workaround as well.

 

----

 

I was excited for a smooth 2D vector --> 3D workflow, this is a bit of a joykill 😕

0 Likes
Message 7 of 12

Anonymous
Not applicable

Fix: use Inkscape, Path => Union

Message 8 of 12

warpcat
Contributor
Contributor

@Anonymous : That seems to work, thanks for the tip.

0 Likes
Message 9 of 12

Anonymous
Not applicable

I'm getting this same issue saving an SVG from illustrator. Using the inkscape trick doesn't appear to work I still get the same error message. It's just a simple shape and text from illustrator.

 

Is there some SVG export settings that has to be set for the importer to work in maya? This is really frustrating...

0 Likes
Message 10 of 12

colinea1
Explorer
Explorer

@Anonymous wrote:

I'm getting this same issue saving an SVG from illustrator. Using the inkscape trick doesn't appear to work I still get the same error message. It's just a simple shape and text from illustrator.

 

Is there some SVG export settings that has to be set for the importer to work in maya? This is really frustrating...


Make sure that you have the path selected first :

'Edit Paths By Nodes' tool [F2] > select path

Then Path > Union

Save as plain SVG

 

@Anonymous Thank you for posting this workaround. 

0 Likes
Message 11 of 12

Anonymous
Not applicable

Error: Unexpected number of points for SVG path

you do this create SVG imoprt for stupid boxes? try to load map and its not working. Ai import work but SVG create not working with all Slightly complex drawing

Maya 2016.5 and 2017 ver

0 Likes
Message 12 of 12

Anonymous
Not applicable

Make sure you first, make outlines of every single object in illustrator and then save it as a plain SVG 1.1 - then it works

0 Likes