Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Translator Addins

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
307 Views, 2 Replies

Translator Addins

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
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

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
Message 3 of 3
Anonymous
in reply to: Anonymous

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
>
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report