public static bool getFacePlaneByLabel(out BCOM.Plane3d plane, BCOM.Element element, TFCOM.TFdFaceLabel faceLabel) { TFCOM.TFBrepList brepList; var formRecipeList = new TFCOM.TFFormRecipeListClass(); formRecipeList.InitFromElement(element); string options = string.Empty; formRecipeList.GetBrepList(out brepList, false, false, false, ref options); return(getFacePlaneByLabel(out plane, brepList, faceLabel)); }
public static bool getFacePlaneByLabel(out BCOM.Plane3d plane, TFCOM.TFBrepList brepList, TFCOM.TFdFaceLabel faceLabel) { plane = new BCOM.Plane3d(); TFCOM.TFPlane tfPlane; var faceList = brepList.GetFacesByLabel(faceLabel) as TFCOM.TFBrepFaceListClass; if (faceList != null && faceList.IsPlanar(out tfPlane)) { tfPlane.GetNormal(out plane.Normal); { // origin: BCOM.Point3d[] verts; faceList.AsTFBrepFace.GetVertexLocations(out verts); BCOM.ShapeElement shape = App.CreateShapeElement1(null, verts); plane.Origin = shape.Centroid(); } return(true); } return(false); }
public bool getTFPlainFromBrepFace(out TFCOM.TFPlane tfPlain, TFCOM._TFFormRecipeList resipeList, TFCOM.TFdFaceLabel label) { TFCOM.TFBrepList brepList; resipeList.GetBrepList(out brepList, false, false, false); TFCOM.TFBrepFaceList faceList = brepList.GetFacesByLabel(label); //BCOM.Point3d center; //faceList.AsTFBrepFace.GetCenter(out center); //BCOM.Element faceElem; //faceList.GetElement(out faceElem, App.Transform3dIdentity()); //TFCOM.TFPlane tfPlain; return(faceList.AsTFBrepFace.IsPlanar(out tfPlain)); //{ // return true //} //if (!faceElem.IsPlanarElement()) //{ // plane = new BCOM.Plane3d(); // return false; //} //var normal = faceElem.AsPlanarElement().Normal; //plane = new BCOM.Plane3d() { // Normal = normal, // Origin = center //}; //return true; }