示例#1
0
        /// <summary>
        /// 抽取体
        /// </summary>
        /// <param name="features"></param>
        /// <param name="bodies"></param>
        /// <param name="associative"></param>
        /// <returns></returns>
        public static ExtractFace CreateExtractGeometry(this FeatureCollection features, Body[] bodies, bool associative = false)
        {
            ExtractFaceBuilder extractFaceBuilder = _workPart.Features.CreateExtractFaceBuilder(null);

            extractFaceBuilder.ParentPart = ExtractFaceBuilder.ParentPartType.WorkPart;

            extractFaceBuilder.Associative = associative;

            extractFaceBuilder.FixAtCurrentTimestamp = true;

            extractFaceBuilder.HideOriginal = false;

            extractFaceBuilder.InheritDisplayProperties = false;

            extractFaceBuilder.Type = ExtractFaceBuilder.ExtractType.Body;

            extractFaceBuilder.CopyThreads = false;

            extractFaceBuilder.FeatureOption = ExtractFaceBuilder.FeatureOptionType.SeparateFeatureForEachBody;

            BodyDumbRule bodyDumbRule1 = _workPart.ScRuleFactory.CreateRuleBodyDumb(bodies, true);

            SelectionIntentRule[] rules1 = new SelectionIntentRule[1];
            rules1[0] = bodyDumbRule1;
            extractFaceBuilder.ExtractBodyCollector.ReplaceRules(rules1, false);

            ExtractFace nXObject1 = (ExtractFace)extractFaceBuilder.Commit();

            extractFaceBuilder.Destroy();

            return(nXObject1);
        }
示例#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);
        }