Autodesk Inventor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Inventor 2012 SAVE COPY AS DWG Ilogic Code Error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
HELP!
Are there anyone out there using Inventor 2012 and using ilogic rule or VB codes to auto Save Copy AS DWG?
My old code error out when debugging. The exact error is on this code line:
DWGAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
Autodesk has agreed that this code does not work on Inventor 2012 and that the development is working on it. This code is part of the Snippets built in Inventor iLogic Rule Browser.
Someone must have an answer or workaroudn this problem out there. Help.
Solved! Go to Solution.
Re: Inventor 2012 SAVE COPY AS DWG Ilogic Code Error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Rthapa,
I reply the iLogic issue in this thread (http://forums.autodesk.com/t5/Autodesk-Inventor/EX
If you want to do the export work with VB or C# application, it is also possilbe, and it would be easy to implement export automation. The detailed steps is stated below.
Dwg out in VB application
- Create a VB console project
- Add COM referece "Autodesk Inventor Object Library";
- Add the code to do the dwgout work.
|
Imports Inventor
Module Module1 SubSaveAsDwg() DiminventorTypeAsType = System.Type.GetTypeFromProgID("Inventor.Application") DimInvAppAsInventor.Application = System.Activator.CreateInstance(inventorType) IfInvAppIsNothingThenThrowNewException("Could not start Inventor.") EndIf ' Dim InvApp As Inventor.Application = System.Runtime.InteropServices.Marshal.GetActiveOb 'InvApp.Visible = True'We must use true. Otherwise it will crash when do dwgout.DimInvDocAsDrawingDocument = InvApp.Documents.Open("C:\drawing.idw", True) IfInvDocIsNothingThenThrowNewException("Could not open idw file.") EndIf ' Get the DWG translator Add-In.DimDWGAddInAsTranslatorAddIn = InvApp.ApplicationAddIns.ItemById("{C24E3AC2-122E-11D5-8E91-0010B541CD80}") IfDWGAddInIsNothingThenThrowNewException("Could not access DWG translator.") EndIf DimtranslationContextAsTranslationContext = InvApp.TransientObjects.CreateTranslationContexttranslationContext.Type = IOMechanismEnum.kFileBrowseIOMechanism DimoptionsAsNameValueMap = InvApp.TransientObjects.CreateNameValueMap IfDWGAddIn.HasSaveCopyAsOptions(InvDoc, translationContext, options) Then options.Value("Export_Acad_IniFile") = "C:\dwg.ini" DimdataMediumAsDataMedium = InvApp.TransientObjects.CreateDataMediumdataMedium.FileName = "C:\test2.dwg" CallDWGAddIn.SaveCopyAs(InvDoc, translationContext, options, dataMedium) EndIf EndSub SubMain() TrySaveAsDwg() CatcheAsExceptionConsole.Write(e.Message) EndTryEndSub
End Module |
Please mark this response as "Accept as Solution" if it answers your question.
-----------------------------------------------------------------------------------------

Jeffrey Sun
SW Engineer
Manufacturing Industry Group
Autodesk, Inc.
Re: Inventor 2012 SAVE COPY AS DWG Ilogic Code Error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Dwg out in c# application
- Create a C# console project
- Add COM referece "Autodesk Inventor Object Library"
- Add the code to do the dwgout work.
|
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace dwgOutAddInCSharp { classProgram{ publicstaticvoidSaveAsDwg(){ System.TypeinventorType = System.Type.GetTypeFromProgID("Inventor.Application");Inventor.ApplicationInvApp = System.Activator.CreateInstance(inventorType) asInventor.Application; if (null == InvApp) thrownewException("Could not start Inventor.");
// We must use true. Otherwise it will crash when do dwgout. Inventor.DrawingDocumentInvDoc = InvApp.Documents.Open("C:\\drawing.idw", true) asInventor.DrawingDocument;if (null == InvDoc) thrownewException("Could not open idw file."); Inventor.TranslatorAddIndwgAddIn = (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:\dwg.ini");Inventor.DataMediumdataMedium = InvApp.TransientObjects.CreateDataMedium(); dataMedium.FileName = @"C:\test2.dwg"; dwgAddIn.SaveCopyAs(InvDoc, translationContext, options, dataMedium); } } staticvoidMain(string[] args){ try{ SaveAsDwg();} catch (System.Exceptionex){ System.Console.Write(ex.Message);} } } } |
Please mark this response as "Accept as Solution" if it answers your question.
-----------------------------------------------------------------------------------------

Jeffrey Sun
SW Engineer
Manufacturing Industry Group
Autodesk, Inc.
Re: Inventor 2012 SAVE COPY AS DWG Ilogic Code Error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you. Problem is resolved now.
My findings:
1. Migrating 2011 IDW Standard Template with embedded iLogic Rule to 2012 version does not work and corrupts the template file internally some how.
2. DWGOUT.INI file was in specified directory. Missing DWGOUT.INI file does crash the iLogic rule
3. Deleting iLogic Rules from migrated template, Save Copy AS to new file then add iLogic Rules back in Solved the problem.
4. DWGOUT.INI was already in place and was not modified.
Re: Inventor 2012 SAVE COPY AS DWG Ilogic Code Error
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
i've a similar issue in vb.net i'm trying to do an export from an iventor idw to an autocad dwg, and i'm trying to do this parallelly with the TPL of .net and i get this COMexception "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"
any suggestion ?
i've tried generating a new template file, but maybe i've done smthing wrong ...
