This website uses cookies to ensure you get the best experience on our website. By using our website you agree on the following Cookie Policy, Privacy Policy, and Terms Of Use
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swCustPrpMgr As SldWorks.CustomPropertyManager
Dim swConfCustPrpMgr As SldWorks.CustomPropertyManager
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
IfNot swModel IsNothingThenSet swCustPrpMgr = swModel.Extension.CustomPropertyManager("")
Dim vNames AsVariantDim vTypes AsVariantDim vValues AsVariant
swCustPrpMgr.GetAll vNames, vTypes, vValues
Dim activeConfName AsString
activeConfName = swModel.ConfigurationManager.ActiveConfiguration.Name
Set swConfCustPrpMgr = swModel.Extension.CustomPropertyManager(activeConfName)
Dim i AsIntegerFor i = 0 To UBound(vNames)
swConfCustPrpMgr.Add2 vNames(i), vTypes(i), vValues(i)
swConfCustPrpMgr.Set vNames(i), vValues(i)
NextElse
MsgBox "Please open part or assembly"EndIfEndSub
Notifications
Join session by SOLIDWORKS and PDM API expret Artem Taturevych at 3DEXPERIENCE World 2025 on Feb 26 at 08:30 AM CST to explore 10 essential macros for automating drawings, assemblies, custom properties, and more