Cancel
Showing results for 
Search instead for 
Did you mean: 

How to select all the suppressed features?

Phenom
Phenom

Is there a way to select all the suppressed features in the Part Navigator?

 

I find in an outsourced design, the parts contain lot of suppressed features (unwanted/obsolete/outdated/cloned from another design?) in the tree. Idea is to select all of them to delete.

 

Michael Fernando


Die Designer
NX 11.0.2.7 + PDW

7 REPLIES

Re: How to select all the suppressed features?

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

One method: right click in the part navigator whitespace and choose use filter -> only suppressed features. This will show only the suppressed features in the navigator allowing you to quickly select them all (select first in list, shift click last in list) and delete them. Turn off the filter when you are done to get the normal part navigator view back.

Re: How to select all the suppressed features?

Phenom
Phenom

Thanks Cowski1!

 

Is there a way to select all those filtered features? I'm tring to record a Macro.

Michael Fernando


Die Designer
NX 11.0.2.7 + PDW

Re: How to select all the suppressed features?

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

I'd suggest using a journal.

 

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

Module Module1

    Dim theSession As Session = Session.GetSession()

    Sub Main()

        If IsNothing(theSession.Parts.BaseWork) Then
            'active part required
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Const undoMarkName As String = "Delete Suppressed Features"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

        Dim suppressedFeatures As New List(Of Features.Feature)
        Dim errorFeatures As New List(Of Features.Feature)
        Dim alertFeatures As New List(Of Features.Feature)

        For Each tempFeat As Features.Feature In workPart.Features
            If tempFeat.Suppressed Then
                suppressedFeatures.Add(tempFeat)
            End If
        Next

        DeleteObjects(suppressedFeatures.ToArray)

        lw.Close()

    End Sub

    Sub DeleteObjects(ByVal garbage() As NXObject)

        Dim notifyOnDelete1 As Boolean
        notifyOnDelete1 = theSession.Preferences.Modeling.NotifyOnDelete

        theSession.UpdateManager.ClearErrorList()

        Dim markId2 As Session.UndoMarkId
        markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Delete")

        Dim nErrs1 As Integer
        nErrs1 = theSession.UpdateManager.AddToDeleteList(garbage)

        Dim notifyOnDelete2 As Boolean
        notifyOnDelete2 = theSession.Preferences.Modeling.NotifyOnDelete

        Dim nErrs2 As Integer
        nErrs2 = theSession.UpdateManager.DoUpdate(markId2)

    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

Re: How to select all the suppressed features?

Phenom
Phenom

Cowski1,

Would it be possible to exclude the Failed features from deleting?

Michael Fernando


Die Designer
NX 11.0.2.7 + PDW

Re: How to select all the suppressed features?

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen

Module Module2

    Dim theSession As Session = Session.GetSession()

    Sub Main()

        If IsNothing(theSession.Parts.BaseWork) Then
            'active part required
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Const undoMarkName As String = "Delete Suppressed Features"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

        Dim suppressedFeatures As New List(Of Features.Feature)
        Dim errorFeatures As New List(Of Features.Feature)
        Dim alertFeatures As New List(Of Features.Feature)

        For Each tempFeat As Features.Feature In workPart.Features
            Dim errMessages() As String
            If tempFeat.Suppressed Then
                errMessages = tempFeat.GetFeatureErrorMessages
                If errMessages.Length = 0 Then
                    suppressedFeatures.Add(tempFeat)
                Else
                    errorFeatures.Add(tempFeat)
                End If
            End If
        Next

        'lw.WriteLine("suppressed features that will be deleted:")
        'For Each temp As Features.Feature In suppressedFeatures
        '    lw.WriteLine("  " & temp.GetFeatureName)
        'Next
        'lw.WriteLine("")

        'lw.WriteLine("features suppressed due to errors:")
        'For Each temp As Features.Feature In errorFeatures
        '    lw.WriteLine("  " & temp.GetFeatureName)
        'Next

        DeleteObjects(suppressedFeatures.ToArray)

        lw.Close()

    End Sub

    Sub DeleteObjects(ByVal garbage() As NXObject)

        Dim notifyOnDelete1 As Boolean
        notifyOnDelete1 = theSession.Preferences.Modeling.NotifyOnDelete

        theSession.UpdateManager.ClearErrorList()

        Dim markId2 As Session.UndoMarkId
        markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Delete")

        Dim nErrs1 As Integer
        nErrs1 = theSession.UpdateManager.AddToDeleteList(garbage)

        Dim notifyOnDelete2 As Boolean
        notifyOnDelete2 = theSession.Preferences.Modeling.NotifyOnDelete

        Dim nErrs2 As Integer
        nErrs2 = theSession.UpdateManager.DoUpdate(markId2)

    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

Re: How to select all the suppressed features?

Siemens Legend Siemens Legend
Siemens Legend

Running this journal should be pretty equivalent in number of clicks and time as doing what Cowski proposed in the first post.... :-)

select first suppressed, scroll to bottom, shift+click, press delete 

 

 

regards,

 Tomas

Re: How to select all the suppressed features?

Phenom
Phenom

Thanks cowski1

 

Tomas,

With "Alt+F8" I could pick the Journal file to run easily.

 

Michael Fernando


Die Designer
NX 11.0.2.7 + PDW