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: 

Migrating VB code to Inventor 2013 ... iLogic is giving errors

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
2096 Views, 7 Replies

Migrating VB code to Inventor 2013 ... iLogic is giving errors

I'm trying to migrate my company's VB.NET application that worked with Inventor 2011 over to 2013.  Its an application that runs as an external process that starts up Inventor, opens up a model, updates the model and saves it to Vault.  It uses iLogic to make updates to the model based on parameters that it receives from an Excel spreadsheet.

 

When Inventor is run manually I can open up the model and "run rule" from the iLogic Browser. That part works. If I try to automate this application then it fails. I'm getting a strange error message that I don't understand. It can't be trapped in a try/catch block.  It appears in a dialog box.

 

Error in rule: Parameters, in document: MyAssembly.iam

 

Failed to create VaultAccess object.

 

System.InvalidOperationException: Failed to create VaultAccess object. ---> System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'VaultAddInLib.IVaultApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{6796EC03-5DAB-4B0B-849B-41195C3429E8}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).    at iLogic.VaultApplication..ctor(InventorServerObject app)    at iLogic.ComponentInRule..ctor(Document rootDoc, InventorServerObject server)    --- End of inner exception stack trace ---    at iLogic.ComponentInRule..ctor(Document rootDoc, InventorServerObject server)    at iLogic.RuleEvalContainer.GetOrCreateNamedProperty(NamedProperty property)    at iLogic.RuleEvalContainer.GetCadComponent()    at LmiRuleScript.SetHost(IRulesHost host)    at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)    at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

 

Again, this application worked in 2011 and not with 2013. There's a post that had a similar problem to this one but was unresolved. http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/iLogic-rules-in-a-vault-assembly-file/...

 

 

Some brief code...

Try    

     objILogicAutomation.RunRule(doc, RuleName)

Catch ex As Exception    

     Debug.print(ex.Message)

End Try

 

When objILogicAutomation.RunRule(doc, RuleName)  is executed, the error message from Inventor (ILogic?) appears in a two tab dialog box with the above error messages.

 

Any help would be appreciated.

 

7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: Anonymous

Attached are screen captures of the error message. I suspect that its coming from iLogic. This only happens if I run the application I'm migrating. When it comes time to "RunRules" the messages appear and nothing happens.

 

If I manually open the assembly and run Run Rules from the iLogic browser it appears to work.

 

I don't understand why VaultAddinLib.IVaultApplication has anything to do with iLogic. Does it need to reference this library? FWIW... The Inventor session is logged into Vault.

Message 3 of 8
xiaodong_liang
in reply to: Anonymous

Hi,

 

Without a concrete demo code, it is a bit hard to say what happened. Could you share more information? How is the iLogic code written to get Vault application?

Message 4 of 8
Anonymous
in reply to: xiaodong_liang

I found a solution to the problem but not a good one.

 

It turns out that the Inventor 2013 iLogic AddIn is trying to reference a type library found in Inventor 2011. It should be located in C:\Program Files\Autodesk\Inventor 2011\Bin\InventorVault.dll. If you don't have Inventor 2011 installed then the iLogic AddIn will throw this error.

 

On my target PC I just had Inventor/Vault  2013 installed and kept getting those errors. As a test I installed Inventor 2011. When I ran my custom AddIn that I'm developing for Inventor 2013,  the iLogic error message went away.

 

Since the iLogic AddIn references the IVaultApplication interface from 2011 and is not provided in 2013, will Autodesk provide this DLL future distributions or service packs of Inventor?

 

More Detail...

 

The application I am working on is a custom AddIn for Inventor. It started out as an AddIn for Inventor 2011 and so I needed to update it to work with Inventor 2013.  All was fine on my development PC but when I installed my AddIn on a new PC I would get the "Error in rule: Parameters" popup. The error message appears right about the time RunRules is called. Strange thing is that the message box complained about a missing VaultAddInLib.IVaultApplication interface. It didn't make sense to us what this error message was telling us. Drove us crazy because we thought the problem was coming from our iLogic code which didn't have anything to do with Vault.

 

System.InvalidOperationException: Failed to create VaultAccess object. ---> System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'VaultAddInLib.IVaultApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{6796EC03-5DAB-4B0B-849B-41195C3429E8}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
   at iLogic.VaultApplication..ctor(InventorServerObject app)
   at iLogic.ComponentInRule..ctor(Document rootDoc, InventorServerObject server)
   --- End of inner exception stack trace ---
   at iLogic.ComponentInRule..ctor(Document rootDoc, InventorServerObject server)
   at iLogic.RuleEvalContainer.GetOrCreateNamedProperty(NamedProperty property)
   at iLogic.RuleEvalContainer.GetCadComponent()
   at LmiRuleScript.SetHost(IRulesHost host)
   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

On my development PC I have both 2013 Inventor/Vault Professional and 2011 Inventor/Vault Professional installed. The iLogic ran fine with no error messages.

 

On the PC I was targeting I installed 2013 Inventor/Vault Professional with all of the required service packs. The 2011 Inventor/Vault was not installed. On this machine my application displayed the above error message.

 

On my development pc, I searched for the registry for IVaultApplication which appeared in the above message. I was able to find it. On the other PC I was not able find anything in the registry concerning IVaultApplication.

 

I searched my development PC for the InventorVault.dll and there were a couple listed for Inventor 2011, 2013, ETO, and iLogic so I didn't know which was the reference.  I used oleviewer.exe to examine the IVaultApplication interface and found that its referring to the VaultAddIn 1.0 Type library located in C:\Program Files\Autodesk\Inventor 2011\Bin\InventorVault.dll. It has the same class id referenced in the error message.

 

I installed 2011 Inventor and now the error message does not appear.

Message 5 of 8
adam.nagy
in reply to: Anonymous

Hi,

 

In case of Inventor 2014 that dll seems to be called "Interop.VaultAddInLib.dll"

So maybe you'll just have to reference that instead and everything will be solved - I hope.

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 6 of 8
Anonymous
in reply to: adam.nagy

There is no reference in the custom addin that points to the 2011 dll (it's part of Inventor) so Autodesk will need to porvide an update or a solution to resolve this.

Message 7 of 8
wayne.helleyY67EK
in reply to: Anonymous

I'm getting this problem with Inventor 2023.1.1

Message 8 of 8
k.jarzymowski
in reply to: Anonymous

I'm still also seeing this issue in Inventor Pro 2023, has anyone found a solution? Currently to bypass this I'm generating VBA code through my add-in to run a particular rule, but this is far from ideal.

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

Post to forums  

Autodesk Design & Make Report