How do I find SpaceClaim faces and rename them via scripting?

Using scripting with a csv file of face centroids and desired group names to automate assignment of group names.

A geometry may have numerous faces for which a unique Group name is desired, especially for meshing, pre-processing. or post-processing.  The user could individually and manually generate a Group for each face as usual.  However, this could become inconvenient if the number of faces to Group huge.

Below is an example of 20 thin plates.  A unique group name is desired on each side of each plate; therefore, 40 Groups need to be generated.  

screen1

The plates are 1mm thick.  They are offset as a pattern with spacing 10mm.

A csv file should be generated with the coordinate of the face centroid along with the desired face name.  In this case only the Y-coordinate is included.  The X- and Z-coordinates could also be included.

screen2

The script below loops through the csv file and all the active faces.  As it loops it checks the centroid of a face against the desired Y-coordinate from the csv file.

screen3

The path name needs to be updated to match the true location of the csv file.

The result is a list of Groups.

screen4

The script is applied only on active bodies. 

The script does not work if there are two or more faces within the same tolerance.   The tolerance, "tol" (in meters) should be set to find only one unique face.  Shared faces should be avoided by temporarily suppressing a surrounding body.   For example, if the stack of plates is surrounded by a fluid body, the fluid body should be temporarily suppressed before running the script.