I would like to write a script in which I can extract triangular meshes from a mesh according to a certain flatness in relation to the XY plane... Any ideas how i could start ?
I'd start by comparing the normals of each plane to the world z axis. There's a handly little function that Dale wrote for comparing the angle between two vectors. The "flatness" would basically just be testing to see if that angle is below a certain threshold. One last note, sometimes the normal direction (z vector) of a plane can point down, so I would check and see if the z component of the z vector of your plane is positive or not. If it is, then just call myOn3dVector.Reverse to get it to point "up"