Last active
May 30, 2018 20:59
-
-
Save nicoptere/627126178002f8a50d551b3cfa8fa18d to your computer and use it in GitHub Desktop.
Revisions
-
nicoptere revised this gist
May 30, 2018 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,10 +12,16 @@ for (i=0 ; i< document.pathItems.length; i++) var dx = p0[0] - p1[0]; var dy = p0[1] - p1[1]; l += Math.sqrt( dx*dx + dy*dy ); if( l > maxLength )break; } if( l < maxLength ) { try{ ipath.selected = true; } catch( e ){ //meh... } } } app.redraw(); -
nicoptere created this gist
May 30, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #target illustrator var document = app.activeDocument; var maxLength = prompt ("maximum length of a path", 10, "destroy them with lasers!"); for (i=0 ; i< document.pathItems.length; i++) { var ipath = document.pathItems[i] if( ipath.hidden == true )continue; var l = 0; for( var j = 0; j < ipath.pathPoints.length - 1; j++ ){ var p0 = ipath.pathPoints[j].anchor; var p1 = ipath.pathPoints[j+1].anchor; var dx = p0[0] - p1[0]; var dy = p0[1] - p1[1]; l += Math.sqrt( dx*dx + dy*dy ); } if( l < maxLength ) { ipath.selected = true; } } app.redraw(); if(confirm ("erase?", "yes", "my finger is on the button...")) { app.cut(); }