예제 #1
0
파일: Sew.cs 프로젝트: suifengsigan/TEST_1
 internal static Snap.NX.Sew CreateSew(Snap.NX.Body targetBody, Snap.NX.Body[] toolBodies)
 {
     NXOpen.Features.SewBuilder featureBuilder = Globals.WorkPart.NXOpenPart.Features.CreateSewBuilder(null);
     featureBuilder.Type      = NXOpen.Features.SewBuilder.Types.Sheet;
     featureBuilder.Tolerance = Globals.DistanceTolerance;
     featureBuilder.TargetBodies.Add((DisplayableObject)targetBody);
     for (int i = 0; i < toolBodies.Length; i++)
     {
         featureBuilder.ToolBodies.Add((DisplayableObject)toolBodies[i]);
     }
     NXOpen.Features.Sew sew = (NXOpen.Features.Sew)Snap.NX.Feature.CommitFeature(featureBuilder);
     featureBuilder.Destroy();
     return(new Snap.NX.Sew(sew));
 }
예제 #2
0
        /// <summary>
        /// 缝合体
        /// </summary>
        /// <param name="features"></param>
        /// <param name="bodiesToSew">要缝合的体,第一个体将被作为目标体,剩余体用作工具体</param>
        public static Sew CreateSew(this FeatureCollection features, Body[] bodiesToSew)
        {
            NXOpen.Features.SewBuilder sewBuilder = WorkPart.Features.CreateSewBuilder(null);

            sewBuilder.Tolerance = 0.01;

            bool added1 = sewBuilder.TargetBodies.Add(bodiesToSew[0]);

            List <Body> toolBodies = bodiesToSew.ToList();

            toolBodies.RemoveAt(0);

            bool added2 = sewBuilder.ToolBodies.Add(toolBodies.ToArray());

            Sew nXObject1 = (Sew)sewBuilder.Commit();

            sewBuilder.Destroy();

            return(nXObject1);
        }