In dieser Episode geht es um die Dateieigenschaften von Teilen mit Konfigurationen und deren Manipulation.
Und an dieser Stelle der Code der im Makro vorhanden ist.
Option Explicit
Sub main()
Dim swApp As SldWorks.SldWorks
Set swApp = Application.SldWorks
Dim swModel As ModelDoc2
Set swModel = swApp.ActiveDoc
If swModel Is Nothing Then
swApp.SendMsgToUser "Kein Dokument geladen!"
Exit Sub
End If
Dim arrayOfConfigurationNames As Variant
arrayOfConfigurationNames = swModel.GetConfigurationNames()
Dim swModelDocExtension As ModelDocExtension
Set swModelDocExtension = swModel.Extension
Dim swCustomPropertyManager As CustomPropertyManager
Dim result_code As swCustomInfoAddResult_e
Dim name As Variant
For Each name In arrayOfConfigurationNames
Set swCustomPropertyManager = swModelDocExtension.CustomPropertyManager(name)
result_code = swCustomPropertyManager.Add3("Bezeichnung", swCustomInfoType_e.swCustomInfoText, name, swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd)
Next
End Sub