NXOpen - Find note that resides in a drawing sheet
NXOpen - Find note that resides in a drawing sheet
(OP)
NX 8.0.3 and NXOpen with VB.Net
I have a drawing part that has five drawing sheets and each sheet has a note named "Supplier_Number".
how can I find the note named "Supplier_Number" that resides in a specific drawing sheet, like sheet2 ?
I have a drawing part that has five drawing sheets and each sheet has a note named "Supplier_Number".
how can I find the note named "Supplier_Number" that resides in a specific drawing sheet, like sheet2 ?





RE: NXOpen - Find note that resides in a drawing sheet
Regards
Frank Swinkels
CODE -->
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Imports NXOpenUI Imports NXOpen.Utilities Imports NXOpen.Annotations Module GetWordInfo Dim s As Session = Session.GetSession() Dim ufs As UFSession = UFSession.GetUFSession() Dim lw As ListingWindow = s.ListingWindow Sub Main() Dim dp As Part = s.Parts.Display Dim nc As NoteCollection = dp.Notes Dim textin As String = "text to find" Try textin = NXInputBox.GetInputString("Get Note Info", "Text to Find", textin) Catch ex As Exception GoTo end1 End Try Dim dwgs As Drawings.DrawingSheetCollection dwgs = dp.DrawingSheets Dim notestring() As String lw.Open() For Each sheet As Drawings.DrawingSheet In dwgs sheet.Open() For Each a_note As Note In nc notestring = a_note.GetText() If notestring(0) = textin Then lw.WriteLine(sheet.Name & " , " & notestring(0)) End If Next Next end1: End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image immediately after execution within NX GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately End Function End ModuleRE: NXOpen - Find note that resides in a drawing sheet
Thank you for your example. Unfortunately is not what I'm looking for.
Here is an example part. http://files.engineering.com/getfile.aspx?folder=64310a39-28cb-4144-8dea-7905ecc589af&file=model1.prt
If I change the journal to search for the text in the second line, and I input "222", the results in the listing window list all the sheets, but the note with "222" it's only on Sheet 2.
When you do "Information Object" on a note, you get information on where it resides (see attached example)
http://files.engineering.com/getfile.aspx?folder=4e15629d-46ff-43f3-8ff1-d3d1550a5b89&file=model1_note_info.txt
I don't know if it's posible to obtain that info with NXOpen.
Thanks
RE: NXOpen - Find note that resides in a drawing sheet
Regards
Frank Swinkels
CODE -->
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Imports NXOpenUI Imports NXOpen.Utilities Imports NXOpen.Annotations Imports NXOpen.Drawings Module GetWordInfo Dim s As Session = Session.GetSession() Dim ufs As UFSession = UFSession.GetUFSession() Dim lw As ListingWindow = s.ListingWindow Dim dp As Part = s.Parts.Display Dim wp As Part = s.Parts.Work Sub Main() Dim nc As NoteCollection = dp.Notes Dim textin As String = "text to find" Dim cnt1 As Integer = Nothing Try textin = NXInputBox.GetInputString("Get Note Info", "Text to Find", textin) Catch ex As Exception GoTo end1 End Try Dim dwgs As Drawings.DrawingSheetCollection = wp.DrawingSheets dwgs = wp.DrawingSheets Dim notestring() As String Dim viewtag As Tag = Tag.Null Dim dc As DrawingSheetCollection = dp.DrawingSheets lw.Open() For Each sheet As DrawingSheet In dc sheet.Open() Dim objs() As DisplayableObject = sheet.View.AskVisibleObjects() For Each obj As DisplayableObject In objs Dim a_Note As Note = CType(obj, Note) notestring = a_Note.GetText() Dim nolines As Integer = notestring.Length Dim found1 As Boolean = False For i As Integer = 0 To nolines - 1 found1 = notestring(i).Contains(textin) If found1 = True Then lw.WriteLine(sheet.Name) For j As Integer = 0 To nolines - 1 lw.WriteLine(" " & notestring(j)) Next End If Next Next Next end1: End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image immediately after execution within NX GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately End Function End ModuleRE: NXOpen - Find note that resides in a drawing sheet
Thank you for the new journal.
I will take a look at it.