I tried to iterate through the configurations two ways, one way just cycling through the names, and the other way using the configuration manager. Here are my two attempts.
Thank you for any advice.
Attempt 1:
Code: Select all
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swConfMgr As SldWorks.ConfigurationManager
Dim swConfig As SldWorks.Configuration
Dim vConfigName As Variant
Dim vConfigNameArr As Variant
Dim swFeat As SldWorks.Feature
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swConfMgr = swModel.ConfigurationManager
Set swConfig = swConfMgr.ActiveConfiguration
vConfigNameArr = swModel.GetConfigurationNames
For Each vConfigName In vConfigNameArr
Set swConfig = swModel.GetConfigurationByName(vConfigName)
Debug.Print "Name: ", swConfig.Name
Set swFeat = swModel.FirstFeature
While Not swFeat Is Nothing
If swFeat.GetTypeName2 = "RefPlane" Then
swFeat.Select2 False, -1
swModel.BlankRefGeom
End If
Set swFeat = swFeat.GetNextFeature
Wend
Next vConfigName
End Sub
Code: Select all
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim params As Variant
Dim vName As Variant
Dim CfgName As String
Dim ThisConfig As Configuration
Dim swFeat As SldWorks.Feature
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
params = swModel.GetConfigurationNames
For Each vName In params
CfgName = vName
Set ThisConfig = swModel.GetConfigurationByName(CfgName)
Debug.Print "Name: ", ThisConfig.Name
Set swFeat = swModel.FirstFeature
While Not swFeat Is Nothing
If swFeat.GetTypeName2 = "RefPlane" Then
swFeat.Select2 False, -1
swModel.BlankRefGeom
End If
Set swFeat = swFeat.GetNextFeature
Wend
Next vName
End Sub