Inventor General Discussion

Inventor General Discussion

Reply
Contributor
rthapa
Posts: 14
Registered: ‎12-05-2006
Message 1 of 5 (1,334 Views)
Accepted Solution

EXPORT TO DWG ILOGIC RULE DOES NOT WORK

1334 Views, 4 Replies
01-05-2012 07:26 PM
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 -------------------

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.

 

You have created this thread twice now.

Please add your comments to the original forum request.

Jon.

Product Support
jon.dean
Posts: 251
Registered: ‎06-02-2010
Message 2 of 5 (1,309 Views)

Re: EXPORT TO DWG ILOGIC RULE DOES NOT WORK

01-09-2012 07:11 AM 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

Employee
jeffrey.sun
Posts: 33
Registered: ‎08-07-2011
Message 3 of 5 (1,297 Views)

Re: EXPORT TO DWG ILOGIC RULE DOES NOT WORK

01-09-2012 07:35 PM 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.

Product Support
jon.dean
Posts: 251
Registered: ‎06-02-2010
Message 4 of 5 (1,276 Views)

Re: EXPORT TO DWG ILOGIC RULE DOES NOT WORK

01-10-2012 03:31 AM in reply to: jeffrey.sun

You have created this thread twice now.

Please add your comments to the original forum request.

Jon.



Jon Dean

Contributor
rthapa
Posts: 14
Registered: ‎12-05-2006
Message 5 of 5 (1,264 Views)

Re: EXPORT TO DWG ILOGIC RULE DOES NOT WORK

01-10-2012 06:56 AM 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.