Hallo
Ik verontschuldig me bij voorbaat voor het maken van een duplicaat, maar ik kan de plaats op de site waar ik deze macro heb gedownload niet vinden: Voor de activering van configuraties:
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
En er zijn regels code die ik niet helemaal begrijp:
- In de code wordt een variabele gebruikt "vConfigNameArr", maar ik begrijp het niet omdat het niet wordt gedeclareerd.
- Ik begrijp deze twee uitspraken niet: Dim sSpecConfigNameArr(0) As String
Dim vSpecConfigNameArr als variant
Bovendien worden deze variabelen niet gebruikt.
- Tot slot, ik begrijp het niet: swModel.ForceRebuild3 False? Waarom ONWAAR alstublieft?
Ik geef aan dat ik in macro constructie, dus ik kon niet testen of het werkt vanaf de basis.
Bedankt