Hello
I apologize in advance for making a duplicate but I can't find the place on the site where I downloaded this macro: For the activation of configurations:
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swConfigMgr As SldWorks.ConfigurationManager
Dim swConfig As SldWorks.Configuration
Dim vConfigName As Variant
Dim sSpecConfigNameArr(0) As String
Dim vSpecConfigNameArr As Variant
Dim dimValue As Variant
Dim stnameConfig As String
Set swApp = Application.SldWorks
'on récupére le document actif
Set swModel = swApp.ActiveDoc
Set swConfigMgr = swModel.ConfigurationManager
'on récupére la configuration active
Set swConfig = swConfigMgr.ActiveConfiguration
'on récupére de nom de la configation active
stnameConfig = swConfig.Name
'on récupére le nom de toutes les configurations
vConfigNameArr = swModel.GetConfigurationNames
'on boucle
For Each vConfigName In vConfigNameArr
'on affiche la configuration
swModel.ShowConfiguration2 vConfigName
'on force la reconstruction
swModel.ForceRebuild3 False
Next vConfigName
'on affiche la configuration active avant le traitement
swModel.ShowConfiguration2 stnameConfig
'on force la reconstruction
swModel.ForceRebuild3 False
'on sauvegarde le document
swModel.Save3 swSaveAsOptions_e.swSaveAsOptions_Silent, 0, 0
End Sub
And there are lines of code that I don't quite understand:
- In the code there is a variable used "vConfigNameArr" but I don't understand because it is not declared.
- I don't understand these two statements: Dim sSpecConfigNameArr(0) As String
Dim vSpecConfigNameArr as Variant
In addition, these variables are not used.
- Finally, I don't understand: swModel.ForceRebuild3 False? Why FALSE please?
I specify that I am in macro construction so I could not test if it works from the base.
Thank you