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: 

Ilogic dll Error Message

7 REPLIES 7
Reply
Message 1 of 8
johnster100
700 Views, 7 Replies

Ilogic dll Error Message

Hi there,

I've made a lot of ilogic rules which use dlls to look up text files for ratio values. The dlls all work fine and are stored in "C:\Program Files\Autodesk\Inventor 2012\Bin\iLogicAdd".

 

To add the dll I use the following method:

 

AddReference "Core_xxxx.dll" Dim dll as New Core_xxxx.Core_xxxx_Class

 

If, however, someone opens the file on a computer which does not have the dlls they get an error message saying

 

" Error on Line 0 : could not find library 'Core_xxxxxxx.dll'

  Error on Line 0 : compiler initialization failed unexpectedly: 0x80070002 "

 

Is there any way I can catch or silence this error? I would like to be able to open the model on computers which do not contain the dlls without the error message apprearing.

 

thanks,

John

7 REPLIES 7
Message 2 of 8
adam.nagy
in reply to: johnster100

Hi,

 

Did you try to put that section inside a Try/Catch block?

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 3 of 8
johnster100
in reply to: adam.nagy

Tried that, no luck unfortunately 😞

Message 4 of 8
MjDeck
in reply to: johnster100

John,

 

 Sorry, there's no way to suppress that error message.

 

 Here's a workaround: the dll doesn't have to be in the application directory. iLogic will be able to find it if it is in the same directory as the document, or in the project workspace directory. So when you copy the file to another computer, copy the dll's along with it.

 

 Another option would be to suppress the rule.


Mike Deck
Software Developer
Autodesk, Inc.

Message 5 of 8
Bram_Baars
in reply to: MjDeck

I'm looking for the same thing. We have an iLogic which uses webservice dll's, but on pc's without that dll I want the code to run as well. (On the PC of an engineer at an external engineering company)
Sadly I cannot seem to escape the declaration in the header.

Message 6 of 8
MjDeck
in reply to: Bram_Baars

@Bram_Baars , you can create a separate rule to run the original. In the new rule, check to see if the WebServices DLL is already loaded in the process. Here's sample code:

Imports System.Reflection
Sub Main
	If AssemblyIsLoaded("Autodesk.Connectivity.WebServices") Then
		iLogicVb.RunRule("RequiresWebServices")
	End If
End Sub

Function AssemblyIsLoaded(name As String) As Boolean
	Dim assemblies As Assembly() = AppDomain.CurrentDomain.GetAssemblies()

	For Each asm As Assembly In assemblies
		If asm.FullName.StartsWith(name) Then
			Return True
		End If
	Next
	Return False
End Function

 

Then you can set this rule to run on an event, instead of the original rule.
(Replace "RequiresWebServices" with the name of the original rule.)

This should work for the WebServices DLL because it's very likely that the Vault add-in will have loaded it before your rule runs.
Alternatively, you could use System.IO.File.Exists (and possibly other System.IO functions) to see if the DLL is available.


Mike Deck
Software Developer
Autodesk, Inc.

Message 7 of 8
Bram_Baars
in reply to: MjDeck

@MjDeck Thanks, those sound like good suggestions, we'll start fiddling with it!

Message 8 of 8
Bram_Baars
in reply to: Bram_Baars

Works like a charm!

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

Post to forums  

Autodesk Design & Make Report