Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NX Journal - Check to see if Current Feature is Last Feature 1

Status
Not open for further replies.

jmarkus

Mechanical
Jul 11, 2001
377
Hi,

I have an NX11 Journal in which I need to determine if the current feature is the last feature (i.e. 'Make Current Feature' hasn't been applied to the Part Navigator).

I see there is a property to determine the current feature (Part.CurrentFeature) but I can't figure out how to use it to find out if the Current Feature is the last feature in the tree.

Please and thank you,
Jeff
 
Replies continue below

Recommended for you

Hello Jeff,

You can use below program to do this.

Code:
Option Strict Off
Imports System
Imports NXOpen

Module Module1

    Sub Main()

        Dim ugs As Session = Session.GetSession()
        Dim workpart As Part = ugs.Parts.Work
        Dim lw As ListingWindow = ugs.ListingWindow
        Dim Feats() As Features.Feature = workpart.Features.ToArray()
        lw.Open()
        Dim timestamps As New System.Collections.Generic.List(Of Integer)
        For ii As Integer = 0 To Feats.Length - 1
            timestamps.Add(Feats(ii).Timestamp)
            lw.WriteLine("Current feature timestamp: " & timestamps(ii))
        Next
        timestamps.Sort()
        Dim LastfeatTimestap = timestamps(Feats.Length - 1)

        If LastfeatTimestap <> workpart.CurrentFeature.Timestamp Then

            MsgBox("Last feature is not a current feature")
        End If



    End Sub


    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

Thanks
Krishna
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor