Connecting vault and accessing vault file status through Inventor iLogic

By Chandra shekar Gopal

 

Inventor iLoigc is very useful to Inventor developers due to easy development and easy deployment with in built editor. As iLogic rules can be attached or incorporated with Inventor documents, it encourages reusability of iLogic rules.

iLogic rules can be triggered an automatic update of a whole host of parameters, feature/component suppression and iProperty values based on a variety of actions like below.

  • Parameter value change
  • Model geometry or drawing view changes
  • Software Events
  • When a document is created
  • Right before a document is saved
  • On demand by the user

Inventor iLogic can also be used to establish vault connection and access vault file status. To demonstrate the same, below iLogic can be used to connect vault and access vault file status of current document.

AddReference "Autodesk.Connectivity.WebServices.dll"
Imports AWS = Autodesk.Connectivity.WebServices
AddReference "Autodesk.DataManagement.Client.Framework.Vault.dll"
Imports VDF = Autodesk.DataManagement.Client.Framework
AddReference "Connectivity.Application.VaultBase.dll"
Imports VB = Connectivity.Application.VaultBase

Dim mVltCon As VDF.Vault.Currency.Connections.Connection
mVltCon = VB.ConnectionManager.Instance.Connection
 
If  mVltCon Is Nothing Then
     Messagebox.Show("Not Logged In to Vault! – Login first and repeat executing this rule.")
     Exit Sub
End If

Dim VaultPath As String = ThisDoc.PathAndFileName(True)
VaultPath = VaultPath.Replace("C:$WorkingFolder", "$/")
'flip the slashes
VaultPath = VaultPath.Replace("", "/")

Dim VaultPaths() As String = New String() {VaultPath}
 
Dim wsFiels() As AWS.File = mVltCon.WebServiceManager.DocumentService.FindLatestFilesByPaths(VaultPaths)
 
Dim mFileIt As VDF.Vault.Currency.Entities.FileIteration = New VDF.Vault.Currency.Entities.FileIteration(conn,wsFiels(0))
Dim lifeCycleInfo As VDF.Vault.Currency.Entities.FileLifecycleInfo = mFileIt.LifecycleInfo

Messagebox.Show(lifeCycleInfo.Statename)

Note: Before using above iLogic rule, make sure that local working folder of vault is updated (VaultPath = VaultPath.Replace("C:$WorkingFolder", "$/")). Because, it is system specific. In my system, “C:$WorkingFolder” is the local working folder of Vault.


Comments

11 responses to “Connecting vault and accessing vault file status through Inventor iLogic”

  1. Lars Andersen Avatar
    Lars Andersen

    Does this work with Vault Basic. All get is at empty messagebox but no error messages.

  2. At present, iLogic code is tested with “Vault Professional 2019” and is working.

  3. Lars Andersen Avatar
    Lars Andersen

    I found out my self. It won’t work. Vault basic cannot use documentservice extensions. A list can be found here.
    https://adndevblog.typepad.com/manufacturing/2013/12/different-capbilities-of-vault-api-between-different-vault-versions.html

  4. Hello
    It works well on one file but is it possible to make an iteration that check all files in an assembly structure (parts and subassemblies)? Does anyone have a solution for that?
    BR
    Goran

  5. Hi Goran,
    Please refer suggestions in below blog link.
    https://modthemachine.typepad.com/my_weblog/2009/03/accessing-assembly-components.html
    Thanks and regards,

  6. Where did you find the object paths for the Vault? Inventor has the API help file which is pretty good. But I can’t find anything for the Vault.
    Thanks for this!

  7. Hi Spencer,
    Please refer below blog article about installing and path of VaultSDK.chm (Vault API reference).
    https://knowledge.autodesk.com/support/vault-products/learn-explore/caas/sfdcarticles/sfdcarticles/How-to-install-the-vault-SDK.html
    Thanks and regards,
    Chandra shekar G

  8. Michele Addante Avatar
    Michele Addante

    Good evening, I use inventor and vault professional 2020, the code that is posted here does not work for me, nothing appears in the text box.
    I am probably doing something wrong in defining the folder where the ipj project file is present. I have the vault that has this structure:
    STUDIO_D – Addante / EXPLORE PROJECTS ($) / INVENTOR (inside this vault folder is the studio D.ipj file) What is the value to assign to the vaultpath?
    VaultPath = ???
    It would be very helpful for me to know the vault status to publish only the released drawings.
    thanks a lot

  9. Edward Lowe Avatar
    Edward Lowe

    This code works for an ipt or iam files saved in vault. Could you advise me of the required changes to confirm the lifecycle state of the ipt or iam depicted in a drawing (my drawing files are dwg format)?

  10. Chandra shekar Gopal Avatar
    Chandra shekar Gopal

    Hi Edward,
    Thanks for reaching us,
    To confirm the lifecycle state, Vault API would be better approach to achieve this. Below 2 links may be helpful for confirming the lifecycle state change.
    https://forums.autodesk.com/t5/vault-forum/api-change-lifecycle-state/td-p/2897176
    https://justonesandzeros.typepad.com/blog/2015/01/changing-the-item-lifecycle-state.html
    Thanks and regards,
    Chandra shekar G

  11. Nathan Heinze Avatar
    Nathan Heinze

    Hello, I was able to use the above code to find a PDF file in the vault. How can I then checkout said PDF file from the Vault through iLogic?
    Nate

Leave a Reply to GoranCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading