Deleting Notes from View

Hi,

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

theSession.UpdateManager.ClearErrorList()
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

What happens when it doesn't work? Do you get an error message? If so, what does it say?

HI,

No, I am not getting any error message. It deletes the view but some of the notes which are associated that particular are not getting deleted.

Bhavik S.

What version of NX are you using? Can you email an example file? If so, send it to: info@nxjournaling.com

I am using NX 9.
I have sent you an email with .prt file and code.

Bhavik S.