We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Apologies in advance if this has a trivially easy answer. Basically, I/my coworkers often run into the same problem with illustrating large datasets (say, a couple million points). Processing can handle it just fine and can export a vector image format just fine, but when importing the figure to another program (typically Adobe Illustrator or inkscape), they can't deal with each data point being a unique object, so they tend to crash.
My question, then, is is there a way in processing to combine all of the points, lines, etc. into a single object (object may not be the proper word), so when we open them in Illustrator it seems one object, rather than millions? I had hopes that PShapes would be the solution, but it seems that processing draws each child shape as its own object when exporting them. Thanks in advance for any help you can give!
Answers
If I understood your question properly, what you would need to do is get each of the vertices of you child PShapes and add them seperately to your parent PShape.
Hmm...this sort of works. I indeed end up with a single object to export for post-processing, but now there are lines that I don't want connecting all of the points that are supposed to be there. And it doesn't seem I can just turn off the stroke for these 'joiner lines,' unless I'm just missing something.
there was a bug in this area but it's fixed in the newest version, apparently
or it could be something you are doing, but without seeing any code we can't tell...
Please give an example of the problem by sharing a sketch that produces a "broken" large vector image. Optionally, attach an example of the broken vector file output.
What specific versions of Illustrator and Inkscape (and on what OS) are your broken files failing against?
Here's a simplified version of what I'm talking about. I tend to write most things in python mode, but if the java version would be easier I can go back and rework it.
So option 1 ends up with just three individual curves as separate objects, option 2 outputs a single object, but with extra lines joining each bezierVertex with the following vertex, and option 3 outputs the same as option 1, since I create a new 'child' shape for each data point.
The files aren't really 'broken' per se, they often aren't even that large, but when each curve is drawn as a separate object and there are hundreds of thousands or millions of curves, Inkscape (v. 0.91 on OS X 10.9.5, btw) can't handle it. So being able to draw all of the curves as a single object without the connecting lines would be awesome.
You don't have parent.endshape(); ? after line 30
not sure if this relevant
adding one gets you an error:
Cannot end GROUP shape
that's how i'd expect things to look tbh - in option 2 it's all one shape. just because you are switching between vertex and bezierVertex doesn't mean the shape finishes.
Maybe use noStroke()? I'll test in a day and tell you.
You're exactly right - I'm just trying to figure out how to get the best of both worlds by having the curves 'look' separate while actually being a single object.
I tried with no luck using noStroke() between each bezierVertex and the following vertex, but so far as I can tell it's not possible to change that between beginShape/endShape (at least not with the default renderer. There may be other workarounds though that I'm not familiar with.
Best of luck then. You could see this question.