Message 1 of 6
Cant figure out TransientObjects.DataMedium.string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I am trying to figure out a way to export a inventor file as a obj, but just the string of it I don't want it to actually save a file. I'm pretty sure it is related to DataMedium but i cant find examples of people using anything except or file name and when i run the bellow code in ilogic it throws out an error. i might be missing something obvious but if anyone could help it would be great
thanks
Sub main()
' Get the STEP translator Add-In.
Dim oOBJ As TranslatorAddIn
For Each oAppAddin As ApplicationAddIn In ThisApplication.ApplicationAddIns
If oAppAddin.DisplayName = "Translator: OBJ Export" Then
oOBJ = oAppAddin
End If
Next
If oOBJ Is Nothing Then
Exit Sub
End If
Dim oContext As TranslationContext
oContext = ThisApplication.TransientObjects.CreateTranslationContext
Dim oOptions As NameValueMap
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
If oOBJ.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
' Set application protocol.
' 2 = AP 203 - Configuration Controlled Design
' 3 = AP 214 - Automotive Design
oOptions.Value("ApplicationProtocolType") = 3
oContext.Type = kFileBrowseIOMechanism
Dim d As String = ""
Dim oData As DataMedium
oData = ThisApplication.TransientObjects.CreateDataMedium
oData.MediumType = MediumTypeEnum.kStringMedium
oData.String = d
oOBJ.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData.String)
MessageBox.Show(d)
End If
End Sub