Hi,
I have an assembly with 2 parts and all faces of both parts have a property attached using SetEntityName(). The faces were named at the time of part creation.
I want to get a handle to two such faces from the two parts (say "Face1" and "Face2") and mate the two parts using these faces.
I am having trouble selecting these faces. I am able to get the components from the assembly but not able to iterate through the faces. Kindly advise.
I am very new to SW API
Component2 part = assemb.GetComponentByName("cbf_pkgoutline_btm-1");
object[] arrBody = (object[])part.GetBodies2((int)swBodyType_e.swSolidBody);
if (arrBody.Length > 0)
{
Body2 body = (Body2)arrBody[0];
object[] faces = (object[]) body.GetFaces();
foreach (object f in faces)
{
if (((PartDoc)part).GetEntityName((Face2)f) == "face2") //getting an exception at this point
}
}
Thanks
Hersh