示例#1
0
        public void GetInterferenceOfArea()
        {
            Body        eleBody       = GetOccsInBods(this.eleModel.PartTag)[0];
            Body        workpieceBody = GetOccsInBods(this.workpiece)[0];
            List <Face> faces         = AnalysisUtils.SetInterferenceOutFace(eleBody, workpieceBody);
            double      minArea       = 0;

            for (int i = 0; i < (faces.Count) / 2 - 1; i++)
            {
                FaceData data1 = FaceUtils.AskFaceData(faces[i * 2]);
                FaceData data2 = FaceUtils.AskFaceData(faces[i * 2 + 1]);
                if (data1.Equals(data2))
                {
                    double area1 = FaceUtils.GetFaceArea(faces[i * 2]);
                    double area2 = FaceUtils.GetFaceArea(faces[i * 2 + 1]);
                    if (area1 > area2)
                    {
                        minArea += area2;
                    }
                    else
                    {
                        minArea += area1;
                    }
                }
            }
            AttributeUtils.AttributeOperation("Area", minArea, this.eleModel.PartTag);
        }
示例#2
0
        /// <summary>
        /// 干涉面
        /// </summary>
        public void GetInterferenceOfFace()
        {
            List <Tag>  outFace       = new List <Tag>();
            Body        eleBody       = GetOccsInBods(this.eleModel.PartTag)[0];
            Body        workpieceBody = GetOccsInBods(this.workpiece)[0];
            List <Face> faces         = AnalysisUtils.SetInterferenceOutFace(eleBody, workpieceBody);

            for (int i = 0; i < (faces.Count) / 2 - 1; i++)
            {
                FaceData data1 = FaceUtils.AskFaceData(faces[i * 2]);
                FaceData data2 = FaceUtils.AskFaceData(faces[i * 2 + 1]);
                if (data1.Equals(data2))
                {
                    Tag face3;
                    NXOpen.Features.Feature feat1 = AssmbliesUtils.WaveFace(faces[i * 2]);
                    NXOpen.Features.Feature feat2 = AssmbliesUtils.WaveFace(faces[i * 2 + 1]);
                    Body[] bodys1 = (feat1 as NXOpen.Features.BodyFeature).GetBodies();
                    Body[] bodys2 = (feat2 as NXOpen.Features.BodyFeature).GetBodies();

                    Tag bodyTag1 = Intersect(bodys1[0], bodys2[0]);
                    if (bodyTag1 != Tag.Null)
                    {
                        outFace.Add(bodyTag1);
                    }
                }
            }
            SewSolidBody(outFace);
        }