To delete every configuration except the active one

SolidWorks API Macro to delete every configuration except the active one.
Please find the macro for the same.

  • Dim swApp As SldWorks.SldWorks
  • Dim swmodel As SldWorks.ModelDoc2
  • Dim swconfig As SldWorks.Configuration
  • Dim vconfig As Variant
  • Dim conName As String
  • Dim Sconfig As String
  • Dim bool As Boolean
  • Sub main()

  • Set swApp = Application.SldWorks
  • Set swmodel = swApp.ActiveDoc
  • vconfig = swmodel.GetConfigurationNames

  • Set swconfig = swmodel.GetActiveConfiguration
  • conName = swconfig.Name
  • vconfig = swmodel.GetConfigurationNames
  • For i = 0 To UBound(vconfig)
  • Sconfig = vconfig(i)

  • If Not config = conName Then
  • bool = swmodel.DeleteConfiguration2(vconfig(i))
  • End If

  • Next

  • End Sub


Comments

Popular posts from this blog

SolidWorks Macro to create DXF file from each configuration