ilogic Open Drawing from Vault (default)

ilogic Open Drawing from Vault (default)

204Е10
Enthusiast Enthusiast
2,980 Views
4 Replies
Message 1 of 5

ilogic Open Drawing from Vault (default)

204Е10
Enthusiast
Enthusiast

Hi everyone,

 

Someone know if there are any link for open a drawing from Vault directly, I would like to use this way as default.

 

Note: I have found this link but I don't know to modified the code.

https://forums.autodesk.com/t5/inventor-customization/ilogic-open-file-from-vault/td-p/5701827

 

Many thanks.

0 Likes
2,981 Views
4 Replies
Replies (4)
Message 2 of 5

204Е10
Enthusiast
Enthusiast

I use: 

ThisDoc.Save
NewFileName = ThisDoc.ChangeExtension(".idw")
ThisApplication.CommandManager.ControlDefinitions.Item("AppFileCloseCmd").Execute

'open the indexed file, false opens the file without generating the graphics
ThisApplication.Documents.Open(NewFileName, True) 

 

That I found in the link: 

https://forums.autodesk.com/t5/inventor-forum/ilogic-rule-to-open-document/td-p/4336504

 

But is not working with "OpenDrawingfromVault" for example: (ThisApplication.Documents.Open(""), ThisApplication.CommandManager.ControlDefinitions.Item("OpenDrawingfromVaultCmd"), vaultaddin = ThisApplication.ApplicationAddIns.ItemById(""))

Message 3 of 5

dg2405
Advocate
Advocate

I use following iLogic-Code to open Drawing directly from Vault:

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


Public Class ThisRule

Sub Main()

Dim oApp As Inventor.Application = ThisApplication

Dim oDoc As Document = ThisDoc.Document
If TypeOf ThisDoc.Document Is AssemblyDocument Then
	If ThisDoc.Document.SelectSet.Count > 0 Then
		oDoc = ThisDoc.Document.SelectSet(1).Definition.Document
	End If
End If
	
Dim docfullfilename As String = oDoc.FullFileName
Dim docfilename As String = RPointToBackSlash(oDoc.FullFileName)

'Alle Zeichnungen aus dem Vault abrufen
'Auf Vault-Connection zugreifen und ggf. rausgehen
Dim mVltCon As VDF.Vault.Currency.Connections.Connection = VB.ConnectionManager.Instance.Connection
If mVltCon Is Nothing Then Exit Sub
'Auf ACW-PropertyDefininition Status zugreifen
Dim filePropDefs As ACW.PropDef() = mVltCon.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId("FILE")
Dim ACWNamePropDef As ACW.PropDef
For Each def As ACW.PropDef In filePropDefs
    If def.DispName = "Name" Then
        ACWNamePropDef = def
		Exit For
    End If
Next def  
'Suchoptionen festlegen
Dim namesucheoptionen As New ACW.SrchCond() With { _
	.PropDefId = ACWNamePropDef.Id, _
	.PropTyp = ACW.PropertySearchType.SingleProperty, _
	.SrchOper = 1, _
	.SrchRule = ACW.SearchRuleType.Must, _
	.SrchTxt = docfilename & " idw" _
}

Dim bookmark As String = String.Empty
Dim status As ACW.SrchStatus = Nothing
Dim results As ACW.File() = mVltCon.WebServiceManager.DocumentService.FindFilesBySearchConditions(New ACW.SrchCond() {namesucheoptionen }, Nothing, Nothing, False, True, bookmark, status)

Dim settings As New VDF.Vault.Settings.AcquireFilesSettings(mVltCon)
If results Is Nothing Then
	MessageBox.Show("Zu dem Dokument " & docfilename & " ist keine Zeichnung im Vault vorhanden.", "Info")
Else
	For Each res In results
		Dim oFileIteration As VDF.Vault.Currency.Entities.FileIteration = New VDF.Vault.Currency.Entities.FileIteration(mVltCon, res)
		settings.OptionsRelationshipGathering.FileRelationshipSettings.IncludeRelatedDocumentation = True
		settings.OptionsRelationshipGathering.FileRelationshipSettings.VersionGatheringOption = VDF.Vault.Currency.VersionGatheringOption.Latest
		settings.AddFileToAcquire(oFileIteration, VDF.Vault.Settings.AcquireFilesSettings.AcquisitionOption.Download)
	Next
End If
Dim aquiresults As VDF.Vault.Results.AcquireFilesResults = mVltCon.FileManager.AcquireFiles(settings)

'Alle heruntergeladenen idw's in Liste
Dim idwList As New ArrayList
For Each aquiresult As VDF.Vault.Results.FileAcquisitionResult In aquiresults.FileResults
	Dim aquiresultpath As String = aquiresult.LocalPath.FullPath
	If UCase(aquiresultpath).Contains(".IDW") Then
		idwList.Add(aquiresultpath)
	End If
Next

'idw's öffnen
For Each idw As String In idwList
	oApp.Documents.Open(idw, True)
Next

End Sub

Function RPointToBackSlash(ByVal strText As String) As String
    strText = Left(strText, InStrRev(strText, ".") - 1)
    RPointToBackSlash = Right(strText, Len(strText) - InStrRev(strText, "\"))
End Function

End Class

 

Maybe you have to replace the "Name" in the line <If def.DispName = "Name" Then>. This is the filename-Property in Vault and should match to yours.

Message 4 of 5

brun.mic
Explorer
Explorer

Hi, I have the same issue. I m not able to find which command stands for Open Drawing From Vault...

 

I ve listed all command names:

 

VaultOpenDesignDocFromVault 
VaultOpenFromVault
VaultOpenFromVault_AppMenu

 

nothing works

 

Any ideas?

0 Likes
Message 5 of 5

raphael.widmann5DUKP
Participant
Participant

Hi dg2405

 

works perfectly for me. Thanks for sharing!
 
 
 
 BR
0 Likes