In an AutoCAD VBA routine i have made, the program searches for dynamic blocks with a certain name and extracts some dynamic properties - width and height.
What i have so far is a list of all the blocks and their properties but they are not sorted - if a block has the same width and height as another, it simply lists them individually. The block info is in the form of a multi-dimensional array, such as:
PANEL(j, 0) = Panel_ref
PANEL(j, 1) = width
PANEL(j, 2) = height
(j is just a counter within cycling through each block in the selection set.)
What I would to do is be able to sort all these blocks into groups (not autocad groups) of the same size, so if there a few blocks that are 595x455 (width x height) for example, these should be grouped so that there are X number of them (say Panel_ref #1) and not individually tabled. I hope i'm being clear enough.
So bascially, it would look like:
Ref | Width | Height | Quantity
1 | 600 | 800 | 3
2 | 700 | 900 | 1
3 | 650 | 1000 | 2
instead of......
Ref | Width | Height
1 | 600 | 800
2 | 600 | 800
3 | 600 | 800
4 | 700 | 900
5 | 650 | 1000
6 | 650 | 1000
...as it is now. (sorry, i can't format this post any better)
What is the best way to sort this data? I've seen array sorting code online but only for non multi-dim arrays.
I guess i would need to cycle through the array, find the different "sizes" (width and height), store them somewhere and compare the each block to these? I was thinking of converting the width and height to a String ("800 x 600") as comparing these that way but i'm sure it can be done in their number (Double) format.
If need be, i can post some code but thought it might be easier without for now.
Thanks,
Paul.