Batch Processing with iLogic - Resolve Vault
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I recently found a wonderful piece of code at http://www.mastergraphics.com/batch-processing-with-ilogic/ and in the short while that I have been using it I have come across a problem that I hope someone can help me with
My process:
I use Vault so I 'Get' files from there onto my local drive
Then in Inventor I run the above code with additions to 'Checkout' and 'Checkin' files. Checkin is set to delete local copies on its way out.
My problem is that the assemblies share a few part files so only the first assembly in the batch works fine. After which the subsequent files crash due to missing references. I have tried to simulate user mouse clicks to use the 'Resolve file' command but it seems to fail. If done manually it works fine but I cannot replicate the success through iLogic. Can someone help me
Following is the code I have so far
Dim oFileDlg As inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)
oFileDlg.Filter = “Inventor Assemblies (*.iam)|*.iam”
oFileDlg.InitialDirectory = ThisDoc.WorkspacePath()
oFileDlg.MultiSelectEnabled = True
oFileDlg.CancelError = True
On Error Resume Next
oFileDlg.ShowOpen()
If Err.Number <> 0 Then
MessageBox.Show(“File not chosen.”, “Dialog Cancellation”)
ElseIf oFileDlg.FileName <> “” Then
selectedfiles = oFileDlg.FileName
‘create an array of the files selected
Dim arrFiles() As String = selectedfiles.split(“|”)
‘for each item in the array, do the following
For Each strFile As String In arrFiles
‘<Your code here>
‘Open the document
Dim assemDoc As AssemblyDocument
assemDoc = ThisApplication.Documents.Open(strFile)
assemDoc.BrowserPanes.ActivePane.TopNode.DoSelect
ThisApplication.CommandManager.ControlDefinitions.Item("UCxResolveFileCmd").Execute
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = assemDoc.ComponentDefinition
‘set the LOD to my custom LOD (iLogic)
Dim oLODRep As LevelOfDetailRepresentation
oLODRep = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.item(“iLogic”)
oLODRep.activate
‘Save and close the file.
assemDoc.Save
assemDoc.Close
Next
End If