Showing results for 
Search instead for 
Did you mean: 

Deleting Notes from View




I have created one drafting view with few notes containing some text value.

I am trying to delete that View through journal and it is working good sometime and sometime not.


I have used below code.


Option Strict Off
Imports System
Imports NXOpen

Module NXJournal

Sub Main (ByVal args() As String)

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display

Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Delete")

Dim notifyOnDelete1 As Boolean
notifyOnDelete1 = theSession.Preferences.Modeling.NotifyOnDelete

Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Delete")

Dim objects1(0) As NXObject
Dim drawingView1 As Drawings.DrawingView = CType(workPart.DraftingViews.FindObject("Example"), Drawings.DrawingView)

objects1(0) = drawingView1
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.AddToDeleteList(objects1)

Dim notifyOnDelete2 As Boolean
notifyOnDelete2 = theSession.Preferences.Modeling.NotifyOnDelete

Dim nErrs2 As Integer
nErrs2 = theSession.UpdateManager.DoUpdate(markId2)

theSession.DeleteUndoMark(markId1, Nothing)

End Sub
End Module