Beispiel #1
0
        internal static Snap.NX.ProjectCurve CreateProjectCurve(Snap.NX.Curve[] curves, Snap.NX.Point[] points, Snap.NX.Face face)
        {
            NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
            NXOpen.Features.ProjectCurveBuilder featureBuilder = workPart.Features.CreateProjectCurveBuilder(null);
            featureBuilder.CurveFitData.Tolerance = Globals.DistanceTolerance;
            featureBuilder.AngleToProjectionVector.RightHandSide = "0";
            featureBuilder.SectionToProject.DistanceTolerance    = Globals.DistanceTolerance;
            featureBuilder.SectionToProject.ChainingTolerance    = (Globals.UnitType == Globals.Unit.Millimeter) ? 0.02413 : 0.00095;
            featureBuilder.SectionToProject.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.CurvesAndPoints);
            featureBuilder.ProjectionDirectionMethod = NXOpen.Features.ProjectCurveBuilder.DirectionType.AlongFaceNormal;
            Snap.NX.Section sectionToProject = featureBuilder.SectionToProject;
            sectionToProject.AddICurve(curves);
            sectionToProject.AddPoints(points);
            ScCollector collector = workPart.ScCollectors.CreateCollector();

            NXOpen.Face[] faces = new NXOpen.Face[] { face };
            FaceDumbRule  rule  = workPart.ScRuleFactory.CreateRuleFaceDumb(faces);

            SelectionIntentRule[] rules = new SelectionIntentRule[] { rule };
            collector.ReplaceRules(rules, false);
            featureBuilder.FaceToProjectTo.Add(collector);
            NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.SectionToProject.CleanMappingData();
            featureBuilder.Destroy();
            return((NXOpen.Features.ProjectCurve)feature);
        }
Beispiel #2
0
        internal static Snap.NX.ProjectCurve CreateProjectCurve(Snap.NX.Curve[] curves, Snap.NX.Point[] points, Snap.NX.DatumPlane datumPlane)
        {
            NXOpen.Features.ProjectCurveBuilder featureBuilder = Globals.WorkPart.NXOpenPart.Features.CreateProjectCurveBuilder(null);
            featureBuilder.CurveFitData.Tolerance = Globals.DistanceTolerance;
            featureBuilder.AngleToProjectionVector.RightHandSide = "0";
            featureBuilder.SectionToProject.DistanceTolerance    = Globals.DistanceTolerance;
            featureBuilder.SectionToProject.ChainingTolerance    = (Globals.UnitType == Globals.Unit.Millimeter) ? 0.02413 : 0.00095;
            featureBuilder.SectionToProject.SetAllowedEntityTypes(NXOpen.Section.AllowTypes.CurvesAndPoints);
            Snap.NX.Section sectionToProject = featureBuilder.SectionToProject;
            sectionToProject.AddICurve(curves);
            sectionToProject.AddPoints(points);
            Position origin = datumPlane.Origin;
            Vector   normal = datumPlane.Normal;

            NXOpen.Plane plane = Globals.NXOpenWorkPart.Planes.CreatePlane((Point3d)origin, (Vector3d)normal, SmartObject.UpdateOption.WithinModeling);
            featureBuilder.PlaneToProjectTo = plane;
            NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.SectionToProject.CleanMappingData();
            featureBuilder.Destroy();
            return((NXOpen.Features.ProjectCurve)feature);
        }