Hi,
I would like to modify the macro I already have for deleting out configuration properties - I currently have to have the file open and and run the macro. Would it be possible to modify the macro so that whatever folder the macro is in, it would open any parts or assemblies, delete out configuration properties, rebuild, save and close?
My plan is to use this macro with the task scheduler to process multiple files at an off peak time. My current macro is below:-
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swCustPropMgr As SldWorks.CustomPropertyManager
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Dim vConfs As Variant
Dim i As Integer
'ClearCustPrps ("")
vConfs = swModel.GetConfigurationNames
For i = 0 To UBound(vConfs)
Debug.Print "Main: " & vConfs(i)
If vConfs(i) <> "Custom" Then ClearCustPrps (vConfs(i))
Next
End Sub
Sub ClearCustPrps(conf As String)
Dim j As Integer
Set swCustPropMgr = swModel.Extension.CustomPropertyManager(conf)
If Not swCustPropMgr Is Nothing Then
swCustPropMgr.GetAll vPropNames, Empty, Empty
If Not IsEmpty(vPropNames) Then
For j = 0 To UBound(vPropNames)
Debug.Print "ClearCustPrps: " & vPropNames(j)
swCustPropMgr.Delete vPropNames(j)
Next
End If
End If
swModel.ShowNamedView2 "*Isometric", -1
swModel.ViewZoomtofit2
swModel.ForceRebuild3 False
swModel.Save2 Silent
MsgBox "The Configuration Properties Have Been Successfully Deleted, The Model Has Been Rebuilt and Saved"
End Sub
Thanks in advance.
Scott
SolidworksApi macros