Example #1
0
        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);
        }