Extracting Text Features as Curves

I am trying to create a journal that wavelinks all the text curves from another component in an assembly file. I have the code for creating the wavelink, but what I am struggling on, is parsing through a component's features and extracting all text features as curves. Can anyone help point me in the right direction?

The following code will find the first text feature and report the number of curves contained and the length of each. Is this enough to get you started?



Option Strict Off
Imports System
Imports NXOpen

Module Module1

Sub Main()

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

For Each theFeature As Features.Feature In workPart.Features.GetFeatures

If TypeOf theFeature Is Features.Text Then
Dim textCurves() As TaggedObject
textCurves = theFeature.GetEntities

lw.WriteLine("number of curves in text feature: " & textCurves.Length.ToString)
For Each temp As Curve In textCurves
lw.WriteLine(temp.GetType.ToString)
lw.WriteLine(temp.GetLength.ToString)
lw.WriteLine("")
Next
End If

Next

End Sub

End Module

Hello, we use NX 5.0.6.
Is there a way to change the "text string" of a Text-Feature?

Dim text As Features.Feature = Nothing

For Each f As Features.Feature In workPart.Features
theSession.ListingWindow.WriteLine(f.FeatureType)
If f.FeatureType = "TEXT" Then
text = f
End If
Next

If Not IsNothing(text) Then
'change Text

End If

I'm a bit confused; according to the API reference, the "text" feature was introduced in NX 7.5. Anyway, a "TextBuilder" object can be used to change the text string of a text feature. The code below shows how to do this (tested on NX 9):

Note: the variable "text1" is a reference to the text feature.

Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Redefine Feature")

Dim textBuilder1 As Features.TextBuilder
textBuilder1 = workPart.Features.CreateTextBuilder(text1)

textBuilder1.TextString = "new text here"

Dim nXObject1 As NXObject
nXObject1 = textBuilder1.Commit()

textBuilder1.Destroy()

Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(markId2)

theSession.DeleteUndoMark(markId2, Nothing)

Hello,
unfortunately the feature "Text" in NX5 is not yet supported in journaling.
That's why I'm looking for another way :-(

I can't be of much help here. The oldest NX version I have access to is NX 8.5. I looked through the "user function" documentation, but didn't find anything that looked like it would be useful in your situation.