How to add an object that exists in a document to an existing group in a document?

Explorer ,
Jul 13, 2022 Jul 13, 2022

Copy link to clipboard

Copied

the Illustrator Scripting Guide has an example of creating a group of pathItems
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var triangleGroup = app.activeDocument.groupItems.add();

// Create a triangle and add text, the new art is created inside the group
var trianglePath = triangleGroup.pathItems.add();
trianglePath.setEntirePath(Array(Array(100, 100), Array(300, 100), Array(200, Math.tan(1.0471975) * 100 + 100)));
trianglePath.closed = true;
trianglePath.stroked = true;
trianglePath.filled = false;
trianglePath.strokeWidth = 3;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

But it shows the process for newly created pathItems

Let's say that in the scene there is an pathItem called "Line01". How to add this pathItem to the group "Group 01"???

 
TOPICS
Scripting

Views

51

Likes

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

correct answers 1 Correct answer

Adobe Community Professional , Jul 13, 2022 Jul 13, 2022

try this

 

var idoc = app.activeDocument;
idoc.pageItems["Line01"].move (idoc.pageItems["Group 01"], ElementPlacement.PLACEATBEGINNING);

Likes

Translate

Translate
Adobe Community Professional ,
Jul 13, 2022 Jul 13, 2022

Copy link to clipboard

Copied

LATEST

try this

 

var idoc = app.activeDocument;
idoc.pageItems["Line01"].move (idoc.pageItems["Group 01"], ElementPlacement.PLACEATBEGINNING);

Likes

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