In short, I’m trying to extract vertex from a svg but no matter how I do I always get an error: “getVertexCount() only works with PATH or GEOMETRY shapes”
What I did was:
create a little sketch to draw on the screen and save it in a file as SVG ( I also tried with Inkscape)
void setup() {
size(1000, 1000);
PShape ps = loadShape("test.svg");
shape(ps);
int children = ps.getChildCount();
for (int i = 0; i < children; i++) {
PShape child = ps.getChild(i);
int total = child.getVertexCount();
println(total);
}
}
Perhaps the child is a GROUP shape (this is valid), itself having multiple children – you may need to recurse over the shape to find all non-group shapes.