Solve your problem in the same manner you laid it out, one step at a time!
It appears your steps are:
- Collect component data: PN, coordinates (you indicate X,Y... Z left out in the cold?), etc.
- Sort those coordinates (By Y then X)
- Identify some 'undesirable' parts based on position and Part number to remove from the set
- Assign new 'Instance properties' to the items in the set
Lets talk step 1:
- First and foremost, I don't know what you're programming experience is, and since you've provided no code, I wont either. I'll assume you know how to do stuff and simply just not what to do now. You'll need to google and research how to utilize the following suggestions (a good rule in programming and in life in general!)
- You'll need to loop through each of the components and keep track of the occurrences and their coordinates. You'll need the occurrences since you'll need them later to add Instance Properties to as you wont know the value as you work through the set.
- In general, regarding arrays, I would recommend you use more sophisticated datatypes such as List(of <type>) or Dictionary(of <type>,<type>), etc., rather than arrays (no one should use arrays unless they know why they are a better solution for their current problem, a they're usually not.) These enhanced datatypes give you capabilities like 'Sort'. However, that is complicated by the fact you are looking to build a matrix and not a List
- Since you want to build a matrix, I would suggest you try a DataTable, which you can add different columns with different datatypes to the table, keep track of the Occurrence, Part Number, Coordinates, etc. You can sort on various columns and work through the data in a logical manner.
Best of Luck
---------------------------------------------------------------------------------------------------------------------------------
If you find this reply helpful or insightful, please use the 'Accept as Solution' or 'Kudos' button below.