aluminum2
Aerospace
- Apr 27, 2010
- 218
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:
'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