Skip to main content
tt27079448
Inspiring
June 13, 2016
Question

JS how to split the object to two diffrent parts ,like this:

  • June 13, 2016
  • 1 reply
  • 928 views

JS how to split the object to two diffrent parts ,like this:

This topic has been closed for replies.

1 reply

Disposition_Dev
Community Expert
June 13, 2016

we're going to need more info about exactly what you're trying to do and the structure of your file so we can help plan for problems..

in it's simplest form, the code would go like this:

function splitParts()

{

     var docRef = app.activeDocument;

     var item1 = docRef.pathItems[0];

     var item2 = docRef.pathItems[1];

     item1.top = item1.top + 50;

     item2.top = item2.top - 50;

}

splitParts();

tt27079448
Inspiring
June 14, 2016

sorry ,

the object have only one pathItems ,have not two pathItems .

Alexander Ladygin
Inspiring
June 14, 2016

As an options:

var s = selection[0],

    i = s.pathItems.length,

    obj = s.parent;

while ( i-- ) s.pathItems.moveToBeginning( obj );

s.remove();