Checkout assembly from vault

So, I'm a little crushed to learn that checking an assembly out of the vault with code is not simple.  Does anyone have an easy way to get the assembly and all of the child components as well?

here's what I've got right now

 

Dim

connection As New PDMWorks.PDMWConnection

Dim doc As PDMWorks.IPDMWDocument

Dim extension As swDocumentTypes_e

Dim workDir As String

 

Dim newDoc As ModelDoc2

Dim name As String

 

Dim i As Integer

 

Dim doc2 As PDMWorks.IPDMWDocument

name = "C8498-00031"

 

'connect to pdmworks

 

connection.Login("general.user", "password", "tds-ninjitsu")

workDir = swApp.GetCurrentWorkingDirectory

doc = connection.GetSpecificDocument(name & ".SLDPRT")

extension = swDocumentTypes_e.swDocPART

If doc Is Nothing Then

 

doc = connection.GetSpecificDocument(name & ".SLDASM")

extension = swDocumentTypes_e.swDocASSEMBLY

ElseIf doc Is Nothing Then

 

connection.Logout()

connection.Login("general.user", "password", "tds-lotus")

doc = connection.GetSpecificDocument(name & ".SLDPRT")

extension = swDocumentTypes_e.swDocPART

ElseIf doc Is Nothing Then

 

doc = connection.GetSpecificDocument(name & ".SLDASM")

extension = ".sldasm"

 

End If

 

If doc Is Nothing Then

 

MsgBox("Could not find file " & name & "in vault")

Else

 

doc.Save(workDir)

End If

 

If extension = swDocumentTypes_e.swDocASSEMBLY Then

 

For i = 0 To doc.References.Count - 1

doc2 = connection.GetSpecificDocument(doc.References(i).Name)

doc2.Save(workDir)

Next i

End If

 

connection.Logout()

newDoc = swApp.OpenDoc6(workDir & doc.Name, extension, 0, "", 0, 0)

SolidworksApi macros