Access / download folders or files from Vault via an iLogic-rule

Access / download folders or files from Vault via an iLogic-rule

Darrell.johnson
Enthusiast Enthusiast
5,830 Views
25 Replies
Message 1 of 26

Access / download folders or files from Vault via an iLogic-rule

Darrell.johnson
Enthusiast
Enthusiast

Hello,

 

I'm not quite sure if this is the right forum because the question is also related to Vault.

How do I access / download folders or files from Vault with an iLogic-rule?

I'm currently creating a configurator which loads in different files, I have to make sure that all files the configurator is using are downloaded from Vault at the start of the iLogic-rule.

 

0 Likes
Accepted solutions (1)
5,831 Views
25 Replies
Replies (25)
Message 2 of 26

bradeneuropeArthur
Mentor
Mentor

please explain a little more in detail what you try to do or avoid.

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 26

mark.almack
Enthusiast
Enthusiast

Create this external rule called "Get From Vault Function"

 

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

Dim oFilePath As String = RuleArguments("oFilePath")

Dim oVaultConnection As VDF.Vault.Currency.Connections.Connection
    oVaultConnection = VB.ConnectionManager.Instance.Connection

If  oVaultConnection Is Nothing Then
     MessageBox.Show("Not Logged In to Vault! - Login first and repeat executing this rule.")
     Exit Sub
End If

VaultPath = oFilePath.Replace("D:\Working Folder\", "$/")
VaultPath = VaultPath.Replace("\", "/")

SplitPath = oFilePath.Split("\")
FolderPath = SplitPath(0) & "\"
For i = 1 To SplitPath.Length - 2
	FolderPath = FolderPath & SplitPath(i) & "\"
Next

Dim VaultPaths() As String = New String() {VaultPath }
Dim wsFiels() As AWS.File = oVaultConnection.WebServiceManager.DocumentService.FindLatestFilesByPaths(VaultPaths)
Dim mFileIt As VDF.Vault.Currency.Entities.FileIteration = New VDF.Vault.Currency.Entities.FileIteration(oVaultConnection,wsFiels(0))
Dim oSettings As New VDF.Vault.Settings.AcquireFilesSettings(oVaultConnection)
    oSettings.LocalPath = New VDF.Currency.FolderPathAbsolute(FolderPath)
    oSettings.AddFileToAcquire(mFileIt, VDF.Vault.Settings.AcquireFilesSettings.AcquisitionOption.Download)
Try
	Dim oResults As VDF.Vault.Results.AcquireFilesResults = oVaultConnection.FileManager.AcquireFiles(oSettings)
	RuleArguments.Arguments.Value("Success") = True 
Catch
	RuleArguments.Arguments.Value("Success") = False 
End Try

then put this in your local rule:

oFilePath = "you part to get from vault Full filename.ipt"

Dim oRuleArguments As Inventor.NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap()		
oRuleArguments.Add("oFilePath",oFilePath)
iLogicVb.RunExternalRule("Get From Vault Function", oRuleArguments)										
'this returns True/False depending on whether download was successful or not.
Dim oFileDownloadedSuccessfully As String = oRuleArguments.Item("Success")

'MessageBox.Show(oFilePath, oFileDownloadedSuccessfully)												

'use this line before checking for other files
oRuleArguments.Clear

If you want to refresh from vault, i delete off my local first, and then run this rule.

 

regards

 

Mark

Message 4 of 26

Darrell.johnson
Enthusiast
Enthusiast

I try to download all files required for the configurator to work. The files need to be available locally, so I first need to dowload them from the Vault.

The configurator is used by mutiple users, so I would like to implement this downloading process in the iLogic-rule of the configurator file.

0 Likes
Message 5 of 26

Darrell.johnson
Enthusiast
Enthusiast

Thank you for your code, but unfortunately it isn't working for me.

The message box:

MessageBox.Show(oFilePath, oFileDownloadedSuccessfully)	

... only shows the path of the file (oFilePath).

And the mentoined file isn't downloaded aftwerwards. Do you have any idea what could cause this behaviour?

0 Likes
Message 6 of 26

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Maybe take a look from the other side.

Create a Vault extension to do what you want, there you will exactly know what file you want to configure!

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 26

Darrell.johnson
Enthusiast
Enthusiast

Hello,

 

I'm not familiar with the Vault API at all. How do you create a Vault extension?

Are theses extensions called from Inventor or Vault, or how do they work excatly?

Could you please give me an example?

Thank you in advance

 

Regards

0 Likes
Message 8 of 26

bradeneuropeArthur
Mentor
Mentor

@Darrell.johnson wrote:

Hello,

 

I'm not familiar with the Vault API at all. How do you create a Vault extension?

With Vb.net for example!

Are theses extensions called from Inventor or Vault, or how do they work excatly?

Extensions can be used in Vault and there you can start your configurations after the Copy Design for example using Inventor, all triggered and done from Vault.

Could you please give me an example?

I have created a lot of Vault extension in the past but for this I have no example.

What I would do is the following.

  1. Create a Copy Design
  2. Use the Vault extension "Configure Me" to start the file and open it with Inventor.
  3. Configure the file as you want/needed.

This  seems to be the easiest way, to my opinion.

Thank you in advance

 

Regards


 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 9 of 26

mark.almack
Enthusiast
Enthusiast

post a screen shot of the message box

Message 10 of 26

Darrell.johnson
Enthusiast
Enthusiast

I dind't notice the caption "False" at first, so it dind't download the file successfully.

MsgBox.png

Message 11 of 26

mark.almack
Enthusiast
Enthusiast

find the part in vault. right-click -> Details

what does it say for the location?

 

0 Likes
Message 12 of 26

Darrell.johnson
Enthusiast
Enthusiast

image.png

0 Likes
Message 13 of 26

bradeneuropeArthur
Mentor
Mentor

@mark.almack 

For clarity your code works fine...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 14 of 26

mark.almack
Enthusiast
Enthusiast
Accepted solution

you need to replace this:

VaultPath = oFilePath.Replace("D:\Working Folder\", "$/")

 with this:

VaultPath = oFilePath.Replace("C:\VaultWorkSpace\", "$/")

 

Message 15 of 26

Darrell.johnson
Enthusiast
Enthusiast

Now it works perfectly! Thank you very much!

0 Likes
Message 16 of 26

william.pick
Enthusiast
Enthusiast
This method works perfectly.
Just remember to change the local workspace folder:
VaultPath = oFilePath.Replace("D:\Working Folder\", "$/")
in my case was:
VaultPath = oFilePath.Replace("C:\_WorkspaceVault\", "$/")

Many thanks! @mark.almack
0 Likes
Message 17 of 26

DANIEL.DELANEY
Advocate
Advocate

Love it! I had to tweak a few things for my needs, but it works great. Do you know if there is any way to 'Include Attachments' when doing a get? I have parts library parts that I save as custom via a rule, then I use this rule to get the originals based on the new filename. The originals have attachment that download to a specific folder, and they are what I need. When I use your rule (modified) it gets all the correct parts I want, but doesn't bring their attachments with them. Thanks in advance.

0 Likes
Message 18 of 26

denis.semeniuc
Advocate
Advocate

Hi, is work very good.

 

it is posible to download the files with depanding elemts( ex: Asaml whith parts)?

0 Likes
Message 19 of 26

william.pick
Enthusiast
Enthusiast

Hi all,

when users are executing this rule, it comes with this error:

please check image.

Does anyone knows how to solve it?

image.png

0 Likes
Message 20 of 26

bradeneuropeArthur
Mentor
Mentor

Could you upload de code please

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes