5 Replies Latest reply on Mar 23, 2012 9:05 AM by Erik_X

    Morphing using large set of external points


      Hi all,


      I have a kind of map. I want to apply a morphing on a selected number of layers using a large set of points (~5000). The set of points is provided as a text file by an external home made software. For each point, I have old and new coordinates. I can modify the format of the external set of points, if needed.


      Can I use scripting to perform my morphing?


      I saw that VBScript rely on an activeX component. Can I take control over Illustrator from an external software using the activeX component?


      PS : I use Illustrator 10 under WinXP Home but I can consider upgrading Illustrator. Is scripting available in the trial version?

        • 1. Re: Morphing using large set of external points
          Muppet Mark Level 5

          I don't know any VB… but the scripting model is the same for each language AI supports… Path point's properties have r/w access… So in theory yes script could do this…

          • 2. Re: Morphing using large set of external points
            Erik_X Level 1

            Yes, in theory, scripts should allow me to parse all the objects. Indeed, from a practical point of view, calculating the displacement of each point is quite complicated. I use a Delaunay triangulation. I would need to implement it in VB or Java. It is not reasonable. Or may be call an external home made library (DLL).


            Well, as suggested elsewhere, I will just save as ai file without compression and parse such a text file with my own external software.

            • 3. Re: Morphing using large set of external points
              ThinkingThings Level 1



              I'm not sure ifI totally understand what you are trying to do but I use Visual Basic in Visual Studio to run concurrently with AI. I develop in Visual Studio and just use a run-time debuggers to make the script (and all it's non-AI scripting logic) interact in real-time with the AI files at will. I don't know anything about Delaunay triangulation, but it would possibly seem that if the algorithm can be called from VB and path points have read-write access, as Mark said, then I think that this could possibly (in theory) work for you.


              Please let us know how you make out.


              Good luck!



              • 4. Re: Morphing using large set of external points
                Erik_X Level 1

                Using Delaunay triangulation is the usual way for morphing raster images. You use it to calculate the transformation in between your set of points. I already have Pascal code (not written by myself)  to do that using Delphi.


                My first idea was to use Delphi to parse some exchange file format to modify the coordinates of each point. So I started with SVG but discovered that Illustrator is storing an AI file inside the SVG and read it back instead of the SVG data. So, you can modify the SVG data, Illustrator don't care about it. Same with EPS.


                Now, I'm working directly on AI file saved without compression option (from Illustrator 10). But I'm discovering some nasty things. It is supposed to be text file. All the lines are not always finishing with CRLF. Some are just ending with CR or LF. And if you change it, Illustrator won't open the file back. Now I'm changing coordinates of objects. And Illustrator only open a part of the file before displaying an error message. This seems to be related to obj/stream section. This is not documented in the specs available on the net. Still investigating.

                • 5. Re: Morphing using large set of external points
                  Erik_X Level 1

                  The final(?) word.


                  Indeed, Illustrator don't seem to care so much on the end of lines but to the size of the content in the obj/stream sections. So if you change the number of chars in an obj/stream, it can't read the file back. So I saved to an older version, the 8.0, that don't use stream. I was able to modify it and re-open it without problem.