2 Replies Latest reply on Aug 18, 2014 10:59 PM by CarlosCanto

    Iterate through a set of scatter graph objects (paths) and replace with Brush or Symbol instances.

    wideEyedPupil Level 1

      I am trying to write write a script for Adobe Illustrator (AS or JS) which takes a set of objects and one by one replaces them with a brush style applied to a single point (one anchor path) or a symbol instance. Needs to be accurate as it's a graph with 300 'points'.

       

      Looking for help with the following tasks:

      1. Selecting all the paths belonging to a particular layer named "Replace". (Even if User input to a dialogue is required I only know how to use layer item numbers)
      2. How to get the central co-ordinates of a small path that makes a shape like a triangle, square, circle or diamond. Some of the sets are compound paths but they are all symmetrical but for the triangle and I want the centre (X,Y) to assign as properties for the Brush anchor point or Symbol anchor point.
      3. How to change layers from one layer (containing the set of paths) to a new drawing layer (where script will create the symbols/brush instances)

       

      What I'm also wondering:

      1. Would it be best to iterate the sample set and get cords and draw create the new symbol instance (possibly in a new layer and possibly delete the originating path) one by one as it were? Or be best to run through all the points and create a data record of all the co-ordinates then iterate a second time and create all the objects using the co-ordinates for symbol (X,Y) anchor properties

       

      All I have to work from is the sample Adobe Script that creates a tree symbol the duplicates it around the edges of the page. Not quite there yet :-)

       

      One of the reasons I'm doing this is that I can then stretch the graph to expose the data and not have to transform each to get the shapes back into shape but mainly because some of the paths are very jaggy and ugly out of the stats program (Excel?!).

       

      Sample File: link

       

      Before is like this: Screenshot 2014-08-18 18.40.54.png After is like this: Screenshot 2014-08-18 18.41.40.png