Exemplo n.º 1
0
        internal static Snap.NX.Chamfer CreateChamfer(Snap.NX.Edge edge, Snap.Number distance1, Snap.Number distance2, bool offsetFaces)
        {
            NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
            NXOpen.Features.ChamferBuilder featureBuilder = workPart.Features.CreateChamferBuilder(null);
            featureBuilder.Option = NXOpen.Features.ChamferBuilder.ChamferOption.TwoOffsets;
            if (offsetFaces)
            {
                featureBuilder.Method = NXOpen.Features.ChamferBuilder.OffsetMethod.FacesAndTrim;
            }
            else
            {
                featureBuilder.Method = NXOpen.Features.ChamferBuilder.OffsetMethod.EdgesAlongFaces;
            }
            featureBuilder.FirstOffset  = distance1.ToString();
            featureBuilder.SecondOffset = distance2.ToString();
            //featureBuilder.Tolerance = Globals.DistanceTolerance;
            ScCollector     collector = workPart.ScCollectors.CreateCollector();
            EdgeTangentRule rule      = workPart.ScRuleFactory.CreateRuleEdgeTangent((NXOpen.Edge)edge, null, false, Globals.AngleTolerance, false, false);

            SelectionIntentRule[] rules = new SelectionIntentRule[] { rule };
            collector.ReplaceRules(rules, false);
            featureBuilder.SmartCollector = collector;
            NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            return((NXOpen.Features.Chamfer)feature);
        }
Exemplo n.º 2
0
        internal static Snap.NX.Chamfer CreateChamfer(Snap.NX.Edge edge, Snap.Number distance, Snap.Number angle)
        {
            NXOpen.Part workPart = (NXOpen.Part)Globals.WorkPart;
            NXOpen.Features.ChamferBuilder featureBuilder = workPart.Features.CreateChamferBuilder(null);
            featureBuilder.Option      = NXOpen.Features.ChamferBuilder.ChamferOption.OffsetAndAngle;
            featureBuilder.FirstOffset = distance.ToString();
            featureBuilder.Angle       = angle.ToString();
            //featureBuilder.Tolerance = Globals.DistanceTolerance;
            ScCollector     collector = workPart.ScCollectors.CreateCollector();
            EdgeTangentRule rule      = workPart.ScRuleFactory.CreateRuleEdgeTangent((NXOpen.Edge)edge, null, true, Globals.AngleTolerance, false, false);

            SelectionIntentRule[] rules = new SelectionIntentRule[] { rule };
            collector.ReplaceRules(rules, false);
            featureBuilder.SmartCollector = collector;
            featureBuilder.AllInstances   = false;
            NXOpen.Features.Feature feature = (NXOpen.Features.Feature)Snap.NX.Feature.CommitFeature(featureBuilder);
            featureBuilder.Destroy();
            return((NXOpen.Features.Chamfer)feature);
        }