Loading...
Logo
Processing Forum
Hey,

I have made a vectordrawing only containing of lines or to make it easier only one curvedVertex Shape. It could be PDF, ai, svg, etc.
now i want to import the coordinates of the line in Processing to be redrawn.
How can i do this?

Probably does someone know a converterscript, which make useable textfiles from pdf or so.

I know I could loadshapes or use geomerative, but the best solution for me would be to get the real coordinates, so i can modify them.

Replies(6)

no sorry, there i cant acces the vectorpoints, which shape the svg.
I really need something,which gives me code that looks like the linedrawing i made.
Load the SVG file as a text file and parse the XML there to get the path, hence the coordinates you want. More or less (there can be transformations...).
Yeah, that direction seems to be satisfying.
But what meens "to parse the XML"?
I tried to Open the svg in different IDEs (Text Editor, notepad++), what looks always to difficult to parse it.

I will try to find a SVG XML EDITOR, it seems to be quite simple constructed, shouldnt there be a code which I could use to translate my svgs to formated text? If not I should write it or could be already implemented in geomerative, but I have no clue where to look.

thanks

EDIT: I found the translater in Geomerative, but its too complex for me to get it. Logicaly thought an Tool to translate from SVG/XML to Processing text (JAVA) should exist, so I can just copy/paste my shapes like:

beginShape();
....
endShape();
I didn't write that parsing SVG would be simple...

Actually, looking at PShape's reference (well, the source, actually), I found a getVertex(n) method that returns an array of floats. n is between 0 and getVertexCount(). You can also use getVertexX(n), getVertexY(n) and even getVertexZ(n) if you do 3D (not in SVG...).