-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated iLogic-Vault snippets to include new methods and options
updated iLogic-Vault snippets to support 2022 changes added sample rules for iLogic-VaultInventorServer
- Loading branch information
Showing
17 changed files
with
1,394 additions
and
62 deletions.
There are no files selected for viewing
205 changes: 165 additions & 40 deletions
205
iLogic-Vault-QuickstartLibrary/Rule Snippets/UserSnippets_iLogicVault.xml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
iLogic-VaultInvServer Library/Sample Rules iLogicVaultInventorServer/VaultJobRule.iLogicVb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'DISCLAIMER: | ||
'--------------------------------- | ||
'In any case, code, templates, and snippets of this solution are of "work in progress" character. | ||
'Neither Markus Koechl, nor Autodesk represents that these samples are reliable, accurate, complete, or otherwise valid. | ||
'Accordingly, those configuration samples are provided “as is” with no warranty of any kind and you use the applications at your own risk. | ||
|
||
Sub Main | ||
break 'prepared for step by step debugging | ||
'some insights on the job's iLogic settings | ||
Logger.Info("----------------------- this job's iLogic settings ------------------------------------") | ||
For Each mDir As String In iLogicVb.Automation.FileOptions.ExternalRuleDirectories | ||
Logger.Info("iLogic External Rule Directories: " & mDir) | ||
Next | ||
Logger.Info("iLogic Addin DLLs Directory: " & iLogicVb.Automation.FileOptions.AddinDirectory) | ||
Logger.Info("iLogic Loglevel set by Vault Job: " & iLogicVb.Automation.LogControl.Level) | ||
Logger.Info("--------------------------------------------------------------------------------------------") | ||
|
||
'insights on rule arguments that optionally may publish all Vault properties of the processed file | ||
Logger.Info("----------------------- Rule Arguments published by Vault Job ----------------") | ||
Dim mArgs As NameValueMap = RuleArguments.Arguments | ||
If mArgs.Count > 0 Then | ||
For i = 1 To mArgs.Count | ||
Logger.Info(mArgs.Name(i) & ": " & mArgs.Value(mArgs.Name(i))) | ||
Next | ||
End If | ||
Logger.Info("--------------------------------------------------------------------------------------------") | ||
|
||
'Note - Vault Inventor Server uses a subset of the Inventor API. Use the Inventor Server object istead of Inventor Application. | ||
Dim mInvSrv As InventorServer = ThisServer | ||
|
||
'access the active document like you do in Inventor application rules | ||
Dim oDoc As Document = ThisDoc.Document | ||
Dim oAsmDoc As AssemblyDocument | ||
Dim oPrtDoc As PartDocument | ||
Dim eDocumentType As Inventor.DocumentTypeEnum = oDoc.DocumentType | ||
Dim oParams As Inventor.Parameters | ||
|
||
If eDocumentType = DocumentTypeEnum.kPartDocumentObject Then | ||
oPartDoc = oDoc | ||
oParams = oPartDoc.ComponentDefinition.Parameters | ||
Logger.Info("----------------------- Parameters published by Vault Job ----------------") | ||
For Each oParam As Object In oParams | ||
Logger.Info("Parameter: " & oParam.Name & "; Expression: " & oParam.Expression) | ||
Next | ||
Logger.Info("----------------------- Parameters published by Vault Job ----------------") | ||
End If | ||
|
||
'use known iLogic syntax and snippets in job processor rules like you do in Inventor application rules | ||
iProperties.Value("Custom", "DateTimeStamp") = "JobProcessorTestRuleSuccess: " & DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") | ||
|
||
End Sub |
65 changes: 65 additions & 0 deletions
65
...ltInvServer Library/Sample Rules iLogicVaultInventorServer/VaultJobRuleConnected.iLogicVb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
AddReference "QuickstartiLogicVltInvSrvLibrary.dll" | ||
AddReference "Autodesk.Connectivity.WebServices.dll" | ||
AddReference "Autodesk.DataManagement.Client.Framework.Vault.dll" | ||
'DISCLAIMER: | ||
'--------------------------------- | ||
'In any case, code, templates, and snippets of this solution are of "work in progress" character. | ||
'Neither Markus Koechl, nor Autodesk represents that these samples are reliable, accurate, complete, or otherwise valid. | ||
'Accordingly, those configuration samples are provided “as is” with no warranty of any kind and you use the applications at your own risk. | ||
|
||
Sub Main | ||
break 'prepared for step by step debugging | ||
'to enable iLogicVault commands reuse the job processor's user connection | ||
Dim iLogicVault As New QuickstartiLogicVltInvSrvLibrary.iLogicVltInvSrvLibrary | ||
Dim LoggedIn As Boolean | ||
Dim FileStateName As String | ||
Try | ||
dbServer = RuleArguments("ServerName") | ||
fServer = RuleArguments("ServerName") | ||
vltName = RuleArguments("VaultName") | ||
userId = RuleArguments("UserId") | ||
SessionId = RuleArguments("SessionId") | ||
LoggedIn = iLogicVault.ReuseConnection(dbServer, fServer, vltName, userId, SessionId) | ||
If LoggedIn = False | ||
Dim ex As New Exception | ||
Logger.Error("Rule could not re-use Job Processor's Vault Login.") | ||
Throw ex | ||
Exit Sub | ||
End If | ||
FileStateName = RuleArguments("File.State (Historical)") | ||
Catch | ||
End Try | ||
|
||
|
||
'some insights on the job's iLogic settings | ||
Logger.Info("----------------------- this job's iLogic settings ------------------------------------") | ||
For Each mDir As String In iLogicVb.Automation.FileOptions.ExternalRuleDirectories | ||
Logger.Info("iLogic External Rule Directories: " & mDir) | ||
Next | ||
Logger.Info("iLogic Addin DLLs Directory: " & iLogicVb.Automation.FileOptions.AddinDirectory) | ||
Logger.Info("iLogic Loglevel set by Vault Job: " & iLogicVb.Automation.LogControl.Level) | ||
Logger.Info("--------------------------------------------------------------------------------------------") | ||
|
||
'insights on rule arguments that optionally may publish all Vault properties of the processed file | ||
Logger.Info("----------------------- Rule Arguments published by Vault Job ----------------") | ||
Dim mArgs As NameValueMap = RuleArguments.Arguments | ||
If mArgs.Count > 0 Then | ||
For i = 1 To mArgs.Count | ||
Logger.Info(mArgs.Name(i) & ": " & mArgs.Value(mArgs.Name(i))) | ||
Next | ||
End If | ||
Logger.Info("--------------------------------------------------------------------------------------------") | ||
|
||
'Note - Vault Inventor Server uses a subset of the Inventor API. Use the Inventor Server object istead of Inventor Application. | ||
Dim mInvSrv As InventorServer = ThisServer | ||
|
||
'access the active document like you do in Inventor application rules | ||
Dim oDoc As Document = ThisDoc.Document | ||
|
||
'use known iLogic syntax and snippets in job processor rules like you do in Inventor application rules | ||
iProperties.Value("Custom", "DateTimeStamp") = "JobProcessorTestRuleSuccess: " & DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") | ||
|
||
End Sub | ||
|
||
|
||
|
75 changes: 75 additions & 0 deletions
75
...Library/Sample Rules iLogicVaultInventorServer/VaultJobRule_ApplyPdmcBOMSettings.iLogicVb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
AddReference "QuickstartiLogicVltInvSrvLibrary.dll" | ||
AddReference "Autodesk.Connectivity.WebServices.dll" | ||
AddReference "Autodesk.DataManagement.Client.Framework.Vault.dll" | ||
'DISCLAIMER: | ||
'--------------------------------- | ||
'In any case, code, templates, and snippets of this solution are of "work in progress" character. | ||
'Neither Markus Koechl, nor Autodesk represents that these samples are reliable, accurate, complete, or otherwise valid. | ||
'Accordingly, those configuration samples are provided “as is” with no warranty of any kind and you use the applications at your own risk. | ||
|
||
Sub Main | ||
break 'step debugging using Visual Studio | ||
|
||
'don't run rules for AnyCAD components. | ||
If ThisDoc.Document.FullFileName.Contains("*LocalDocs*") = True Then | ||
Exit Sub | ||
End If | ||
|
||
Dim oAssyDoc As Inventor.AssemblyDocument | ||
Dim oAssyCompDef As Inventor.AssemblyComponentDefinition | ||
Dim oBom As Inventor.BOM | ||
Dim oBomView As Inventor.BOMView | ||
Dim oBomRow As Inventor.BOMRow | ||
|
||
|
||
oDoc = ThisDoc.Document | ||
If oDoc.DocumentType = kAssemblyDocumentObject Then | ||
oAssyDoc = oDoc | ||
oAssyCompDef = oAssyDoc.ComponentDefinition | ||
End If | ||
oBom = oAssyCompDef.BOM | ||
oBom.StructuredViewEnabled = True | ||
oBom.StructuredViewFirstLevelOnly = False | ||
|
||
'get the job processor's Vault connection (note - this is different from Inventor Application) | ||
Dim ex As Exception | ||
Dim iLogicVault As New QuickstartiLogicVltInvSrvLibrary.iLogicVltInvSrvLibrary | ||
Dim LoggedIn As Boolean | ||
Dim FileState As String | ||
Try | ||
dbServer = RuleArguments("ServerName") | ||
fServer = RuleArguments("ServerName") | ||
vltName = RuleArguments("VaultName") | ||
userId = RuleArguments("UserId") | ||
SessionId = RuleArguments("SessionId") | ||
LoggedIn = iLogicVault.ReuseConnection(dbServer, fServer, vltName, userId, SessionId) | ||
If LoggedIn = False | ||
Logger.Error("Rule could not re-use Job Processor's Vault Login.") | ||
Throw ex | ||
End If | ||
Catch ex | ||
Logger.Error("Failed Reading Rule Arguments.") | ||
Throw ex | ||
End Try | ||
|
||
|
||
|
||
Dim mInvBomSettings As String = iLogicVault.GetFileByFullFilePath("$/Templates/Settings/InventorBomSettingsPDMC-Sample.xml") | ||
If mInvBomSettings Is Nothing Then | ||
Logger.Error("Vaulted BOM settings file not found - Please double check that file exists in Vault.") | ||
Throw ex | ||
End If | ||
|
||
Try | ||
oBom.ImportBOMCustomization(mInvBomSettings) | ||
|
||
oBomView = oBom.BOMViews.Item("Structured") | ||
For Each oBomRow In oBomView.BOMRows | ||
oBomRow.ItemNumberLocked = True | ||
Next | ||
|
||
Catch ex | ||
Logger.Error("Something went wrong while enabling BOM Structured View.") | ||
Throw ex 'for Job Processing: the rule should not return success in case of failure | ||
End Try | ||
End Sub |
Oops, something went wrong.