Get and Set the State of the Flyout FeatureManager Design Tree Example (VB.NET)
This example shows how to display, expand, and hide the flyout FeatureManager
design tree.
'----------------------------------------------------------------------------
' Preconditions: Open a SolidWorks document.
'
' Postconditions: Click OK to close each message box.
' ---------------------------------------------------------------------------
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System
Imports System.Diagnostics
Partial Class SolidWorksMacro
Dim swModel As ModelDoc2
Dim swModelDocExt As ModelDocExtension
Dim status As Integer
Public Sub Main()
swModel = swApp.ActiveDoc
swModelDocExt = swModel.Extension
status = swModelDocExt.FlyoutFeatureTreeVisibility
Debug.Print("-------Flyout state at start-------")
If status = swFeatureTreeState_e.swFlyoutFeatureTree_Hidden Then Debug.Print("FlyoutFeatureTree Hidden")
If status = swFeatureTreeState_e.swFlyoutFeatureTree_ShownExpanded Then Debug.Print("FlyoutFeatureTree Expanded")
If status = swFeatureTreeState_e.swFlyoutFeatureTree_ShownUnExpanded Then Debug.Print("FlyoutFeatureTree UnExpanded")
swModelDocExt.FlyoutFeatureTreeVisibility = swFeatureTreeState_e.swFlyoutFeatureTree_ShownExpanded
status = swModelDocExt.FlyoutFeatureTreeVisibility
If status = swFeatureTreeState_e.swFlyoutFeatureTree_ShownExpanded Then MsgBox("Flyout state is now swFlyoutFeatureTree_ShownExpanded.")
swModelDocExt.FlyoutFeatureTreeVisibility = swFeatureTreeState_e.swFlyoutFeatureTree_ShownUnExpanded
status = swModelDocExt.FlyoutFeatureTreeVisibility
If status = swFeatureTreeState_e.swFlyoutFeatureTree_ShownUnExpanded Then MsgBox("Flyout state is now swFlyoutFeatureTree_ShownUnExpanded.")
swModelDocExt.FlyoutFeatureTreeVisibility = swFeatureTreeState_e.swFlyoutFeatureTree_Hidden
status = swModelDocExt.FlyoutFeatureTreeVisibility
If status = swFeatureTreeState_e.swFlyoutFeatureTree_Hidden Then MsgBox("Flyout state is now swFlyoutFeatureTree_Hidden.")
End Sub
''' <summary>
''' The SldWorks swApp variable is pre-assigned for you.
''' </summary>
Public swApp As SldWorks
End Class