Batch Processing with iLogic - Resolve Vault

Batch Processing with iLogic - Resolve Vault

VGonsalves
Advocate Advocate
716 Views
2 Replies
Message 1 of 3

Batch Processing with iLogic - Resolve Vault

VGonsalves
Advocate
Advocate

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

0 Likes
717 Views
2 Replies
Replies (2)
Message 2 of 3

wayne.brill
Collaborator
Collaborator

Hi,

 

Please explain more about this and provide a code snippet if possible:

>> >>

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.

<< <<

 

If the problem is that local copies that are needed for other assemblies are deleted, could you have it so it does not delete the local copies and then delete them by your code at the end of the entire process? (after everything is checked into Vault)

 

Thanks,

Wayne

 



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 3

VGonsalves
Advocate
Advocate

Wayne, sorry about such a delayed response

 

I get the files from Vault manually and not through ilogic. Once they are on my local drive I run the above code to get the dialog box and select the assembly files. Once the assembly file opens the next line of code is

ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckoutTop").Execute

I then let the code set the view representation. Once that's done, the next line of code is

ThisApplication.CommandManager.ControlDefinitions.Item("VaultCheckinTop").Execute2(True)

The code then moves onto the next file. Before running the code I have set the Vault options to suppress the checkin dialog box and delete files on checkin.

 

You are absolutely right in saying that I should keep the files on the local drive for the subsequent assemblies to work. And yes that is how I have it setup. Now back to my original question.....

If this was done manually and the first assembly was checked in with local copy deletion, I could use Resolve file on the subsequent assembly and the parts would get downloaded, etc. All I am interested in is to replicate that functionality using ilogic. Is that possible

 

The following code does not work for me

oDoc.BrowserPanes.ActivePane.TopNode.DoSelect
ThisApplication.CommandManager.ControlDefinitions.Item("UCxResolveFileCmd").Execute

0 Likes