예제 #1
0
        internal static Snap.Position[] PointSet(Snap.NX.ICurve icurve, int pointCount)
        {
            Globals.UndoMarkId markId  = Globals.SetUndoMark(Globals.MarkVisibility.Invisible, "Snap_PositionArray_EqualParameter999");
            PointSetBuilder    builder = Globals.WorkPart.NXOpenPart.Features.CreatePointSetBuilder(null);

            builder.Type          = PointSetBuilder.Types.CurvePoints;
            builder.CurvePointsBy = PointSetBuilder.CurvePointsType.EqualArcLength;
            builder.Associative   = false;
            builder.NumberOfPointsExpression.RightHandSide = pointCount.ToString();
            builder.StartPercentage.RightHandSide          = "0";
            builder.EndPercentage.RightHandSide            = "100";
            SelectionIntentRule[] rules = Snap.NX.Section.CreateSelectionIntentRule(new Snap.NX.ICurve[] { icurve });
            NXOpen.NXObject       nXOpenTaggedObject = (NXOpen.NXObject)icurve.NXOpenTaggedObject;
            builder.SingleCurveOrEdgeCollector.AddToSection(rules, nXOpenTaggedObject, null, null, (Point3d)icurve.StartPoint, NXOpen.Section.Mode.Create, false);
            builder.Commit();
            NXOpen.NXObject[] committedObjects = builder.GetCommittedObjects();
            builder.Destroy();
            Snap.Position[] positionArray = new Snap.Position[committedObjects.Length];
            for (int i = 0; i < positionArray.Length; i++)
            {
                TaggedObject  obj3  = committedObjects[i];
                Snap.NX.Point point = (NXOpen.Point)obj3;
                positionArray[i] = point.Position;
            }
            Globals.UndoToMark(markId, "Snap_PositionArray_EqualParameter999");
            Globals.DeleteUndoMark(markId, "Snap_PositionArray_EqualParameter999");
            return(positionArray);
        }
예제 #2
0
 public static void Delete(params Snap.NX.NXObject[] nxObjects)
 {
     NXOpen.NXObject[] objects = new NXOpen.NXObject[nxObjects.Length];
     for (int i = 0; i < nxObjects.Length; i++)
     {
         objects[i] = (NXOpen.NXObject)nxObjects[i].NXOpenTaggedObject;
     }
     Globals.UndoMarkId markId = Globals.SetUndoMark(Globals.MarkVisibility.Visible, "Snap_DeleteNXObjects999");
     Globals.Session.UpdateManager.ClearErrorList();
     Globals.Session.UpdateManager.AddToDeleteList(objects);
     Globals.Session.UpdateManager.DoUpdate((Session.UndoMarkId)markId);
     Globals.DeleteUndoMark(markId, "Snap_DeleteNXObjects999");
 }