Skip to content

Instantly share code, notes, and snippets.

@moluapple
Created September 7, 2011 09:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save moluapple/1200180 to your computer and use it in GitHub Desktop.
Save moluapple/1200180 to your computer and use it in GitHub Desktop.
[Illustrator, Scriptographer] Remove Unnecessary PathPoints
// 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);
}
});
@moluapple
Copy link
Author

Before and after:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment