Get Vertex Count

I am trying to use the ‘ShapeVertices’ example in Processing 4.3 (Java mode).

The example works fine for the given “uk.svg”. When I try to use my own *.svg instead of “uk.svg”, I get the error: ‘getVertexCount() only works with PATH or GEOMETRY shapes’.

What am I doing wrong/not doing?

If your svg opens in a graphic editor then you aren’t doing anything wrong it is possible your svg uses features not enabled / available / supported
in Processing

2 Likes

If you use an svg exported from Illustrator, you should optimized it with an online svg optimizer (there is more than one online)

some graphic software have some prob with the svg quality produced…
or you can open and save with inkscape app.

hope this help

1 Like

@mrbbp Thank you.

EDIT: The problem has been solved.
The solution is tripartite.

  1. Change the code from size(640, 360); to size(640, 360, P2D);
  2. When saving SVG, Use Minimal and Minify in SVG options.
  3. Add noLoop(); to setup code, otherwise sketch never gets to report.