Hallo Stefan,
da ich kein Profi bin in makro's schreiben habe ich eine bitte. Und zwar habe ich dieses makro unten in der API hilfe gefunden es funzt auch gut. Nur das macro schaltet das Komponentennamen anzeig aus und Anzeigestatusnamen anzeigen ein ich brauche es ganu andersherum..
Leider find ich es nicht im macro wo es steht.
Können sie sich das macro ansehen??
Pepe
Option Explicit
'-------------------------------------------------------
'
' Preconditions:
' (1) Open <SolidWorks_install_dir>\samples\tutorial\smartcomponents\pillow_block.sldasm.
' (2) Interactively collapse all expanded components to more easily see what this macro does.
' (3) Step through this macro.
'
' Postconditions: None
'
'-------------------------------------------------------
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim SelMgr As SldWorks.SelectionMgr
Dim swFeatMgr As SldWorks.FeatureManager
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
Set swFeatMgr = Part.FeatureManager
Debug.Print "'Tree Display' settings upon opening document"
Debug.Print vbTab & "ShowComponentNames : " & swFeatMgr.ShowComponentNames
Debug.Print vbTab & "ShowComponentDescriptions : " & swFeatMgr.ShowComponentDescriptions
Debug.Print vbTab & "ShowComponentConfigurationNames : " & swFeatMgr.ShowComponentConfigurationNames
Debug.Print vbTab & "ShowComponentConfigurationDescriptions : " & swFeatMgr.ShowComponentConfigurationDescriptions & vbCrLf
' To verify the settings, interactively right-click "pillow_block (NPD-24)" at the
' the top of the FeatureManager design tree and point at Tree Display.
' Then click anywhere in the graphics area to close the short-cut menu.
' Interactively examine the FeatureManager design tree to
' verify that the names of the components are not shown.
If (swFeatMgr.ShowComponentNames) Then
swFeatMgr.ShowComponentNames = False
Else
swFeatMgr.ShowComponentNames = True
End If
' Show Component Names is now set to TRUE.
' Examine the FeatureManager design tree, and
' verify that the names of the components are
' shown in the FeatureManager design tree.
If (swFeatMgr.ShowComponentDescriptions) Then
swFeatMgr.ShowComponentDescriptions = False
Else
swFeatMgr.ShowComponentDescriptions = True
End If
' Show Component Descriptions is now set to FALSE.
' Examine the FeatureManager design tree, and
' verify that the descriptions of the components are
' not shown.
If (swFeatMgr.ShowComponentConfigurationNames) Then
swFeatMgr.ShowComponentConfigurationNames = False
Else
swFeatMgr.ShowComponentConfigurationNames = True
End If
' Show Component Configuration Names is now set to FALSE.
' Examine the FeatureManager design tree, and
' verify that the names of the configurations are
' not shown.
If (swFeatMgr.ShowComponentConfigurationDescriptions) Then
swFeatMgr.ShowComponentConfigurationDescriptions = False
Else
swFeatMgr.ShowComponentConfigurationDescriptions = True
End If
' Show Component Configuration Descriptions is now set to TRUE.
' Examine the FeatureManager design tree, and
' verify that the descriptions of the configurations
' are shown.
Debug.Print "Display modified settings"
Debug.Print vbTab & "ShowComponentNames : " & swFeatMgr.ShowComponentNames
Debug.Print vbTab & "ShowComponentDescriptions : " & swFeatMgr.ShowComponentDescriptions
Debug.Print vbTab & "ShowComponentConfigurationNames : " & swFeatMgr.ShowComponentConfigurationNames
Debug.Print vbTab & "ShowComponentConfigurationDescriptions : " & swFeatMgr.ShowComponentConfigurationDescriptions & vbCrLf
'FeatureManager::ShowComponentNames and FeatureManager::ShowComponentDescriptions
'cannot both be set to FALSE
swFeatMgr.ShowComponentDescriptions = True
If (swFeatMgr.ShowComponentNames) Then
swFeatMgr.ShowComponentNames = False
End If
Debug.Print "Try to set FeatureManager::ShowComponentDescriptions to FALSE while FetureManager::ShowComponentNames is FALSE"
Debug.Print vbTab & "Before call to ShowComponentDescriptions : " & swFeatMgr.ShowComponentDescriptions
swFeatMgr.ShowComponentDescriptions = False ' This call does not work because FeatureManager::ShowComponentNames display is set to FALSE
Debug.Print vbTab & "After call to ShowComponentDescriptions : " & swFeatMgr.ShowComponentDescriptions & vbCrLf
'Restore original settings
If (swFeatMgr.ShowComponentConfigurationNames) Then
swFeatMgr.ShowComponentConfigurationNames = False
Else
swFeatMgr.ShowComponentConfigurationNames = True
End If
If (swFeatMgr.ShowComponentConfigurationDescriptions) Then
swFeatMgr.ShowComponentConfigurationDescriptions = False
Else
swFeatMgr.ShowComponentConfigurationDescriptions = True
End If
Debug.Print "Restored original settings"
Debug.Print vbTab & "ShowComponentNames : " & swFeatMgr.ShowComponentNames
Debug.Print vbTab & "ShowComponentDescriptions : " & swFeatMgr.ShowComponentDescriptions
Debug.Print vbTab & "ShowComponentConfigurationNames : " & swFeatMgr.ShowComponentConfigurationNames
Debug.Print vbTab & "ShowComponentConfigurationDescriptions : " & swFeatMgr.ShowComponentConfigurationDescriptions & vbCrLf
End Sub
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP