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.
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
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.
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.
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;
Copy link to clipboard
Copied
Bravo!