Showing results for 
Search instead for 
Did you mean: 

How to find a failed feature in the feature tree

Valued Contributor
Valued Contributor

Dear Forum,


I have a situation where I am making various features in the feature tree the current feature programmatically.  And then conducting some NXOpen operation.  Afterwards, I go to the bottom of the feature tree and make the last feature the current feature.  Throughout, the feature tree there could be failure features, like for example an edge blend failed to find it's reference edge.  


Is there a way to find which features in the feature tree have a failed update?




Re: How to find a failed feature in the feature tree

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi @wej0901 ,


Please find below code which gives failed feature name along with associated error message:


Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Features

Module Module1

    Dim theSession As Session = Session.GetSession()
    Dim theUfSession As UFSession = UFSession.GetUFSession()
    Dim theUI As UI = UI.GetUI()
    Dim lw As ListingWindow = theSession.ListingWindow
    Sub Main()
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "NXJ")
        For Each tempFeat As Features.Feature In theSession.Parts.Work.Features
            Dim errMsgs() As String = tempFeat.GetFeatureErrorMessages
            If errMsgs.Length > 0 Then
                For Each errLine As String In errMsgs
                    lw.WriteLine(tempFeat.GetFeatureName & " : " & errLine)
            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   



GTAC | NX Help: NX1102 | NX1202 | NX1847
Please mark post as an "Accepted Solution", if it answers your question/is more helpful!

Re: How to find a failed feature in the feature tree

Siemens Legend Siemens Legend
Siemens Legend

If you want to get something from a feature then you should check the Feature and FeatureCollection classes.


The Feature class has some GetFeature***Messages methods like:



And the FeatureCollection can also return features with alerts:



See also Solution Center Sample

Sample NX Open .NET C# program : report all feature status and messages