iLogicVault.UpdateVaultFileProperties() Not Updating .dwg Properties
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hopefully I have some silly mistake on my hands as I'm sure .UpdateVaultFileProperties() should be working for .dwgs of others.
When attempting to update vault file properties of a .dwg, it shows a Property Edit version being created, but doesn't actually change any properties. The same code works perfectly for .ipt's and .iam's.
This is some simple code I put together to isolate this from my larger project, changing the vault path and property names should allow easy replication.
This also does not work when using the sample code to attempt to change properties from Inventor.
After some testing, I think this is due to the "Classification" property. I seem to be able to use the function to update .dwgs that have a Classification of None. I am unable to update properties of .dwgs with the Classification of Design Document.
My rough testing code:
Sub iLogicMethod()
vaultName = "$/Engineering/CC-LMS/_Users/River Engum/Vault Testing/lc test.dwg"
vaultNameIam = "$/Engineering/CC-LMS/_Users/River Engum/Vault Testing/lc test.iam"
Dim propDict As New Dictionary(Of String, Object)
propDict.Add("ECN", "ECN Test")
propDict.Add("Description", "desc test")
For Each key As String In propDict.Keys
Logger.Info(key & ": " & propDict(key))
Next
Dim getLatest As Boolean = False
'Logger.Info("getLatest: " & getLatest)
updated = iLogicVault.UpdateVaultFileProperties(vaultName , propDict, getLatest)
updated = iLogicVault.UpdateVaultFileProperties(vaultNameIam, propDict, getLatest)
If Not updated Then
Logger.Error("Updated: " & updated)
Else
Logger.Info("Updated Vault File Properties: " & Now())
End If
End Sub
Autodesk Sample Code:
'DISCLAIMER:
'---------------------------------
'In any case, this solution's code, templates, and snippets are of "work in progress" character.
'Autodesk does Not represent that these samples are reliable, accurate, complete, Or otherwise valid For production usage.
'Accordingly, those configuration samples are provided “as is” with no warranty of any kind, and you use the applications at your own risk.
Sub Main
'Validate user's login state; it is optional as iLogicVault methods throw an exception with message 'Please log in to Vault before using this function'.
If iLogicVault.LoggedIn = False
Logger.Error("Not Logged In to Vault! - Login first and repeat executing this rule.")
Exit Sub
End If
'Build one to many name/value pairs of Property/Value; note the value has to be of the expected type like string (text), decimal (numbers), date (date/time), or boolean (true/false)
Dim mPropNameValueMap As New Dictionary(Of String, Object) 'add UDP.DisplayName, UDP.Value object of matching type
mPropNameValueMap.Add("Title", "Property Edit at " + Date.Now.ToString)
Dim mDate As Date = Date.Now
mPropNameValueMap.Add("Checked Date", mDate)
Dim mNum As Decimal = 15.6
mPropNameValueMap.Add("Cost", mNum)
Dim mBool As Boolean = True
mPropNameValueMap.Add("MBD", mBool) 'Note - Vault UDP of type Bool must not have "Indeterminate" state; set the default value to True/False
'we need the file's path in Vault; you can convert the local file path to the corresponding Vault virtual path
Dim mVaultFileName As String = iLogicVault.ConvertLocalPathToVaultPath(ThisDoc.Path) + "/" + ThisDoc.FileName(True)
'Retrieve the active document's Vault file status as name/value pairs
Dim mDocVaultStatus As New Dictionary(Of String, String)
mDocVaultStatus = iLogicVault.GetVaultFileStatus(ThisDoc.PathAndFileName(True))
If mDocVaultStatus.Item("ErrorState") = "None" And Not mDocVaultStatus.Item("CheckOutState") <> "NotCheckedOut" Or mDocVaultStatus.Item("LockState") <> "Unlocked" Then
Dim success As Boolean = iLogicVault.UpdateVaultFileProperties(mVaultFileName, mPropNameValueMap)
success = iLogicVault.UpdateVaultFileProperties(mVaultFileName, mPropNameValueMap)
If success = False Then
Logger.Error("Update Properties failed; either the file does not exist at the given full file name/path or is not available for check out.")
Else
Logger.Info("Successfully updated properties of file :" & mVaultFileName)
'refresh the Vault Browser
oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("VaultRefresh")
oControlDef.Execute2(True)
End If
Else
Logger.Error("Could not start to update the properties; check the status info below:")
Logger.Info("CheckOutState = " + mDocVaultStatus.Item("CheckOutState"))
Logger.Info("ConsumableState = " + mDocVaultStatus.Item("ConsumableState"))
Logger.Info("ErrorState = " + mDocVaultStatus.Item("ErrorState"))
Logger.Info("LocalEditsState = " + mDocVaultStatus.Item("LocalEditsState"))
Logger.Info("LockState = " + mDocVaultStatus.Item("LockState"))
Logger.Info("RevisionState = " + mDocVaultStatus.Item("RevisionState"))
Logger.Info("VersionState = " + mDocVaultStatus.Item("VersionState"))
End If
End Sub
