Hi there,
Is it possible to get the Resolved Value from a Configuration Specific Custom Property with the Document Manager?
Greetings!
Hi there,
Is it possible to get the Resolved Value from a Configuration Specific Custom Property with the Document Manager?
Greetings!
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.
Greetings!
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).
Amen,
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.
Hi there,
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())
and:
' 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
End If
Marco Tulio Ramos Filho on 3-okt-2017 13:58 was right.
https://forum.solidworks.com/message/787438#comment-787438
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.
Greetings!
Do you want to do it with files closed OR open?