Skip to main content
Participating Frequently
April 4, 2019
Question

Adobe Illustrator CC 2019 Scripting VERY slow - C#

  • April 4, 2019
  • 4 replies
  • 2213 views

Hello,

i'm developting a small library to access PathObjects in Illustrator (works fine for CS2, CS5, CC2015) - but i have performance problems with CC2019. I am using VS2017.

Code looks like:

Type AIType = Type.GetTypeFromProgID(AIAppName);

dynamic illuApp = Activator.CreateInstance(AIType);

if (illuApp == null)

{

     return;

}

if (illuApp.Documents.Count < 1)

{

     return;

}

System.Array lll = illuApp.ActiveDocument.selection;

if (lll != null)

{

    for (int i = 0; i < lll.Length; i++)

    {

        dynamic path = lll.GetValue(i);

        if (path != null)

        {

            var lll2 = path.PathPoints;

            Application.DoEvents();

            int iSelCount = lll2.Count;

            if (iSelCount >= 4)

            {

                string sss = path.typename;

                float dH = (float)(path.Height / dScale);

                float dW = (float)(path.Width / dScale);

                float dL = (float)(path.Left / dScale);

                float dT = (float)Math.Abs(path.Top / dScale);

                dynamic obCol = path.FillColor;

                sss = obCol.typename;

                Color col = Color.Black;

                if (sss.Contains("CMYK"))

                {

                    var r = (int)(255 * (1 - obCol.Cyan / 100) * (1 - obCol.Black / 100));

                    var g = (int)(255 * (1 - obCol.Magenta / 100) * (1 - obCol.Black / 100));

                    var b = (int)(255 * (1 - obCol.Yellow / 100) * (1 - obCol.Black / 100));

                    col = Color.FromArgb(r, g, b);

                }

                else if (sss.Contains("RGB"))

                {

                    int r = (int)(obCol.Red);

                    int g = (int)(obCol.Green);

                    int b = (int)(obCol.Blue);

                    col = Color.FromArgb(r, g, b);

                }

                Data.Add(NewInfo (dL, dT, dW, dH, col);

            }

        }

    }

}

On CS2, CS5 or CC2015, processing 200 selected rectangles need a couple of seconds, but on CC2019 it needs MINUTES.

I use exactly the same code - is there something i am missing?

Thanks in advance for any hint!

Leopold

This topic has been closed for replies.

4 replies

Participating Frequently
April 5, 2019

Just opened a "bug" in uservoice page.

I additionally posted this info: Mainly accessing "path.PathPoints" (needs ~ 15 msec.) and "path.FillColor" (needs ~ 20 msec.) are time consuming.

Community Expert
April 15, 2019

Hi leopoldm58441713 ,

could you provide a link to your report at UserVoice?

Thanks,
Uwe

Participating Frequently
April 15, 2019
Participating Frequently
April 5, 2019

Silly-V, CarlosCanto,

thanks a lot four your inputs, i'll see what i can do to find out more details. As soon as i have know more, i'll post the results here.

Participating Frequently
April 5, 2019

Nobody any ideas?

Can anyone give me a hint where i can get answers - no one from Adobe DEV Team interested in pointing me in to the right direction?

Or is this a known problem to CC 2019?

Silly-V
Legend
April 5, 2019

Sorry but this is the first time I've heard of this, and I'll be clear that first and foremost that I'm just glad that it isn't happening to me, right now.

Because in this world, we are made cynical due to accustomed to such a variety of issues popping up with any given aspect of extensibility development that at the end of the day, we're just glad it doesn't get much worse. And then it does, such as in your case here.

Now, let me try to be marginally helpful here by looking at the differences in your situations vs what I would consider the majority of user usage context on this forum. It appears you are going controlling the Illustrator application via some Visual Studio-made application instead of the traditional .jsx extendscript most users here deal with. So, as this is an issue that happens to you, we can assume that either you are experiencing it alone, or other users who have your setup are also experiencing it.

If there are other users with your setup experiencing it, they will likely find your posting here, which is a great way to start the awareness. However there may not be many people who use your exact setup which yields the issue, so this could be wishful thinking too - until more people identify themselves as having a similar issue and come forward with their story.

Umm another thing is when stuff takes overly long that's typically some indication of a memory leak? Is there a way to observe the performance of your Visual Studio application to see the differences between the other Ai version's performances and CC2019, and what may be some of the costliest functions. In best case, you may be able to identify some function or command which causes 100% of the issue and can substitute this command with some work-around, if there's a profiling feature that lets you see such information, that is.

I would suggest you perform a test by running the same routine as you have in .jsx format to really prove whether Visual Studio application execution has something to do with it or whether it's just the entire CC2019 application on your system which acts different.

These vague advices which I barely comprehend myself is all I can offer, but I do wish you the best in resolving the issue. Please remember to post any updates or solutions as this posting may be also crucial to the handful of users in the world who may also be beset by it.

Silly-V
Legend
April 4, 2019

So many reasons this could happen, I wonder why this would be happening too although I never had this issue.

Are you using the same exact files to test with?

Participating Frequently
April 4, 2019

Using CS2 ... create 10 Rectangles (or Circles) ... select all of them ... call my code --> SPEED FAST

Using CC2019 ... create 10 Rectangles (or Circles) ... select all of them ... call my code --> SPEED VERY VERY SLOW

I also tried files from my customer ... also SLOW on CC2019!

Silly-V
Legend
April 4, 2019

What a frightening kind of mystery.