• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do I find a live paint object in an Illustrator script?

Guest
May 23, 2017 May 23, 2017

Copy link to clipboard

Copied

The illustrator file has a layer structure and wants to move the objects in each layer to Artboard.

To do that, you need to figure out the model of the Illustrator object and move it automatically, but you can not find an object called "Live Paint" in the script. I want to know how to find the Live Paint object and select or delete it.

TOPICS
Scripting

Views

971

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
People's Champ ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

Hi,

Seems like liveTrace objects are referenced as PluginItem. However that might be a too generic type to properly grab the livetrace objects ?

FWIW

Loic

www.ozalto.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 24, 2017 May 24, 2017

Copy link to clipboard

Copied

AFAIK, the so called PluginItems have 5 types:

- Flare

- LiveBlends

- Tracing

- Envelope

- LivePaint

The lucky one of them is "Tracing", using `PluginItem.isTracing` property can get it.

// - Tracing

app.selection[0].isTracing;

For the others, we have to do some tests.

First, select one PluginItem a time, and duplicate it.

Then:

// - LivePaint

app.executeMenuCommand('Expand Planet X');

app.selection[0].typename === 'GroupItem';

// - Envelope

app.executeMenuCommand('Release Envelope');

app.selection.length > 1;

// - LiveBlends

app.executeMenuCommand('Path Blend Release');

app.selection.length > 1;

// - Flare

// if not any of above, then it is Flare.

At the end, delete the duplicated(expanded) items.

EDIT:

Wait! Here comes the six type: Symbol Group. So we have to do more tests to distinguish Flare and Symbol Group.

Have one PluginItem selected as the same, then

// - SymbolGroup

activeDocument.defaultStrokeColor.typename === 'NoColor';

// - Flare

// again, if not any of above, then it is Flare.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 13, 2017 Jun 13, 2017

Copy link to clipboard

Copied

Thank you first of all. Moluapple

We attempted to detect the PlugItem's LIvePaint using the code you suggested.

I tested using AI files shared on Google Drive. The code we tested was:

Var doc = app.activeDocument; 

For (var i = 0; i <doc.pluginItems.length; i ++) {    

     If (doc.pluginItems .isTracing)    

     {        

         Alert ('tracing detect');        

         Break;    

      }

}

The first thing we want to do is to find the AI ​​file that Live Paint belongs to

and then use it to change the item with Live Paint to a line with the general properties. Request you to check.

20170607_150900352912_1.ai - Google Drive

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 14, 2017 Jun 14, 2017

Copy link to clipboard

Copied

Hi, to select all live paint objects in active document:

var d = activeDocument,

    pi = d.pluginItems,

    l = pi.length,

    live = [],

    i = 0;

   

for (; i < l; i++) {

    app.selection = null;

    pi.duplicate(d, ElementPlacement.PLACEATBEGINNING).selected = true;

    app.executeMenuCommand('Expand Planet X');

    if (app.selection[0].typename === 'GroupItem') {

        alert('Live Paint detected');

        live.push(pi);

        // doSomething();

    }

    app.selection[0].remove();

}

app.selection = live;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 14, 2017 Jun 14, 2017

Copy link to clipboard

Copied

LATEST

Bravo!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines