How to get the x/y position of multiple points on an artboard


Question

I've got a bunch of objects on an artboard and I'd like to know the X/Y positions of them all. It would be fine to either have pixel values, or a % from the sides of the artboard.

Importantly, I don't want to just click each one and then copy down the values stored in their position fields. Ideally I could generate a list of:

object_name : x_position, y_position

values. Anyone have an idea how I could accomplish something like this in Illustrator or Inkscape?

1
1
5/13/2015 10:06:00 AM

Accepted Answer

You can also do this with Illustrator scripting, with same caveat as @Wrzlprmft's answer that objects have to be at top level. (you can recurse the for loop for groups compound paths etc if you wish. This is a quick example after all):

#target illustrator

var sel = app.activeDocument.selection; 
var file = File.saveDialog('save centers', 'center:*.txt');
file.open('w')

for(var i = 0; i < sel.length; i++){
      if(sel[i].typename == "PathItem"){
          var obj = sel[i];
          var center = obj.position
          center[0] -= obj.width/2.0;
          center[1] += obj.height/2.0;  
          file.write(obj.name+" : "+center[0]  + ", "+center[1]+"\n"); 
      }
}

file.close();

Script asks for file name and dumps data into it (without warning!). To run put in a .jsx file and drag and drop to illustrator or use extendScript toolkit.

3
4/13/2017 12:46:00 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow


Website under construction!!!
^