looping first level child components if >1

Hi,

I am writing a code that will run on first level child components & if child componenents >1 i have to check transformation matrix of that particular component, i have written below but it take all child components, dont know what is the efficient way to modify this

Assy
-subassy1
-standard parts x10
-standard parts X20

so code should only work on standard parts x10 & check transformation matrix between only these 10
& second time 20 standards should be checked again
Dictionary counts = new Dictionary();
for (int i = 0; i < cmp1.Length; i++)
{

NXObject obj = (NXObject)theSession.GetObjectManager().GetTaggedObject(cmp1[i].Tag);
if (obj.IsOccurrence)
{
if (!IsLoadedComponent(cmp1[i])) continue; /* Component not Loaded */
if (IsSuppressedComponent(cmp1[i])) continue; /* Component is Suppressed */
string partName = string.Empty;
string refSetName = string.Empty;
string instanceName = string.Empty;

double[] origin = new double[3];
double[] csysMatrix = new double[9];
double[,] transform = new double[4, 4];

theUFS.Assem.AskComponentData(cmp1[i].Tag, out partName, out refSetName, out instanceName, origin, csysMatrix, transform);
counts.Add(cmp1[i].Tag,transform);
}

for (int i = 0; i < counts.Count; i++)
{
var item = counts.ElementAt(i);
for (int j = i + 1; j < counts.Count; j++)
{
var item1 = counts.ElementAt(j);
if (boxesOverlap(item.Value, item1.Value))
{
// Body bdy = (Body)theSession.GetObjectManager().GetTaggedObject(occs[i]);
if (!interfereBodies.Contains(item.Key))
{

interfereBodies.Add(item.Key);
}
}
}
}

can you please guide/help ?

Assy
-subassy1
-standard part A x10
-standard part B X20

Given this structure, the assembly (Assy) has 31 first level child components (1 subassy, 10 standard part A, and 20 standard part B). It sounds like you want to sort these into groups of "unique components" and process each group separately.

If my understanding is correct, I have 2 ideas:
1) loop through the first level children and use "AskOccsOfPart" to get all the components of a given part. The downside here is that if any of the parts are used in lower levels of the assembly, they might be picked up as well. In other words, if subassy1 contains any of "standard part A", you might get those along with the ones in the top level.

2) create a dictionary(of string, list(of component)), loop through the first level components. Check the component.prototype.owningpart.fullpath (the path of the component part file), if it doesn't exist in the dictionary, add it as a key and add the component to the list in the value. If the path already exists in the dictionary, add the component to its list of components. When you are done, the dictionary will contain a list of components for each unique part file path.

thanks for the logic it solved my issue