Dann versuch ichs mal:
Dann meiste ist aus einem UGAnswer Bsp
-----------------------------------------
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UI
Imports NXOpen.Utilities
Imports NXOpen.UF
Module select_a_note_demo
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Sub Main()
Dim note As NXOpen.Tag
While select_a_note(note) = Selection.Response.Ok
Dim undoMark As Session.UndoMarkId = s.SetUndoMark(Session.MarkVisibility.Visible, "Edit note")
Dim thisNote As Annotations.Note = NXObjectManager.Get(note)
Dim noteText() As String = thisNote.GetText()
noteText(0) = noteText(0) + " test-Zusatztext"
thisNote.SetText(noteText)
s.UpdateManager.DoUpdate(undoMark)
ufs.Disp.SetHighlight(note, 0)
End While
End Sub
Function select_a_note(ByRef note As NXOpen.Tag) As Selection.Response
Dim message As String
Dim title As String = "Select a note"
Dim scope As Integer = UFConstants.UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY
Dim response As Integer
Dim obj As NXOpen.Tag
Dim view As NXOpen.Tag
Dim cursor(2) As Double
Dim ip As UFUi.SelInitFnT = AddressOf mask_for_notes
ufs.Ui.LockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)
Try
ufs.Ui.SelectWithSingleDialog(message, title, scope, ip, _
Nothing, response, note, cursor, view)
Finally
ufs.Ui.UnlockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)
End Try
If response <> UFConstants.UF_UI_OBJECT_SELECTED And _
response <> UFConstants.UF_UI_OBJECT_SELECTED_BY_NAME Then
Return Selection.Response.Cancel
Else
Return Selection.Response.Ok
End If
End Function
Function mask_for_notes(ByVal select_ As IntPtr, _
ByVal userdata As IntPtr) As Integer
Dim num_triples As Integer = 1
Dim mask_triples(0) As UFUi.Mask
mask_triples(0).object_type = UFConstants.UF_drafting_entity_type
mask_triples(0).object_subtype = UFConstants.UF_draft_note_subtype
mask_triples(0).solid_type = 0
ufs.Ui.SetSelMask(select_, _
UFUi.SelMaskAction.SelMaskClearAndEnableSpecific, _
num_triples, mask_triples)
Return UFConstants.UF_UI_SEL_SUCCESS
End Function
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Module
-----------------------------------------
Gruß Stefan
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP