I'm using Inventor 2021.2.2, so I'm not 100% sure all of this will work for you, but here is what I've got for you. This was written in iLogic, but iLogic uses VB.NET as its basis, so it should still be compatible with your vb project with minimal tweaks. It shows you how to work with Inventor's translator add-in (in case your not currently), and which options are available for you to set the way you want them by code. I don't currently know of any official documentation that specified what all the possible values to these options stand for, but with a little trial & error testing, you could likely figure it out on your own. I don't use this specific translator myself, so I don't have any personal experience based options values meanings for you, other than having just seen the default values in the dialog just before capturing the current options and their values to see what they were, before producing this code solution for you.
Here is the iLogic code for exporting Part or Assembly to OBJ file:
Sub Main 'Sub ExportToOBJ(oDoc As Inventor.Document)
Dim oApp As Inventor.Application = ThisApplication
Dim oDoc As Document = oApp.ActiveDocument
Dim oOBJ As TranslatorAddIn
For Each oAppAddin As ApplicationAddIn In oApp.ApplicationAddIns
If oAppAddin.DisplayName = "Translator: OBJ Export" Then
oOBJ = oAppAddin
End If
Next
'The following lines create the needed input variables
Dim oTO As TransientObjects = oApp.TransientObjects
Dim oContext As TranslationContext = oTO.CreateTranslationContext
oContext.Type = IOMechanismEnum.kUnspecifiedIOMechanism
Dim oOptions As NameValueMap = oTO.CreateNameValueMap
Dim oDataMedium As DataMedium = oTO.CreateDataMedium
'set these options the way you want them here
oOptions.Value("ExportUnits") = 0 '(I assume 0 is 'Source Units' in the dialog)
oOptions.Value("Resolution") = 1 '(I believe 1 = High, and 4 = Brep in the dialog)
oOptions.Value("SurfaceDeviation") = 16 '(I assume 16 is default in dialog)
oOptions.Value("NormalDeviation") = 1500 '(I assume 1500 is default in dialog)
oOptions.Value("MaxEdgeLength") = 100000 '(I assume 100000 is default in dialog)
oOptions.Value("AspectRatio") = 2150 '(represents 21.5 in the dialog - default setting)
oOptions.Value("ExportFileStructure") = 0 '(I assume 0 is 'One File' in the dialog)
'set output file's path and file name here
'the way it is set-up right now, it will save to the same location,
'and same file name as original document, 'but with the .obj file extension
oDataMedium.FileName = System.IO.Path.ChangeExtension(oDoc.FullFileName, ".obj")
If oOBJ.HasSaveCopyAsOptions(oDoc, oContext, oOptions) Then
oOBJ.SaveCopyAs(oDoc, oContext, oOptions, oDataMedium)
End If
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS
Wesley Crihfield
(Not an Autodesk Employee)