8 Replies Latest reply: Dec 30, 2011 9:02 AM by AwdatPazzles RSS

    Dashed Path Output to 3rd Party Device

    AwdatPazzles Community Member

      I need to output dashed paths to a 3rd party device that will draw/cut those dash marks on material.  I have found methods in the AI SDK that describe what the dash marks look like (ie GetPathStyle, etc).

       

      But this requires me to perform all the calculations of where those dash marks actually appear along a path which Illustrator has already done (since it displays those dashes to the screen).

       

      Is there a method(s) that already exists that I can call and it would return me the start and end points of each dash mark that appears on a path?  I have started working on the code to do this but can see that it is going to get pretty involved and was hoping that this was already available in the sdk and I just missed it.

       

      I did search the forums but didn't see anything discussed along these lines.

        • 1. Re: Dashed Path Output to 3rd Party Device
          btemp Community Member

          Like what you would get if you "Expand Appearance" from within Illustrator?

          • 2. Re: Dashed Path Output to 3rd Party Device
            AwdatPazzles Community Member

            Yes thank you very match.

             

            That saves me a ton of work and testing to try to force things to the way Illustrator displays them.

             

            And I see that there is an AIExpandSuite that performs this action, so I should be good to go.

            • 3. Re: Dashed Path Output to 3rd Party Device
              AwdatPazzles Community Member

              Well I thought I was in good shape.

               

              "Expand Appearance" does what I need as long as I then immediately follow up with an "Expand" menu selection (with the dashed line, "Expand" is greyed out until "Expand Appearance" is ran).

               

              Does the AIExpandSuite perform both of these actions?  I have tried the expand method from that suite with multiple combinations of the AIExpandFlagValue values that it takes for controlling the expansion and have not been able to reproduce the results as when using the menu options.

               

              I am including a couple of small pics to show what I am seeing as I perform each action using the menus.  I am guessing I need to reproduce these actions to get to what I need for output (but programmatically and not through the menus).

               

              original dash line:

              dash.JPG

               

              after expand appearance (notice the line is now broken into 3 components (left, middle, right portions)):

              expandappearance.JPG

               

              after expand:

              expand.JPG

               

              After running the expand option from the AIExpandSuite, do I have to redo the GetMatchingArt method to see the changes that expand has done (or some other command)?

               

              The sdk doesn't really say what occurs behind the scenes so I am not sure if I can still use the same art handle that I originally passed in to the expand method.

               

              Any additional insight/guidance is appreciated.

              • 4. Re: Dashed Path Output to 3rd Party Device
                A. Patterson Community Member

                A couple of dumb questions:

                 

                1) kExpandStroke doesn't do the trick? It feels like it should be the one you want. But I assume you've tried that?

                 

                2) Have you tried calling Expand twice? Since you seem to do need to do it twice using the UI?

                • 5. Re: Dashed Path Output to 3rd Party Device
                  AwdatPazzles Community Member

                  My last try was kind of throwing everything and the kitchen sink at it and ran the following three commands in a row:

                   

                  error = sAIExpand->Expand(artHandle, kExpandPluginArt | kExpandSymbolInstances, 0);

                  error = sAIExpand->Expand(artHandle, kExpandStroke | kExpandPattern | kExpandGradientToMesh | kExpandGradientToPaths, 0);

                  error = sAIExpand->Expand(artHandle, kExpandStroke | kExpandPattern | kExpandGradientToMesh | kExpandGradientToPaths, 0);

                   

                  When I do this (or even when I run just one expand with just the kExpandStroke option) I get the following:

                  expand2.JPG

                   

                  Basically the middle portion appears to be thrown away.  Obviously I am not running these commands correctly or something else is needing to be ran in addition.  I even tried running one expand with the last parameter not set to 0 but figured it wouldn't do anything since I wasn't working with objects that that parameter would supposedly affect.

                   

                  I might try rerunning GetMatchingArt again after the expand and see if that gives me additional objects.

                   

                  And no such thing as dumb questions for me.  I am very new to this Illustrator stuff.  Basically only use I have had with it is building and testing this plugin.  I don't even normally use this program at all.

                  • 6. Re: Dashed Path Output to 3rd Party Device
                    A. Patterson Community Member

                    You seem to be running Expand on the same art handle over and over, but the results of the first Expand() may not be stored in that handle (they might be, I'm not actually sure). If not, you might see better results if you can find the Expaned art and run it on that your second time.

                     

                    One way to test this is to use the debug window. If you press ALT+CTRL+SHIFT+F12 (use Cmd & Apple in places of ALT & CTRL if you're on a Mac) and you should get a floating panel pop up. If you scroll down in it, you can see the handles of all the art. So if you keep it simple, you can select the line and see what the handle address is (e.g. 01123da41f). Then run the Expand once. If you see that's the only art then you're doing all you can. I suspect you'll see that you end up with a whole bunch of new art though, and you should try running Expand on that a second time.

                    • 7. Re: Dashed Path Output to 3rd Party Device
                      AwdatPazzles Community Member

                      That was what I was wondering.  Thanks much for the ALT+CTRL+blah+blah thing.  I did not know about this command and that may help me a lot in troubleshooting.

                       

                      I will work with this and see if I can follow what is happening.

                       

                      Thanks again.  I will report back with my findings when I know more.

                      • 8. Re: Dashed Path Output to 3rd Party Device
                        AwdatPazzles Community Member

                        Thought I would just post some additional info.

                         

                        1)     The debug window is AWESOME.  Thanks so much for that suggestion.  Has saved me huge amounts of time.

                        2)     My dashed lines have shown up as two types: (S) and (AS).  Type (S) only needs "Expand" ran on it.  Type (AS) has to have "Expand Appearance" and then "Expand" ran on it.  Type (AS) appear to have a styleArt attribute applied to it.

                        3)     When either expand is ran, new group and path objects are added.  So will have to go back through the objects to get the new ones added.

                        4)     So far the expand method doesn't seem to reproduce the "Expand Appearance" with the settings I have tried.  But I think I can deal with those line types later.

                         

                        Thanks again for the assistance from all.  I should be able to atleast make some progress forward.