Skip to content

Instantly share code, notes, and snippets.

@lm913
Last active December 16, 2015 16:44
Show Gist options
  • Save lm913/7f571461565540797eea to your computer and use it in GitHub Desktop.
Save lm913/7f571461565540797eea to your computer and use it in GitHub Desktop.
Consistent counting of path points for determining complexity
var docRef = app.activeDocument;
try{
var numPaths = docRef.pathItems.length;
var topPath = docRef.pathItems[0];
var topPathSub = docRef.pathItems[0].subPathItems[0];
if (numPaths > 0){
topPath.makeSelection();
docRef.selection.makeWorkPath(5);
docRef.pathItems["Work Path"].name = "CountPathPoints";
alert(docRef.pathItems["CountPathPoints"].subPathItems[0].pathPoints.length);
}
docRef.pathItems["CountPathPoints"].remove();
}
catch (numPaths) {
alert("No paths exist!");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment