Hallo Jürgen,
auf der Siemens Support seite findest du folgendes:
Date: 7-APR-2008
Subject: Sample NX Open .NET Visual Basic program : get and set appended text for selected dimension
Note: GTAC provides programming examples for illustration only, and
assumes that you are familiar with the programming language being
demonstrated and the tools used to create and debug procedures. GTAC
support professionals can help explain the functionality of a particular
procedure, but we will not modify these examples to provide added
functionality or construct procedures to meet your specific needs.
'
' GetAppendedText() and SetAppendedText() are new in NX5
'
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UI
Imports NXOpen.Utilities
Imports NXOpen.UF
Module get_and_set_appended_text_for_selected_dimension
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Sub Main()
Dim dimension As NXOpen.Tag
While select_a_dimension(dimension) = Selection.Response.Ok
Dim dimObj As Annotations.Dimension = NXObjectManager.Get(dimension)
Dim appendedText As NXOpen.Annotations.AppendedText = _
dimObj.GetAppendedText()
Dim lines(0) As String
lines(0) = "This is the ABOVE text"
appendedText.SetAboveText(lines)
lines(0) = "This is the BEFORE text"
appendedText.SetBeforeText(lines)
lines(0) = "This is the BELOW text"
appendedText.SetBelowText(lines)
lines(0) = "This is the AFTER text"
appendedText.SetAfterText(lines)
dimObj.SetAppendedText(appendedText)
ufs.Modl.Update()
ufs.Disp.SetHighlight(dimension, 0)
End While
End Sub
Function select_a_dimension(ByRef dimension As NXOpen.Tag) _
As Selection.Response
Dim message As String = "Dimension:"
Dim title As String = "Select a dimension"
Dim scope As Integer = UFConstants.UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY
Dim response As Integer
Dim view As NXOpen.Tag
Dim cursor(2) As Double
Dim ip As UFUi.SelInitFnT = AddressOf init_proc
ufs.Ui.LockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)
Try
ufs.Ui.SelectWithSingleDialog(message, title, scope, ip, _
Nothing, response, dimension, 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 init_proc(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_dimension_type
mask_triples(0).object_subtype = -1
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
Ich hoffe das hilft...
------------------
Gruß
Michael
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP