optimization - How to select and delete every clipping masks in an Illustrator document using javascript? -
i'm making extend scripts adobe illustrator cs6 (javascript) , need delete every clipping masks of document.
i have solution it's not fast enough in big documents.
here code:
var releaseclippingmasks = function(document) { var pathitems = document.pathitems; log('looking clipping masks among ' + pathitems.length + ' elements'); var n = 0; for(var p = pathitems.length - 1; p >= 0; p--) { if(p / 1000 == math.round(p / 1000)) { log(p + ' remaining'); } if(pathitems[p].clipping) { // accessing element [p] of pathitems takes lot of time pathitems[p].remove(); n++; } } log(n + ' deleted masks'); }
there not many clipping masks in documents, lot of pathitems (100000+), iterating takes long time.
does know better way select every clipping masks in document javascript? appreciated.
the fastest way select clipping mask , delete it:
// select->objects->clipping mask app.executemenucommand("clipping masks menu item"); // edit->clear app.executemenucommand("clear");
Comments
Post a Comment