public static Snap.NX.TrimBody Wrap(Tag nxopenTrimBodyTag) { if (nxopenTrimBodyTag == Tag.Null) { throw new ArgumentException("Input tag is NXOpen.Tag.Null"); } TrimBody2 objectFromTag = Snap.NX.NXObject.GetObjectFromTag(nxopenTrimBodyTag) as TrimBody2; if (objectFromTag == null) { throw new ArgumentException("Input tag doesn't belong to an NXOpen.Features.TrimBody2 object"); } return objectFromTag; }
internal static Snap.NX.TrimBody CreateTrimBody(Snap.NX.Body targetBody, Snap.NX.Face toolFace, bool direction) { NXOpen.Part workPart = (NXOpen.Part) Globals.WorkPart; TrimBody2Builder featureBuilder = workPart.Features.CreateTrimBody2Builder(null); featureBuilder.Tolerance = Globals.DistanceTolerance; featureBuilder.BooleanTool.ExtrudeRevolveTool.ToolSection.DistanceTolerance = Globals.DistanceTolerance; featureBuilder.BooleanTool.ExtrudeRevolveTool.ToolSection.ChainingTolerance = (Globals.UnitType == Globals.Unit.Millimeter) ? 0.02413 : 0.00095; ScCollector collector = workPart.ScCollectors.CreateCollector(); NXOpen.Body[] bodies = new NXOpen.Body[] { targetBody }; BodyDumbRule rule = workPart.ScRuleFactory.CreateRuleBodyDumb(bodies); SelectionIntentRule[] rules = new SelectionIntentRule[] { rule }; collector.ReplaceRules(rules, false); featureBuilder.TargetBodyCollector = collector; SelectionIntentRule[] ruleArray2 = new SelectionIntentRule[] { workPart.ScRuleFactory.CreateRuleFaceBody((NXOpen.Body) toolFace.Body) }; featureBuilder.BooleanTool.FacePlaneTool.ToolFaces.FaceCollector.ReplaceRules(ruleArray2, false); featureBuilder.BooleanTool.ReverseDirection = direction; TrimBody2 trim = (TrimBody2) Snap.NX.Feature.CommitFeature(featureBuilder); featureBuilder.Destroy(); return new Snap.NX.TrimBody(trim); }
internal TrimBody(TrimBody2 trim) : base(trim) { this.NXOpenTrimBody = trim; }