×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

I think what you really want is the AnnotationOrigin property of the note object. You will need to get this information from the note object theNote, rather than the string variable text_line.

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources