Hi there,
first of all I would like to thank you for this site and all the information it provides. It is an enormous help when looking for different ways to use the NX journaling funktion.
But after a lot of reading through the various topics I finally reached a task I weren't able to solve yet: I'm looking for a way to unsuppress all the supressed features of a part instead of deleting them (which I sucessfully managed).
So far my code looks like this:
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Module ModuleSuppressedFeatures
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
If displayPart Is Nothing Then
Exit Sub
End If
Dim AllFeatures As Features.Feature() = workPart.Features.GetFeatures
Dim featureList As New List(Of Features.Feature)
Dim featureCount As Integer = 0
Dim featureindex As Integer = 0
For Each SupprFeature As Features.Feature In AllFeatures
If SupprFeature.Suppressed Then
featureList.Add(SupprFeature)
End If
Next
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Delete")
Dim notifyOnDelete1 As Boolean
notifyOnDelete1 = theSession.Preferences.Modeling.NotifyOnDelete
theSession.UpdateManager.ClearErrorList()
'HERE THE UNSUPPRESS CODE IS MISSING
Dim nErrs2 As Integer
nErrs2 = theSession.UpdateManager.DoUpdate(markId1)
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image when the NX session terminates
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
'----Other unload options-------
'Unloads the image immediately after execution within NX
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
'Unloads the image explicitly, via an unload dialog
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
'-------------------------------
End Function
End Module
re: unsuppress feature
A feature object has an .Unsuppress method that you can call to unsuppress the given feature.
myFeature.Unsuppress
The feature collection has an .UnsuppressFeatures(arrayOfFeatures) method which will attempt to unsuppress multiple features.
In either case, a feature may not unsuppress successfully or it may cause errors in other features in the part. It may be important to check for any new feature errors. You may be able to use the feature collection's .GetAllPartFeaturesWithAlerts() or .GetPartFeaturesWithNewAlerts() methods to good advantage here.
Thanks a lot. I'll give it
Thanks a lot. I'll give it another try with this informations.