NXOPEN-CPP

I am just trying to read annotation data from NX file through c++.
Can someone help me out.
I am especially trying for jog details under annotation.
please come out with function, to get jogs details, under annotation.

Please guide me with functions.

Any doubt in my enquiry, please write to me.
karthiktec92@gmail.com

You can get the jog information from the leader data, which you get from the drafting note builder. The code below is in VB, but hopefully the concept will be clear.

When you run the journal, it will prompt you to select a label; when a label is selected, it will report the jog locations (if there are any jogs).

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession

Sub Main()

If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If

Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Const undoMarkName As String = "report label jogs"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

Dim myLabel As Annotations.Label = Nothing
If SelectLabel(myLabel) = Selection.Response.Cancel Then
Return
End If

Dim draftingNoteBuilder1 As Annotations.DraftingNoteBuilder
draftingNoteBuilder1 = workPart.Annotations.CreateDraftingNoteBuilder(myLabel)

For Each tempLeader As Annotations.LeaderData In draftingNoteBuilder1.Leader.Leaders.GetContents
Dim leaderData1 As Annotations.LeaderData
leaderData1 = draftingNoteBuilder1.Leader.Leaders.FindItem(draftingNoteBuilder1.Leader.Leaders.FindIndex(tempLeader))

lw.WriteLine("leader has " & leaderData1.Jogs.Size.ToString & " jogs")
For Each tempJog As SelectObject In leaderData1.Jogs.GetSelectObjectArray

Dim selObj As TaggedObject
Dim selView As View
Dim selPt As Point3d
tempJog.GetValue(selObj, selView, selPt)

lw.WriteLine(" jog location: " & selPt.ToString)

Next

Next

lw.Close()

End Sub

Function SelectLabel(ByRef selLabel As Annotations.Label) As Selection.Response

Dim theUI As UI = UI.GetUI
Dim prompt As String = "Select a label"
Dim title As String = "Select a label"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
Dim cursor As Point3d
Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
Dim selectionMask_array(0) As Selection.MaskTriple
Dim selObj As TaggedObject = Nothing

With selectionMask_array(0)
.Type = UFConstants.UF_drafting_entity_type
.Subtype = UFConstants.UF_draft_label_subtype
End With

Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt, _
title, scope, selAction, _
includeFeatures, keepHighlighted, selectionMask_array, _
selObj, cursor)
If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
selLabel = selObj
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If

End Function

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 Module