uqam
YaBB Newbies
Offline
Posts: 6
Re: Import Adobe EPS to Processing?
Reply #3 - Nov 18th , 2005, 1:39am
Hello, I was also looking for the best way to import some vector files in Processing. At least, I want to draw some specific shape I make in Illustrator. Recently, I developped something in AppleScript to make this possible. I use Applescript to extract every parameters from a path in Illustrator. Then, applescript create a function script, compatible with processing, and put it in the pasteboard. You just have to paste the function somewhere in your sketch and feed the parameters. Here is an example of the function automaticly produced : void figureBezier (float PosX, float PosY, float echelleX, float echelleY) { pushMatrix(); scale (echelleX, echelleY); PosX = PosX/echelleX; PosY = PosY/echelleY; translate(0,-height); beginShape(); vertex(PosX+(-69), PosY+(height + (-116))); vertex(PosX+(-63), PosY+(height + (-46))); bezierVertex(PosX+(-63), PosY+(height + (-46)), PosX+(-122), PosY+(height + (-33)), PosX+(-106), PosY+(height + (4))); bezierVertex(PosX+(-90), PosY+(height + (40)), PosX+(-45), PosY+(height + (37)), PosX+(-45), PosY+(height + (37))); vertex(PosX+(-22), PosY+(height + (118))); bezierVertex(PosX+(-22), PosY+(height + (118)), PosX+(-24), PosY+(height + (26)), PosX+(7), PosY+(height + (0))); bezierVertex(PosX+(38), PosY+(height + (-25)), PosX+(109), PosY+(height + (61)), PosX+(109), PosY+(height + (61))); vertex(PosX+(51), PosY+(height + (-52))); bezierVertex(PosX+(51), PosY+(height + (-52)), PosX+(85), PosY+(height + (-105)), PosX+(63), PosY+(height + (-116))); bezierVertex(PosX+(40), PosY+(height + (-127)), PosX+(-7), PosY+(height + (-87)), PosX+(-7), PosY+(height + (-87))); vertex(PosX+(-7), PosY+(height + (-87))); vertex(PosX+(-69), PosY+(height + (-116))); endShape(); popMatrix(); } Here is the URL to download the AppleScript file. http://www.computerarts.ca/_files/_temp/vector_illustrator.scpt.zip Of course, it only works on Mac. But I know it is possible to use Visual Basic and Illustrator about the same way on PC. But this reflect my rudimentary knowledge in programming, because i know understand that it is possible to developpe a Pen tools in Processing that will have the same behavior of the one I was used in Illustrator. Thanks to Reas and Fry for their fantastic work. I realy enjoyed Processing and try to teach it to my student the best way I can. JF (french speaking person).