write idw to dxf using translator addin with c#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to export an idw file to dwg using c# and the dwg translator addin. running the code below there is a COMException (E_UNEXPECTED) while executing dwgAddIn.SaveCopyAs.
Similar code works fine with the pdf translator and it also works fine translated to VBA and runnig as a macro within Invetor.
I will apreciate any idea...
Here's the code:
publicstaticvoid SaveAsDwg(Inventor.Application InvApp, Inventor.DocumentInvDoc)
{
Inventor.TranslatorAddIn dwgAddIn =
(Inventor.TranslatorAddIn)InvApp.ApplicationAddIns.get_ItemById("{C24E3AC2-122E-11D5-8E91-0010B541CD80}");
if (dwgAddIn == null)
thrownewException("Could not access DWG translator.");
Inventor.TranslationContexttranslationContext = InvApp.TransientObjects.CreateTranslationContext();
translationContext.Type = Inventor.IOMechanismEnum.kFileBrowseIOMechanism;
Inventor.NameValueMapoptions = InvApp.TransientObjects.CreateNameValueMap();
if(dwgAddIn.get_HasSaveCopyAsOptions(InvDoc, translationContext, options))
{
options.set_Value("Export_Acad_IniFile", @"c:\temp\dwg.ini");
Inventor.DataMediumdataMedium = InvApp.TransientObjects.CreateDataMedium();
dataMedium.FileName =@"C:\temp\test2.dwg";
dwgAddIn.SaveCopyAs(InvDoc, translationContext, options, dataMedium);
}
}
Karl