Translator Addins

This widget could not be displayed.

Translator Addins

Anonymous
Not applicable
Could someone please explain how to use the following method with regards to
a Translator

SaveCopyAs(SourceObject As Object, Context As TranslationContext, Options As
NameValueMap, TargetData As DataMedium)

Example, Explanation or link will be much appreciated!!!

Thanks
Bradley
0 Likes
Reply
351 Views
2 Replies
Replies (2)

Anonymous
Not applicable
Try runnning these from an Inventor Macro. You would need to change the way
the document and Inventor arre referenced if running via VB or VBA from
another app

Public Sub testDXF()
Dim oDoc as document
Set oDoc = ThisApplication.ActiveDocument
Dim addIns As ApplicationAddIns

Set addIns = oDoc.Parent.ApplicationAddIns

Dim dxfAddIn As TranslatorAddIn
For i = 1 To addIns.Count
If addIns(i).AddInType = kTranslationApplicationAddIn Then
If addIns(i).Description = "Autodesk Internal DXF Translator"
Then
Set dxfAddIn = addIns.Item(i)
Exit For
End If
End If
Next i

'Activate AddIns
dxfAddIn.Activate


Call createDXF(oDoc.Parent, dxfAddIn,"c:\temp\test.dxf")
End Sub



Private Sub createDXF(oApp As Object, dxfAddIn As TranslatorAddIn, fname 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 = dxfAddIn.HasSaveCopyAsOptions(file, context, map)


file.FileName = fname
'specify ini file from where the setting will be pickup

map.Value("Export_Acad_IniFile") = "d:\temp\dxfconfig.ini"
dxfAddIn.SaveCopyAs oApp.ActiveDocument, context, map, file


End Sub
0 Likes

Anonymous
Not applicable
Thanks a Million Greg

Brad


"Greg Heeley" wrote in message
news:085236820BD83A934CEB39AA14A5FCAF@in.WebX.maYIadrTaRb...
> Try runnning these from an Inventor Macro. You would need to change the
way
> the document and Inventor arre referenced if running via VB or VBA from
> another app
>
> Public Sub testDXF()
> Dim oDoc as document
> Set oDoc = ThisApplication.ActiveDocument
> Dim addIns As ApplicationAddIns
>
> Set addIns = oDoc.Parent.ApplicationAddIns
>
> Dim dxfAddIn As TranslatorAddIn
> For i = 1 To addIns.Count
> If addIns(i).AddInType = kTranslationApplicationAddIn Then
> If addIns(i).Description = "Autodesk Internal DXF Translator"
> Then
> Set dxfAddIn = addIns.Item(i)
> Exit For
> End If
> End If
> Next i
>
> 'Activate AddIns
> dxfAddIn.Activate
>
>
> Call createDXF(oDoc.Parent, dxfAddIn,"c:\temp\test.dxf")
> End Sub
>
>
>
> Private Sub createDXF(oApp As Object, dxfAddIn As TranslatorAddIn, fname
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 = dxfAddIn.HasSaveCopyAsOptions(file, context, map)
>
>
> file.FileName = fname
> 'specify ini file from where the setting will be pickup
>
> map.Value("Export_Acad_IniFile") = "d:\temp\dxfconfig.ini"
> dxfAddIn.SaveCopyAs oApp.ActiveDocument, context, map, file
>
>
> End Sub
>
>
>
0 Likes