Thanks Brian
I now able to open the idw in Invento through VB
and save it as dwg, only user iteration is needed to ignore the File Dialog for idw included parts/assemblies location.
Sub Main()
Dim oInvApp As Inventor.Application
'Launch Inventor
Set oInvApp = CreateObject("Inventor.Application")
oInvApp.Visible = True
'Set Startup options.
oInvApp.GeneralOptions.ShowStartupDialog = False
Dim oDoc As Inventor.DrawingDocument
Set oDoc = oInvApp.Documents.Open(sDestino)
' User iteration is needed in this point
Dim addIns As ApplicationAddIns
Set addIns = oDoc.Parent.ApplicationAddIns
Dim dwgAddIn As TranslatorAddIn
Dim i As Integer
For i = 1 To addIns.Count
If addIns(i).AddInType = kTranslationApplicationAddIn Then
If addIns(i).Description Like "*DWG*" Then
Set dwgAddIn = addIns.Item(i)
Exit For
End If
End If
Next i
'Activate AddIns
dwgAddIn.Activate
Dim fNAME As String
fNAME = oDoc.FullFileName
fNAME = Left(fNAME, Len(fNAME) - 3) & "dwg"
Dim iPath As Integer
Dim sPath As String
iPath = InStrRev(fNAME, "\")
sPath = Left(fNAME, iPath)
Call createDWG(oDoc.Parent, dwgAddIn, fNAME, sPath)
oDoc.Close SaveChanges = False
oInvApp.Quit
Set oInvApp = Nothing
End If
End Sub
Private Sub createDWG(oApp As Object, dwgAddIn As TranslatorAddIn, fNAME As String, sPath As String)
Dim map As NameValueMap
Dim context As TranslationContext
Dim trans As TransientObjects
Set trans = oApp.TransientObjects
Set map = trans.CreateNameValueMap
Set context = trans.CreateTranslationContext
context.Type = kFileBrowseIOMechanism
Dim b As Boolean
Dim file As DataMedium
Set file = trans.CreateDataMedium
b = dwgAddIn.HasSaveCopyAsOptions(file, context, map)
file.FileName = fNAME
'specify ini file from where the setting will be pickup
map.Value("Export_Acad_IniFile") = sPath & "dwgconfig.ini"
dwgAddIn.SaveCopyAs oApp.ActiveDocument, context, map, file
End Sub