Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I get the splines from a text feature? 1

Status
Not open for further replies.

javaxp

Automotive
Jul 14, 2014
43
Hi,

I need to get the curves (splines) from a feature text that I've created with a textBuilder.


Recording a journal I get the next code:

Code:
Dim features2(0) As NXOpen.Features.Feature
Dim text1 As NXOpen.Features.Text = CType(displayPart.Features.FindObject("TEXT(25)"), NXOpen.Features.Text)

features2(0) = text1
Dim spline1 As NXOpen.Spline = CType(text1.FindObject("CURVE 8 {9 (357.9020621071018,110.47607421875,-30.7999999999999)}"), NXOpen.Spline)



In my program :


Code:
 Dim nXObject1 As NXOpen.NXObject = Nothing
        nXObject1 = textBuilder1.Commit()

        Dim features2(0) As NXOpen.Features.Feature
        Dim text1 As NXOpen.Features.Text = CType(nXObject1, NXOpen.Features.Text)

        features2(0) = text1
        Dim spline1 As NXOpen.Spline = CType(XXXXXXX, NXOpen.Spline)

How can I replace the "text1.FindObject("CURVE 8 {9 (357.9020621071018,110.47607421875,-30.7999999999999)" or the "XXXXXXXX" in my program?


Thanks in advance,

Javier


NX 12.0.2.9 MP14
 
Replies continue below

Recommended for you

Is this a "one shot" only or something that "deserves" spending the time creating a journal for this ?
(I.e will be happening repeatedly ?)

How about "Extract Geometry - Composite Curve". ?

Regards
Tomas


Never try to teach a pig to sing. I wastes your time and it annoys the pig.:)
 
You can use the .GetEntities method to get the objects managed by the feature. The code below was originally written to move the text splines to a new layer; I've commented out the part that moves them. The splines for the text feature will be stored in the textObjs list variable.

Code:
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen

Module MoveTextToLayer
    Sub Main()
        Dim theSession As Session = Session.GetSession()
        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        Dim Layno As Integer
        Layno = 253
        Dim textObjs As New List(Of DisplayableObject)

        For Each temp As Features.Feature In theSession.Parts.Work.Features
            If TypeOf (temp) Is Features.Text Then
                lw.WriteLine(temp.GetFeatureName)
                Dim myText As Features.Text = temp
                For Each textObj As DisplayableObject In myText.GetEntities
                    lw.WriteLine("  " & textObj.GetType.ToString)
                    textObjs.Add(textObj)
                Next
            End If
        Next
        'Dim displayModification1 As DisplayModification
        'displayModification1 = theSession.DisplayManager.NewDisplayModification()

        'displayModification1.NewLayer = Layno

        'displayModification1.Apply(textObjs.ToArray)


        'displayModification1.Dispose()

    End Sub

End Module

www.nxjournaling.com
 
Hi,

Toost, yes it's a part from a large program.

Cowski, It's what I was looking for...

Thank you for your answers.



Regards,

Javier

NX 12.0.2.9 MP14
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor