コード例 #1
0
        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;
        }
コード例 #2
0
        public static IEnumerable <TFCOM.TFBrepFace> GetFacesEx(
            this TFCOM.TFBrepList brepList)
        {
            var res = new HashSet <TFCOM.TFBrepFace>();

            TFCOM.TFBrepFaceList faceList = brepList.GetFaces();
            if (faceList == null || faceList.AsTFBrepFace == null || faceList.GetCount() == 0)
            {
                return(res);
            }

            res.Add(faceList.AsTFBrepFace);
            while (null != (faceList = faceList.GetNext()))
            {
                res.Add(faceList.AsTFBrepFace);
            }
            return(res);
        }