Example #1
0
        internal static Snap.NX.ExtractFace CreateExtractFace(Snap.NX.Face[] faces)
        {
            NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
            NXOpen.Features.ExtractFaceBuilder featureBuilder = workPart.Features.CreateExtractFaceBuilder(null);
            featureBuilder.FaceOption = NXOpen.Features.ExtractFaceBuilder.FaceOptionType.FaceChain;
            NXOpen.Face[] faceArray = new NXOpen.Face[faces.Length];
            for (int i = 0; i < faces.Length; i++)
            {
                faceArray[i] = (NXOpen.Face)faces[i];
            }
            FaceDumbRule rule = workPart.ScRuleFactory.CreateRuleFaceDumb(faceArray);

            SelectionIntentRule[] rules = new SelectionIntentRule[] { rule };
            featureBuilder.FaceChain.ReplaceRules(rules, false);
            NXOpen.Features.ExtractFace extract = (NXOpen.Features.ExtractFace)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            return(new Snap.NX.ExtractFace(extract));
        }
Example #2
0
        /// <summary>
        /// 抽取面,返回面
        /// </summary>
        /// <param name="features"></param>
        /// <param name="face"></param>
        /// <param name="associative"></param>
        /// <returns></returns>
        public static ExtractFace CreateExtractGeometry(this FeatureCollection features, Face face, bool associative = false)
        {
            NXOpen.Features.ExtractFaceBuilder extractFaceBuilder = _workPart.Features.CreateExtractFaceBuilder(null);
            extractFaceBuilder.ParentPart               = NXOpen.Features.ExtractFaceBuilder.ParentPartType.WorkPart;
            extractFaceBuilder.Associative              = associative;
            extractFaceBuilder.FixAtCurrentTimestamp    = true;
            extractFaceBuilder.HideOriginal             = false;
            extractFaceBuilder.DeleteHoles              = false;
            extractFaceBuilder.InheritDisplayProperties = false;
            extractFaceBuilder.Type = NXOpen.Features.ExtractFaceBuilder.ExtractType.Face;
            bool added;

            added = extractFaceBuilder.ObjectToExtract.Add(face);
            ExtractFace extractedFace = (ExtractFace)extractFaceBuilder.Commit();

            extractFaceBuilder.Destroy();
            return(extractedFace);
        }