list adjacent faces

Hello,

There are surfaces in the part. Some of them are adjacent to eachother. Any idea to find and list (maybe tag) those adjacent faces?

Thanks

You mention both faces and surfaces; do you have a surface (or body) with multiple faces and you want to find the adjacent faces of a given face? Perhaps you have multiple sheet bodies and want to find 2 sheet body faces that have an identical edge (they would be connected by a sew operation)? Or is it something else entirely?

There is a part which includes many sb(sheet bodies). Each four sb are adjacent. Additionally each four sb are staying as groups . Those sb groups have a distance apart from eachother about 100mm.
The code;
-First to find first group which is closest the csys
-Then it should tag those four surface
-Finally perform sew and jump to next group to make the same operations respectively

"Each four sb are staying as groups". Does this mean that there are actual NX groups containing 4 sheet bodies each? If so, it would be fairly easy to iterate through the groups and perform the desired actions on each.

"Closest to csys": which csys? the absolute csys? the WCS? some specified datum csys? If you are doing the same operations on each group, does it matter which one is first?

"tag those four surface": Please elaborate on what you mean by "tagging" the surfaces. Do you want to apply an attribute to each of the surfaces? or something else?

Here I didn't mean nx group. I just mean they seem as a group.
The groups are apart from eachother around 100mm that may help perhaps. Absolute csys that I mentioned is just for a reference point. By the way I just want those sb to be sewed, therefore tagging may not be necessary

To ease realizatoin of the problem, several boxes(not solid body) are spread into a part. The code should find the boxes and sew each of them respectively.

If I understand the situation, you have multiple sheet bodies in the part file - some of which are close enough together that they can be sewn ("groups" of sheet bodies). You want to find each group and sew them together.

If this is the case, my first thought would be to iterate through the sheet bodies in the part and measure distances to the other sheet bodies. Those within a certain tolerance would qualify as "near" bodies and candidates for the sewing process. Taking it a step farther, we might construct a list of "near" bodies for each body and recursively step through the lists to find each group (e.g. body A is near body B and C, body B is near G and H, C is near T and Q - for the sew operation use: A, B, C, G, H, T, and Q). This would handle any group size and the sew operation would use all the sheets that could be sewn and not just an arbitrary number.

The situation is exactly the same as you told. I need vb.net class reference document so as to make the thing as you listed above. Recording distance measurement journal gives me an idea? Another question after finding adjacent surfaces of first group, how can I call them back so as to make those to be sewn?

The programming guide and references are part of the NX help install; unfortunately, the programming stuff is turned off by default. If you have the NX help installer, run it again and make sure the programming documentation is turned on.

Alternately, you can access the NX help online (if you have a webkey account setup).
https://docs.plm.automation.siemens.com/tdoc/nx/11/nx_api/#uid:index

Saving the sheet body data for later use is more a question of data structures and could be handled by objects offered in the .net framework or you could create your own specialty classes/objects for the job. If I were to take on the task, I'd probably start with a dictionary object (the standard one offered in the .net framework). The dictionary works much like a 2 dimensional array, but makes "lookups" easy. Each dictionary has a key/value pair, each key is associated with a value. In this particular case, the key values would be the individual sheet bodies in the part. The value for each key would be a list (another object offered by the .net framework) of the "near" sheet bodies. The program would build up the dictionary by first iterating through the sheet bodies. Add the first sheet body as a key and create an empty list for the value. Take the first sheet body and measure to all the other sheet bodies, if the target sheet body is within a certain distance, add it to the list stored in the value of the dictionary. Move to the next sheet body, add it as the 2nd key and repeat the process. Once the dictionary is built up, now we are ready to look for groups and sew them together. Now we iterate through the dictionary keys. Create a temporary list to hold the sheets we want to sew, add the sheet held in the key of the dictionary and all those listed in the corresponding value list. For each sheet in the value list, look it up in the dictionary and add the sheets near it. Recursively work through each sheet and its near sheets, each "group" will end up in the temporary list. Use the sew command on all the sheets in the temporary list. Repeat the process for the next key in the dictionary to find and sew the next group.

I don't have code that actually does this, so I have not worked out all the details; but I'm fairly sure this approach could be made to work.