- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm working on an Inventor Addin, where I created a button for the users to acquire the latest Vault settings and files (style library, iLogic rules, templates etc.).
To do this, I'm using the Vault API, and I have a successful connection up and running within the project file that defines the addin (essentially based on the Inventor Addin-template, provided by Autodesk). That project is the one called "InventorAddin" in my solution (see attached screendump).
I have separated all functionality of the addin out into a different project (the WorkerModule), and I'm testing this functionality using the TesterModule, so I don't have to wait for Inventor to start up, every time I want to debug something new. Once it's working, I call it inside the InventorAddin project.
Here's the issue:
As mentioned, I have Vault API code up and running, successfully establishing a connection, directly inside the InventorAddin project. However, if I move it to the WorkerModule (moving all necessary references and imports with it, of course), and calling the function from either the TesterModule or directly in the InventorAddin project, the connection is just not happening.
Why? What am I missing? I'm thinking I need to pass some reference object from the source to the function, but I'm out of ideas...
The code inside the WorkerModule is shown below. There are a few redundant imports, but I haven't digged into which, so just included all of them.
Imports System.Runtime.InteropServices
Imports System.Security.Cryptography
Imports System.Windows.Forms
Imports Inventor
Imports Microsoft.Win32
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports Autodesk.Connectivity.Extensibility.Framework
Imports Autodesk.Connectivity.WebServices
Imports AWS = Autodesk.Connectivity.WebServices
Imports VDF = Autodesk.DataManagement.Client.Framework
Imports VB = Connectivity.Application.VaultBase
Imports Autodesk.DataManagement.Client.Framework.Vault.Currency
Public Class clsGet
Public inv_app As Inventor.Application = Nothing
Public Sub getFromVault()
Dim connection As VDF.Vault.Currency.Connections.Connection
connection = VB.ConnectionManager.Instance.Connection
Dim settings As VDF.Vault.Settings.AcquireFilesSettings = New VDF.Vault.Settings.AcquireFilesSettings(connection)
' Start at the root Folder.
Dim root As VDF.Vault.Currency.Entities.Folder = connection.FolderManager.RootFolder
Dim folders As IEnumerable(Of VDF.Vault.Currency.Entities.Folder) = connection.FolderManager.GetChildFolders(root, True, False)
If folders IsNot Nothing AndAlso folders.Any() Then
For Each folder In folders
If folder.FullName = "$/CAD/NTI iTools 2023.ERP" Or folder.FullName = "$/CAD/Inventor 2023.ERP/Templates" Or
folder.FullName.Contains("$/CAD/HM Tools") Or folder.FullName.Contains("$/CAD/NTI iLogic 2023.ERP") Then
Dim childFiles As Autodesk.Connectivity.WebServices.File() = connection.WebServiceManager.DocumentService.GetLatestFilesByFolderId(folder.Id, False)
If childFiles IsNot Nothing Then
For Each file As Autodesk.Connectivity.WebServices.File In childFiles
Dim FileItter = New VDF.Vault.Currency.Entities.FileIteration(connection, file)
settings.AddFileToAcquire(FileItter, VDF.Vault.Settings.AcquireFilesSettings.AcquisitionOption.Download)
Next
End If
connection.FileManager.AcquireFiles(settings)
End If
settings = New VDF.Vault.Settings.AcquireFilesSettings(connection)
Next
End If
End Sub
End Class
Solved! Go to Solution.