Пример #1
0
        public Tag CreateSheet()
        {
            UFSession    ufsession    = UFSession.GetUFSession();
            Point3d      point3d      = V2.MidPoint3d(V3);
            Session      session      = Session.GetSession();
            Part         work         = session.Parts.Work;
            RuledBuilder ruledBuilder = work.Features.CreateRuledBuilder(null);

#if NX12
            CurveDumbRule curveDumbRule = (work as BasePart).ScRuleFactory.CreateRuleCurveDumbFromPoints(new Point[] { work.Points.CreatePoint(V1) });
#else
            CurveDumbRule curveDumbRule = work.ScRuleFactory.CreateRuleCurveDumbFromPoints(new Point[] { work.Points.CreatePoint(V1) });
#endif

            ruledBuilder.FirstSection.AddToSection(new SelectionIntentRule[]
            {
                curveDumbRule
            }, null, null, null, default(Point3d), Section.Mode.Create, false);
            Line line = work.Curves.CreateLine(V2, V3);
#if NX12
            CurveDumbRule curveDumbRule2 = (work as BasePart).ScRuleFactory.CreateRuleCurveDumb(new Curve[] { line });
#else
            CurveDumbRule curveDumbRule2 = work.ScRuleFactory.CreateRuleCurveDumb(new Curve[]
                                                                                  { line });
#endif
            ruledBuilder.SecondSection.AddToSection(new SelectionIntentRule[]
            {
                curveDumbRule2
            }, null, null, null, default(Point3d), Section.Mode.Create, false);
            ruledBuilder.PositionTolerance         = 0.001;
            ruledBuilder.AlignmentMethod.AlignType = AlignmentMethodBuilder.Type.SpineCurve;
            ruledBuilder.AlignmentMethod.AlignCurve.DistanceTolerance = 0.01;
            ruledBuilder.FirstSection.DistanceTolerance  = 0.01;
            ruledBuilder.SecondSection.DistanceTolerance = 0.01;
            ruledBuilder.FirstSection.SetAllowedEntityTypes(Section.AllowTypes.CurvesAndPoints);
            ruledBuilder.SecondSection.SetAllowedEntityTypes(Section.AllowTypes.CurvesAndPoints);
            NXObject nxobject = ruledBuilder.Commit();
            Ruled    ruled    = nxobject as Ruled;
            Body     body     = (ruled != null) ? ruled.GetBodies()[0] : null;
            ufsession.Modl.DeleteBodyParms(new Tag[]
            {
                body.Tag
            });
            line.Delete();
            return(body.Tag);
        }