Last active
January 19, 2016 04:08
-
-
Save moxuse/c07744ea5c54a5508406 to your computer and use it in GitHub Desktop.
Adobe script. Split all anchors of path to json array
This file contains 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
#target illustrator | |
var sel = app.activeDocument.selection; | |
var height_ = app.activeDocument.height | |
var file = File.saveDialog('save centers', 'center:*.txt'); | |
var height_ = app.activeDocument.height | |
file.open('w') | |
file.write("[\n") | |
for(var i = 0; i < sel.length; i++){ | |
if(sel[i].typename == "PathItem"){ | |
var points = sel[i].pathPoints; | |
$.writeln(points) | |
for (var j = 0; j< points.length; j++) { | |
var pos = points[j].anchor; | |
file.write("\t{\"x\": "+ pos[0] + " , \"y\": "+ (height_ - pos[1]) +"}"); | |
if (j != points.length-1) { | |
file.write(",") | |
} | |
file.write("\n") | |
} | |
} | |
} | |
file.write("]") | |
file.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.aiファイルのパス状態でスクリプトを使うと、y座標がずれます。一度svgファイルにして開き直してからスクリプト走らせてください