trying to use a journal to find note location on current drafting sheet
trying to use a journal to find note location on current drafting sheet
(OP)
I am trying to get a location of a note with the word DWN in it on the current sheet. I was able to get the program to find it and do something, but I can't seem to get the location. I saw a command called get origin and not sure if I am using it correctly. the open api reference said the following
public void GetOrigin(
out Annotation..::..AssociativeOriginData originData,
out Point3d origin
)
CODE --> .net
'Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UI
Imports NXOpen.UF
Imports NXOpen.Annotations
Imports NXOpen.Drawings
Module report_note_location_in_current_drawing_sheets
Dim s As Session = Session.GetSession()
Dim lw As ListingWindow = s.ListingWindow
Dim dp As Part = s.Parts.Display
Dim dc As DrawingSheetCollection = dp.DrawingSheets
Dim ufs As UFSession = UFSession.GetUFSession()
Sub Main()
lw.Open()
Dim sheetArray As DrawingSheet() = dc.ToArray()
Dim currentSheet As DrawingSheet = dc.CurrentDrawingSheet
lw.WriteLine("Sheet Name: " & currentSheet.Name)
Dim objs As DisplayableObject() = currentSheet.View.AskVisibleObjects()
For Each obj As DisplayableObject in objs
'lw.WriteLine(" DisplayableObject: " & obj.ToString())
If (TypeOf obj Is Note) Then
Dim theNote As Note = CType(obj, Note)
For Each text_line As String In theNote.GetText()
if text_line = "DWN" then
dim point as point3d
point = text_line.GetOrigin()
lw.WriteLine(" -> Note: " & text_line)
lw.WriteLine(point)
end if
Next
End If
Next
lw.WriteLine(" ")
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module 




RE: trying to use a journal to find note location on current drafting sheet
CODE
if text_line.ToUpper.Contains("DWN") then dim point as point3d point = theNote.AnnotationOrigin . . . lw.WriteLine(point.ToString)Also, I modified the code slightly to see if the line of text contains the string "DWN" rather than checking that the line of the note exactly equals the string "DWN". This may or may not be desirable based on your needs.
www.nxjournaling.com