Hello,
I’m trying to make a filter in vba (code below), but the compression is different from the manual input method.
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim value As String
Dim value2 As String
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
value = "Rondelle"
'add value to Filter
swModelDocExt.FeatureManagerFilterString = value
'Get value of filter
value2 = swModelDocExt.FeatureManagerFilterString
Debug.Print value2
'To delete filter (Very long-> Another method?)
swModelDocExt.FeatureManagerFilterString = ""
'swModel.ClearSelection2 True
End Sub
With the Vba method, the 3D graphics part is filtered, but not the FeatureManagerTree part and no value in the filter is displayed.
With the manual method, the 3D part and the FeatureManagerTree are well filtered.:
2 problems :
differents between the manual method and the Vba method. (Bug?)
Slowness in clearing the filter.
Wish:
Quick filter on a property of an assembly and its sub-assemblies.
And display visual or other feedback if this value is found.