Description in feature manager

Hello

I just switched to SW2023 (Formerly 2020). And I have this macro to display the description in feature manager:

2024-06-28_15h39_05

But I would like to remove the secondary description in this macro:

2024-06-28_15h41_20

Any idea to complete this macro?

Thank you

Hello;
Edit your line:
swfeature. ShowComponentDescriptions=True
in
swfeature. ShowComponentDescriptions=False

Solidworks offers this (to adjust the types to be displayed on components (feautreTree):
True => Visible
False =>Hidden

https://help.solidworks.com/2023/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IFeatureManager_members.html

1 Like

Hello

swfeature. ShowComponentDescriptions is the description of the component at the primary level. What I would like is to disable the component description at the secondary level and show the description at the primary level.

Thank you.

Hello

Look at this side instead to intervene on the second identifier: SetComponentIdentifiers Method (IFeatureManager) - 2023 - SOLIDWORKS API Help

1 Like

Hello Cyril,

Thank you but I can't get anything out of it.

Hello
Well, it seems to have a bug.
Basically, once a parameter is applied via the set, it is almost impossible to pass it to false.
What I tested that might work in your case is this:

Dim swApp As SldWorks.SldWorks
Dim SelMgr As SldWorks.SelectionMgr
Dim swFeatMgr As SldWorks.FeatureManager
Dim Part As SldWorks.ModelDoc2
Dim compIdentifierRet As Long
 
Sub Main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set swFeatMgr = Part.FeatureManager
compIdentifierRet = swFeatMgr.SetComponentIdentifiers(swComponentIdentifier_ComponentDescription, 0, 0)  'Bascule la valeur primaire sur Description du composant afin de vider la sélection dans la valeur secondaire
compIdentifierRet = swFeatMgr.SetComponentIdentifiers(swComponentIdentifier_ComponentName, 0, 0)  'Rebascule la valeur primaire sur Nom du composant
End sub

Obviously known problem in 2022 version:
https://ww3.cad.de/foren/ubb/Forum2/HTML/034314.shtml
an SPR has been created in sw2022SP5, translation of the 2nd message:

Après un bref test, j'ai remarqué que les options sont activées, mais ne peuvent plus être désactivées par macro.
Il existe aussi un SPR à ce sujet SPR1237147
1 Like

As usual, are not in a hurry :smiley:

The SPR is only concerned with this point swFeatMgr.HideComponentSingleConfigurationOrDisplayStateNames = False
What I also noticed on the 2023 but it's a little more general on the rest.
The other options, impossible to inhibit as well.

But with your @Cyril.f solution, it is indeed possible to bypass the bug and check the 2 primary boxes by unchecking the secondary description:

Dim swApp As SldWorks.SldWorks
Dim SelMgr As SldWorks.SelectionMgr
Dim swFeatMgr As SldWorks.FeatureManager
Dim Part As SldWorks.ModelDoc2
Dim compIdentifierRet As Long
 
Sub Main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set swFeatMgr = Part.FeatureManager
compIdentifierRet = swFeatMgr.SetComponentIdentifiers(swComponentIdentifier_ComponentDescription, 0, 0)  'Bascule la valeur primaire sur Description du composant afin de vider la sélection dans la valeur secondaire
compIdentifierRet = swFeatMgr.SetComponentIdentifiers(swComponentIdentifier_ComponentName, 0, 0)  'Rebascule la valeur primaire sur Nom du composant


    ' Show Component Descriptions is set to true
    swFeatMgr.ShowComponentDescriptions = True

    ' Show Component Configuration Names is set to false
    swFeatMgr.ShowComponentConfigurationNames = True
     ' Show Component Configuration Descriptions is set to false
    swFeatMgr.ShowComponentConfigurationDescriptions = False
    ' Show Component Names
    swFeatMgr.ShowComponentNames = True
End Sub

After the macro:
image

1 Like

Hello

Thank you for your attempts but at home the macro stops on this line with " Runtime error 449: Non-optional argument"

Hello
No problem on my side.
There is no lack of argument on this line.