Hide Feature in FeatureManager Design Tree Example (VBA)
This example shows how to hide the selected feature in the FeatureManager
design tree.
'--------------------------------------
'
' Preconditions: Model document is open and a feature
is selected.
'
' Postconditions: Selected feature is hidden in the FeatureManager
' design
tree, but it is still visible in the graphics area.
'
'--------------------------------------
Option Explicit
Public Enum swUIStates_e
swIsHiddenInFeatureMgr
= 1
End Enum
Sub main()
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
swSelMgr As
SldWorks.SelectionMgr
Dim
swFeat As
SldWorks.Feature
Dim
bRet As
Boolean
Set
swApp = Application.SldWorks
Set
swModel = swApp.ActiveDoc
Set
swSelMgr = swModel.SelectionManager
Set
swFeat = swSelMgr.GetSelectedObject5(1)
Debug.Print
"Feature = " & swFeat.Name
Debug.Print
" Type
=
" & swFeat.GetTypeName
Debug.Print
" Hidden
=
" & swFeat.GetUIState(swIsHiddenInFeatureMgr)
swFeat.SetUIState swIsHiddenInFeatureMgr, True
swModel.EditRebuild3
Debug.Print
" Hidden
=
" & swFeat.GetUIState(swIsHiddenInFeatureMgr)
End Sub