Is it possible to get the Resolved Value from a Configuration Specific Custom Property with the Document Manager?
Do you want to do it with files closed OR open?
Thanks Deepak for your reaction,
If you ask me, both with open and closed files.
For now I access closed files with the document-manager and opened files with SW because I don't know how to access opened files with the document-manager.
If you could inform me, please.
As per my experience, SWDM doesn't work with configuration properties with closed files but they should work fine with active files (amy be someone can correct me here).
What is your end goal?
You can get the evaluated value from a configuration specific property using the Document Manager. Search for GetCustomProperty in the API documentation and choose the one for ISwDMConfiguration. There are examples for C# and VB.Net.
I think you will have to use the SOLIDWORKS API to do this for open files.
That's not entirely true. With the SolidWorks API, the resolved values are merely integers. You won't be able to get the evaluated values (Like the Material of a part for instance) (Edit: using GetAll2).
Please see: https://forum.solidworks.com/message/787438#comment-787438
Yes. I saw it. Are you trying to get the material information from a part using the document manager. What's your end goal?
If you are talking about the SOLIDWORKS API then the return value of the ICustomPropertyManager.Get5 method is an integer which indicates whether the property exists or if the value is cached or resolved. However, the value and the evaluated value are provided as output parameters.
I was talking about GetAll2.
This looks like it does the trick:
' Get the evaluated value from a Configuration Specific Custom Property with ISwDMConfiguration5 - GetCustomPropertyValues.
Dim dmConfig2 As ISwDMConfiguration5
dmConfig2 = swConfigMgr.GetConfigurationByName(swConfigMgr.GetActiveConfigurationName())
' Fill ComboBox Material.
' We need the evaluated value from a Configuration Specific Custom Property, not the 'formula', they can be accessed by
' ISwDMConfiguration5 - GetCustomPropertyValues, see API help for more details.
' When Part or Assy.
If nDocType = swDocumentTypes_e.swDocPART Or nDocType = swDocumentTypes_e.swDocASSEMBLY Then
Dim valueMaterial As String = ""
valueMaterial = dmConfig2.GetCustomPropertyValues("Material", SwDmCustomInfoType.swDmCustomInfoText, "")
ComboBoxMaterial.Text = valueMaterial
Marco Tulio Ramos Filho on 3-okt-2017 13:58 was right.
I also find out that opened files can be accessed 'Read Only' by the Document Manager, 'forReadOnly as Boolean', see:
dmDoc = dm.GetDocument(file, True) 'From a full file path, return an opened SwDMDocument, forReadOnly as Boolean.
Retrieving data ...