2 Replies Latest reply on Nov 20, 2013 9:28 AM by Ghoulfool

    Multiple selections

    Ghoulfool Level 1

      I have a white image with some black rectangles on it. The black rectanglest differ in size and number of rectangles per image. They can be selected via layermask.

       

      In short: Does the DOM allow you to specify (a) the number of particular selections in a multiple selection and more importantly (b) are they held in an array so they each selection can be identified, isolated and then worked in in a script?

      ie

      select all rectangles
      work out how many there are
      loop over number in selection
           select rectangle[i]
           process selection
      end loop
      
      

       

       

      If there isn't, then I'll have to work this out the hard way which'll involve looking over teh image pixel by pixel and identifying shapes.

        • 1. Re: Multiple selections
          Michael L Hale Level 5

          With the DOM you can check is a selection is one contiguous area with the solid property but that is about it. Rather than checking pixel by pixel you could turn the selection into a temp path. Each of the seperate selected areas will be subpaths in that temp path. The number of subpaths would tell you how many rectangles were selected and you can check the pathPoints to determine the size and position of each rectangle.

          • 2. Re: Multiple selections
            Ghoulfool Level 1

            Thanks, but it might be easier to view the image data after it's been saved out as bmp. The data needs to be pixel accurate and can't have any sub pixel info which might occour from getting a new work path