Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EXPORT TO DWG ILOGIC RULE DOES NOT WORK

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
rthapa
2320 Views, 4 Replies

EXPORT TO DWG ILOGIC RULE DOES NOT WORK

Can someone help me out? I have a simple iLogic rule to save an IDW using SAVE COPY AS DWG. The rule was created in Inventor 2011 ilogic and was embeded in the IDW template. Trigger was set to activate when the new drawing file was saved. It no longer works and errors out in Inventor 2012. The template has been migrated to 2012 and so has the project file. The ilogic Code is given below. Can anyone help me out figure out the error or tell me if some new settings in Inventor 2012 need to be changed for it to work? Or if you have an ilogic rule to do the same that works, perhaps you can post in an answer to me. '------- start of iLogic code ------------------- ' Get the DWG translator Add-In. Dim DWGAddIn As TranslatorAddIn DWGAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}") 'Set a reference to the active document (the document to be published). Dim oDocument As Document oDocument = ThisApplication.ActiveDocument Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism ' Create a NameValueMap object Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap ' Create a DataMedium object Dim oDataMedium As DataMedium oDataMedium = ThisApplication.TransientObjects.CreateDataMedium ' Check whether the translator has 'SaveCopyAs' options If DWGAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then Dim strIniFile As String strIniFile = "C:\temp\DWGout.ini" ' Create the name-value that specifies the ini file to use. oOptions.Value("Export_Acad_IniFile") = strIniFile End If 'Set the destination file name oDataMedium.FileName = "C:\" & ThisDoc.FileName() & ".DWG" DWGAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) 'Launch the DWG file in whatever application Windows is set to open this document type with i = MessageBox.Show("Preview the DWG file?", "Title",MessageBoxButtons.YesNo,MessageBoxIcon.Question) If i = vbYes Then ThisDoc.Launch(oDataMedium.FileName) '------- end of iLogic code -------------------
4 REPLIES 4
Message 2 of 5
Jon.Dean
in reply to: rthapa

I had another customer with a similar problem and I logged the issue with development.

I am still waiting for them to update me.

I think the problem is the Add-in ID but I am not 100% sure.



Jon Dean

Message 3 of 5
jeffrey.sun
in reply to: rthapa

Hi Rthapa,

 

Your iLogic code works. I tried the following steps.

  1. Start inventor 2012.
  2. New an idw and save it
  3. Create a ilogic rule.
  4. Paste the ilogic code (in the diagnosis window) to the code window.
  5. Make sure the C:\temp\DWGout.ini exist.
  6. Run the rule.

Result: The dwg can be generated correctly.

 

Can you verify if the ini file ("C:\temp\DWGout.ini"  )  referenced in your code exist? Expection will be thrown if it doesn't exist.

 

If the problem still exists on your build, could you upload a problematic idw with the rule and the screenshot for the error message? It will help a lot to triage the issue.

 


Please mark this response as "Accept as Solution" if it answers your question.
-----------------------------------------------------------------------------------------



Jeffrey Sun
SW Engineer
Manufacturing Industry Group
Autodesk, Inc.

Message 4 of 5
Jon.Dean
in reply to: jeffrey.sun

You have created this thread twice now.

Please add your comments to the original forum request.

Jon.



Jon Dean

Message 5 of 5
rthapa
in reply to: jeffrey.sun

Hi Jeffrey.Sun,

You are awesome.  Your suggestion worked.

 

My original IDW template was migrated from Inventor 2011 to Inventor 2012 with the rules already embeded.

 

With your suggestion, I created a new blank IDW template with no rules then added the same old rule in it. It works like a charm now.

 

Somehow migrating old template was failing.

 

Yeh! Off to the races.

 

Raj

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

Post to forums