AnsweredAssumed Answered

Select all suppressed components in Assembly API

Question asked by Eric Schwieterman on Jan 17, 2020
Latest reply on Feb 7, 2020 by Vladimir Urazhdin

Trying to select all components in Assembly tree that are suppressed.  I can't get it to recognize the suppression.  My suppressed variable always shows false regardless if the component is suppressed or not.  Here is my code.  What am I doing wrong?


Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim fileerror As Long
Dim filewarning As Long
Dim swFeatMgr As SldWorks.FeatureManager
Dim swSelMgr As SldWorks.SelectionMgr
Dim nErrors As Long
Dim nWarnings As Long
Dim swFeat As SldWorks.Feature
Dim boolstatus As Boolean
Dim swModelDocExt As ModelDocExtension
Dim featName As String
Dim vConfNameArr As Variant
Dim vSuppStateArr As Variant
Dim suppressed As Boolean

Sub main()

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swFeat = swModel.FirstFeature
Set swModel = swApp.ActiveDoc

Set swFeat = swModel.FirstFeature

Do Until swFeat.GetTypeName2 = "Reference"

Set swFeat = swFeat.GetNextFeature 'get next component in the tree

Do While swFeat.GetTypeName2 <> "MateGroup"

If swFeat.GetTypeName2 = "Reference" Then 'is feature a sw file

Debug.Print swFeat.Name

vConfNameArr = swModel.GetConfigurationNames
vSuppStateArr = swFeat.IsSuppressed2(swThisConfiguration, vConfNameArr)

suppressed = vSuppStateArr(0)
Debug.Print vSuppStateArr(0)

If suppressed = True Then
swFeat.Select (True) ' select
End If
'Debug.Print swFeat.isSuppressed

Set swFeat = swFeat.GetNextFeature

Set swFeat = swFeat.GetNextFeature

End If



End Sub




Thanks for your help