Create a mesh based surface using Python to automate model creation

Hi,

I would like to automate the selection of a mesh-based surface through Python. I cannot copy the replay file directly as the geometry of the surface in question may change dependant on certain external variables. The surface in question is not flat. I can identify the relevant geometric surfaces through the findAt() and getFacesByFaceAngle() methods and then use the Surface(…) method to create the surface. I also need to use the SurfaceByBoolean(...) method in some cases to remove certain parts of the surface which are not relevant.

However, even if I identify all of the elements on the surface in question, in order to create an element-based surface I need to use the Surface(...) method which requires that I specify the elements according to: face1Elements = face1Elements,  face2Elements = face2Elements,  ... etc.; where face1Elements is an array of elements which has its FACE1 lying in the plane of the surface in question. I cannot figure out how I can distinguish my array of elements according to the different groups, face1Elements, face2Elements, ... etc., such that I define correct surface.

1) Is there a simple way to identify all of the elements lying on the surface in question?

2) Once I have identified these elements, how can I categorise them into the different groups, face1Elements, face2Elements, ... etc., such that I define correct surface?

I appreciate any help.

Thanks,

Michael