Created
September 7, 2011 09:50
-
-
Save moluapple/1200180 to your computer and use it in GitHub Desktop.
[Illustrator, Scriptographer] Remove Unnecessary PathPoints
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 characters
// This is a Scriptographer script | |
document.getItems({ | |
type: Path, | |
hidden: false | |
}).each(function (path){ | |
var curves = path.curves, i = curves.length - 1, curve, curvePre; | |
for (; i > 0; i--){ | |
curve = curves[i]; | |
curvePre = curve.previous; | |
curve.isLinear() && curvePre.isLinear() && | |
(curve.point2 - curve.point1).angle.toFixed(0) == (curvePre.point2 - curvePre.point1).angle.toFixed(0) && | |
path.remove(i); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Before and after:
