Kyle Blough

Changing macro to write to config specific prop

Discussion created by Kyle Blough on Sep 16, 2020
Latest reply on Sep 17, 2020 by Kyle Blough

Hi folks,

 

I am not well versed in API/Macro, and I need some help converting a macro I found from codestack to write to a configuration specific property.

 

Macro can be found here: Macro to copy SOLIDWORKS custom property from material to model 

 

The specific section I am having difficulty is follows:

 

---

 

Sub SetCustomProperty(model As SldWorks.ModelDoc2, prpName As String, prpVal As String)
    
    Dim swPrpMgr As SldWorks.CustomPropertyManager
    Set swPrpMgr = model.Extension.CustomPropertyManager("")
    swPrpMgr.Add3 prpName, swCustomInfoType_e.swCustomInfoText, prpVal, swCustomPropertyAddOption_e.swCustomPropertyReplaceValue
    swPrpMgr.Set2 prpName, prpVal
    
End Sub

 

----

 

It works perfect to write to global properties, but I need this to write to configuration specific properties since I use configurations heavily.  I tried changing out CustomPropertyManager to ConfigurationManager, that did not do it.  I tired to set swPrpMgr to swConfigPrpMgr and other instances, but that did not do it either. 

 

So, my entry level api experience has come to ahead, and I need help. 

 

Kyle

Outcomes