Skip to main content
Participant
August 10, 2012
Question

Fast way to change fill colour of many objects

  • August 10, 2012
  • 1 reply
  • 934 views

I am currently navigating the document model through all objects and manually adjusting the fill colour of desired objects.

For example, for each layer, I iterate through the GroupItems, CompoundPathItems, PathItems, in the GroupItems I navigate the GroupItems, CompoundPathItems, PathItems, etc.

In order to change all the colours of the objects, it ends up taking over a minute to accomplish.  But in the Illustrator UI, I can select a very complicated group item and change it's colour very fast.  In the SDK, GroupItem does not have a fill colour parameter, so I have to iterate through all sub-items to change the colour.

Is there a better way?  This seems so slow.

...Matt

This topic has been closed for replies.

1 reply

A. Patterson
Inspiring
August 10, 2012

There is a method AIPathStyleSuite::AdjustObjectAIColors() which takes a callback for updating a colour. You can tell it to visit just fill colours only. I don't know what happens if you call that on a group though; does it find all the children with fill colours automatically? If not, you might be able to sue the AIArtSetSuite to get all the art of a particular type from a layer and then run AdjustObjectAIColors() on each?

In genearl, if AI can do it, we can. Though it's not always obvious how