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?
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") lw.Open() 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) Next End If Next lw.Close() 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
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