Skip to content

Commit 40b79d9

Browse files
committed
added Snippets iLogic-VaultInventorServer
1 parent 871597a commit 40b79d9

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<CodeSnippets xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
<Version>1</Version>
4+
<Snippets>
5+
<CodeSnippet>
6+
<Category>iLogicVaultInventorServer</Category>
7+
<Name>iLogic-VaultInventorServer Header</Name>
8+
<ToolTip>Add required references</ToolTip>
9+
<Index>6001</Index>
10+
<Code><![CDATA[AddReference "QuickstartiLogicVltInvSrvLibrary.dll"
11+
AddReference "Autodesk.Connectivity.WebServices.dll"
12+
AddReference "Autodesk.DataManagement.Client.Framework.Vault.dll"
13+
]]></Code>
14+
</CodeSnippet>
15+
<CodeSnippet>
16+
<Category>iLogicVaultInventorServer</Category>
17+
<Name>Re-Use Job Processor Connection</Name>
18+
<ToolTip>get the job processor's Vault connection (note - this is different from Inventor Application)</ToolTip>
19+
<Index>6002</Index>
20+
<Code><![CDATA[ 'get the job processor's Vault connection (note - this is different from Inventor Application)
21+
Dim iLogicVault As New QuickstartiLogicVltInvSrvLibrary.iLogicVltInvSrvLibrary
22+
Dim LoggedIn As Boolean
23+
Dim FileState As String
24+
Try
25+
dbServer = RuleArguments("ServerName")
26+
fServer = RuleArguments("ServerName")
27+
vltName = RuleArguments("VaultName")
28+
userId = RuleArguments("UserId")
29+
ticket = RuleArguments("Ticket")
30+
LoggedIn = iLogicVault.ReuseConnection(dbServer, fServer, vltName, userId, ticket)
31+
FileState = RuleArguments("State (Historical)")
32+
Catch
33+
Logger.Error("Failed Reading Rule Arguments.")
34+
Throw ex
35+
End Try
36+
37+
If LoggedIn = False
38+
Logger.Error("Rule could not re-use Job Processor's Vault Login.")
39+
Throw ex
40+
End If
41+
42+
'don't update drawings in Obsolete State
43+
If FileState = "Obsolete" Then
44+
Dim mColor As Inventor.Color = ThisServer.TransientObjects.CreateColor(255, 174, 174) 'red for obsolete
45+
mDrwDoc.SheetSettings.SheetColor = (mColor)
46+
Exit Sub
47+
End If]]></Code>
48+
</CodeSnippet>
49+
<CodeSnippet>
50+
<Category>iLogicVaultInventorServer</Category>
51+
<Name>Get Vault File by FullFilePath</Name>
52+
<ToolTip>Downloads Vault file Using full File Path, e.g. "$/Designs/Base.ipt". Returns full File name In local working folder (download enforces override, If local File exists),
53+
Preset Options: Download Children (recursively) = Enabled, Enforce Overwrite = True'
54+
Optionally check-out the file; preset: check-out = false</ToolTip>
55+
<Index>6003</Index>
56+
<Code><![CDATA[Dim mVaultFile As String = iLogicVault.GetFileByFullFilePath("$/") 'add ..., True) to enable check-out of downloaded file.
57+
If mVaultFile Is Nothing Then
58+
Logger.Error("Vault file not found - Please double check that file exists in Vault.")
59+
ElseIf mVaultFile.Count > 0 Then
60+
''add next action using the downloaded file here, e.g. Component.Replace("Part1:1", mVaultFile, True)
61+
62+
End If]]></Code>
63+
</CodeSnippet>
64+
<CodeSnippet>
65+
<Category>iLogicVaultInventorServer</Category>
66+
<Name>Get Vault File by Search</Name>
67+
<ToolTip>Search Vault file using 1 to n property/value pairs; returns full local file name in working folder</ToolTip>
68+
<Index>6004</Index>
69+
<Code><![CDATA['Build one to many name/value pairs of Property/Value as search criteria
70+
Dim mSearchParams As New System.Collections.Generic.Dictionary(Of String, String) 'add UDP.DisplayName, Value Pairs
71+
mSearchParams.Add("Part Number", "001002")
72+
mSearchParams.Add("Title", "Back Side Cover")
73+
'...add as many as required to enable a unique search result
74+
75+
'returns full file name in local working folder (download enforces override, if local file exists)
76+
mVaultFile = iLogicVault.GetFileBySearchCriteria(mSearchParams, True, False)
77+
78+
If mVaultFile Is Nothing Then
79+
Logger.Error("Vault file search: File not found - Please double check that file can be found with search criteria applied.")
80+
Else
81+
Logger.Info("File " & mVaultFile & " found by search and downloaded to local workspace.")
82+
'add next action using the downloaded file here, e.g. Component.Replace("Part1:1", mVaultFile, True)
83+
End If]]></Code>
84+
</CodeSnippet>
85+
<CodeSnippet>
86+
<Category>iLogicVaultInventorServer</Category>
87+
<Name>Check Vault File(s) Exist by Search</Name>
88+
<ToolTip>Search Vault files using 1 to n property/value pairs; returns list of file names and shares logger info</ToolTip>
89+
<Index>6005</Index>
90+
<Code><![CDATA['Build one to many name/value pairs of Property/Value as search criteria;
91+
Dim mSearchParams As New System.Collections.Generic.Dictionary(Of String, String) 'add UDP.DisplayName, Value Pairs
92+
mSearchParams.Add("Part Number", "001003")
93+
mSearchParams.Add("Title", "Back Side Cover")
94+
'...add as many as required to enable a unique search result
95+
96+
Dim mVaultFiles As List(Of String)
97+
mVaultFiles = iLogicVault.CheckFilesExistBySearchCriteria(mSearchParams, False) 'returns file name(s)
98+
If mVaultFiles Is Nothing Then
99+
Logger.Error("The file(s) searched was(were) not found. Please double check that the search criteria's relevance.")
100+
ElseIf mVaultFiles.Count > 0 Then
101+
Dim mFileList As String
102+
For Each mFile As String In mVaultFiles
103+
mFileList += mFile & vbCr
104+
Next
105+
Logger.Info("iLogic-Vault file search found: " & mFileList)
106+
End If]]></Code>
107+
</CodeSnippet>
108+
<CodeSnippet>
109+
<Category>iLogicVaultInventorServer</Category>
110+
<Name>Get Thumbnail from Vault by Search as Image File</Name>
111+
<ToolTip>Searches for a source file to extract the thumbnail of and downloads it as JPG file</ToolTip>
112+
<Index>6006</Index>
113+
<Code><![CDATA['Build one to many name/value pairs of Property/Value as search criteria
114+
Dim mSearchParams As New System.Collections.Generic.Dictionary(Of String, String) 'add UDP.DisplayName, Value Pairs
115+
mSearchParams.Add("Part Number", "001002") 'applies to file 001002.ipt
116+
mSearchParams.Add("Title", "Back Side Cover") 'applies to file 001002.ipt and to file 001068.iam
117+
'...add as many as required to enable a unique search result
118+
119+
Dim mImageFile As String = iLogicVault.GetThumbnailFileBySearchCriteria(mSearchParams, True)
120+
If mImageFile Is Nothing Then
121+
Logger.Error("Could not convert thumbnail to image file - Please double check that file exists in Vault including a thumbnail.")
122+
Else
123+
''add next action using the downloaded file here...
124+
125+
End If]]></Code>
126+
</CodeSnippet>
127+
<CodeSnippet>
128+
<Category>iLogicVaultInventorServer</Category>
129+
<Name>Get Thumbnail from Vault by Full File Path as Image File</Name>
130+
<ToolTip>Extracts thumbnail from source file and downloads it as JPG file</ToolTip>
131+
<Index>6007</Index>
132+
<Code><![CDATA[Dim mImageFile As String = iLogicVault.GetThumbnailFileByFullSourceFilePath("$/Designs/Inventor Sample Data/Fishing Rod Model/001002.ipt", 254, 254)
133+
If mImageFile Is Nothing Then
134+
Logger.Error("Could not convert thumbnail to image file - Please double check that file exists in Vault including a thumbnail.")
135+
Else
136+
''add next action using the downloaded file here...
137+
138+
End If]]></Code>
139+
</CodeSnippet>
140+
</Snippets>
141+
</CodeSnippets>

iLogic-VaultInvServer Library/iLogic-VaultInvServer Library.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,9 @@
8080
<Compile Include="iLogicVltInvSrvLibrary.cs" />
8181
<Compile Include="Properties\AssemblyInfo.cs" />
8282
</ItemGroup>
83+
<ItemGroup />
84+
<ItemGroup>
85+
<Content Include="Rule Snippets\UserSnippets_iLogicVaultInventorServer.xml" />
86+
</ItemGroup>
8387
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
8488
</Project>

0 commit comments

Comments
 (0)