Skip to main content
Known Participant
April 6, 2011
Question

Select a subpath (subshape)

  • April 6, 2011
  • 3 replies
  • 4326 views

I have a layer with many subshapes, I want use this subshapes (subpaths) in other layers. How can I to select a subshape (subpath) ? I want to copy paste then.

This topic has been closed for replies.

3 replies

mariusmtaAuthor
Known Participant
April 8, 2011

I don't understand why is not possible to select a subpath, is very easy to find a list with this subpath:

function cTID(s){return charIDToTypeID(s);}
function sTID(s){return stringIDToTypeID(s);}

var ref = new ActionReference();
ref.putEnumerated( cTID('Path'), cTID('Path'), sTID('vectorMask') );
var vMaskDescr = executeActionGet(ref);
var pathContents = vMaskDescr.getObjectValue(sTID('pathContents'));
var pathList = pathContents.getList(sTID('pathComponents'));


var _id1 = sTID("subpathListKey");

for ( cPath=0; cPath<pathList.count; ++cPath ) {
  var curPath = pathList.getObjectValue(cPath).getList(cTID("SbpL"));

  // cTID("slct") ?????

}

I don't know how to continue this script and how to use cTID("slct") to select only one subpath

Inspiring
April 8, 2011

mariusmta wrote:

I don't understand why is not possible to select a subpath, is very easy to find a list with this subpath:

I didn't say is was not possible. I only said that I have not been able to find a way. I have tried several times to construct a executeAction descriptor that would select a subpath and have not been able to create a successful one.

I have also tried to get the path descriptor, remove a subpath from the descriptor, then put that edited descriptor back to the path. That also fails.

No one would be happier that I if someone posted a by to remove a subpath using javascript.

mariusmtaAuthor
Known Participant
April 8, 2011

Thanks for trying Mike, I trying also:


for (i=0; i<pathList.count; ++i) {
  var curPath = pathList.getObjectValue(i); 
  executeAction(cTID("slct"), curPath, DialogModes.NO);
}

But I got the error: the command "Select" is not currently available.

Inspiring
April 6, 2011

Although you can select a subpath in the GUI, I have not found a way to do so with a script. You can get the subpath's info and create a new path from that info as shown in the link Paul posted. But it seems that method does not work with a path that has complex xor shape interactions.

Paul Riggott
Inspiring
April 6, 2011