Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Hello, is it possible to request to vault to create a STEP file using the job processor from an iLogic script?
Exactly like this post: https://forums.autodesk.com/t5/vault-customization/make-pdf-with-job-processor-by-ilogic-function/m-...
But for Step file,
@Nick_Hall I call for help from the Batman of the vault XD
I have try this, but doesn't work:
Sub Main()
If Not isPartOrAssembly() Then Exit Sub
Dim mVltCon As VDF.Vault.Currency.Connections.Connection
mVltCon = VB.ConnectionManager.Instance.Connection
If mVltCon Is Nothing Then
MessageBox.Show("Not Logged In to Vault! - Login first and repeat executing this rule.")
Exit Sub
End If
Dim oDoc As Document = ThisApplication.ActiveEditDocument
Dim oVltDocLatest As AWS.File = GetLatestVaultFile(oDoc.FullFileName, mVltCon)
Logger.Info("File: Local Path [" + oDoc.FullFileName + "] ID [" + oVltDocLatest.Id.ToString() + "]")
' STEP job parameters
Dim stepParamList As AWS.JobParam() = New AWS.JobParam(1) {}
Dim fileIdParam As New AWS.JobParam()
fileIdParam.Name = "FileVersionId"
fileIdParam.Val = oVltDocLatest.Id.ToString()
stepParamList(0) = fileIdParam
Dim jobType As String = "Autodesk.Vault.STEP.Create" + System.IO.Path.GetExtension(oDoc.FullFileName)
Dim jobPriority As Long = 10
Dim jobDesc As String = [String].Format("Create STEP for {0}", oDoc.DisplayName)
Logger.Info("Job Type: [" + jobType + "] Priority [" + jobPriority.ToString() + "]")
AddJob(jobType, jobDesc, stepParamList, jobPriority, mVltCon)
End Sub
Function GetLatestVaultFile(VaultPath As String, mVltCon As VDF.Vault.Currency.Connections.Connection) As AWS.File
Dim workingFolder = mVltCon.WorkingFoldersManager.GetWorkingFolder("$/")
VaultPath = VaultPath.Replace(workingFolder.FullPath, "$\")
VaultPath = VaultPath.Replace("\", "/")
Dim VaultPaths() As String = New String() {VaultPath}
Dim wsFiles() As AWS.File = mVltCon.WebServiceManager.DocumentService.FindLatestFilesByPaths(VaultPaths)
Return wsFiles(0)
End Function
Sub AddJob(jobType As String, jobDesc As String, paramList As AWS.JobParam(), jobPriority As Long, mVltCon As VDF.Vault.Currency.Connections.Connection)
Dim newJob As AWS.Job
Try
newJob = mVltCon.WebServiceManager.JobService.AddJob(jobType, jobDesc, paramList, jobPriority)
Logger.Info("New Job: [" + newJob.Id.ToString() + "]")
Catch ex As Exception
Logger.Info("Error adding job")
If ex.Message = "237" Then
MessageBox.Show("Error adding job: job already exists", "Add Job", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
MessageBox.Show("Error adding job: Unknown error", "Add Job", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Try
End Sub
Function isPartOrAssembly() As Boolean
' Checks if the active document is a part or assembly.
If ThisDoc.Document.DocumentType = DocumentTypeEnum.kPartDocumentObject Or ThisDoc.Document.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
isPartOrAssembly = True
Else
isPartOrAssembly = False
End If
End Function
Solved! Go to Solution.