I have written a Visual C++ COM program that goes through an assembly and prints out the origins of faces and distances between faces. However, the values are usually not meaningful. Most of the faces have a reported origin of (0, 0, 0), and distances usually come out as -1. I would like to get the relative geometric relationships between faces, but these values are not useful.
To get the faces, my code gets the bodies for each component and then the faces for each body. To get the origin of a face, the code gets the ISurface for a face and then gets the parameters for the surface. For example, for a cylinder, I use the ISurface method get_CylinderParams(), which returns the origin, axis, and radius of the cylinder. The radius is reported correctly, but the origin is usually (0, 0, 0), which gives no useful information about the orientation of the face in the assembly.
I also use the IMeasure Calculate() method. I put two faces into a VARIANT array and pass them to Calculate(). Then I call IMeasure methods like get_DeltaX(), get_Distance(), and get_TotalArea(). Most of these methods return the value -1, except for get_TotalArea(), which seems to correctly return the total area of the two faces. I really need the DeltaX, DeltaY, and DeltaZ values, and I don't know why they are returned as -1 while get_TotalArea() is able to return a correct value.
Any hints or suggestions about these issues would be appreciated.