Using the API to ignore iLogic Rules or to ignor Error in Rules dialog

Using the API to ignore iLogic Rules or to ignor Error in Rules dialog

rfink
Enthusiast Enthusiast
3,299 Views
8 Replies
Message 1 of 9

Using the API to ignore iLogic Rules or to ignor Error in Rules dialog

rfink
Enthusiast
Enthusiast

I am indexing through folders and opening .dwg files to get the notes and properties and then closing the file with the Inventor API from an Excel VBA project.

 

I get an Error Dialog because of some Errors in the Ilogic rules.

 

Is there a way to ignore the iLogic rules with the API, or to ignore the Error dialog that I get from the .dwg?

0 Likes
Accepted solutions (3)
3,300 Views
8 Replies
Replies (8)
Message 2 of 9

Curtis_Waguespack
Consultant
Consultant

Hi rfink,

 

Assuming the rule with the error is an internal rule and not an External rule, I think you can use something like this to suppress a rule of given name, as you edit the document. Make sure to use ActiveEditDocument (rather than ActiveDoucment).

 

 

Auto = iLogicVb.Automation
Dim iLogicAuto As Object
iLogicAuto = Auto
Dim oDoc As Document
oDoc = ThisApplication.ActiveEditDocument

'get collection of rules
Dim ruleName As String
Dim rules As Object
rules = iLogicAuto.rules(oDoc)

'make sure there are rules in the file
If Not (rules Is Nothing) Then
	For Each rule In rules
	If rule.Name = "MyRule" Then
		'suppress rule
		iLogicAuto.GetRule(oDoc, rule.Name).IsActive = False 
	End If
	Next 
Else
End If

 

 

Or use this to delete the rule:

 

Auto = iLogicVb.Automation
Dim iLogicAuto As Object
iLogicAuto = Auto
Dim oDoc As Document
oDoc = ThisApplication.ActiveEditDocument

'get collection of rules
Dim ruleName As String
Dim rules As Object
rules = iLogicAuto.rules(oDoc)

'make sure there are rules in the file
If Not (rules Is Nothing) Then
	For Each rule In rules
	If rule.Name = "MyRule" Then
		'delete rule
		iLogicAuto.DeleteRule(oDoc, rule.Name)
		
	End If
	Next 
Else
End If

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

EESignature

0 Likes
Message 3 of 9

rfink
Enthusiast
Enthusiast

Cutis,

 

Thanks for you help.

 

However, I am trying to supress the internal iLogic rules externally using the Inventor API and am making calls from and Excel VBA project.

 

I can't get a reference to iLogicVb.Automation

 

Any suggestions?

 

Ross

0 Likes
Message 4 of 9

rossano_praderi
Collaborator
Collaborator
Accepted solution

Hi,

you are looking in the wrong direction.

 

The follow .DLL contain the Ilogic commands and it's not interoperable with COM calls (like Excel VBA)

"C:\Program Files\Autodesk\Inventor 2015\Bin\Autodesk.Ilogic.Automation.dll"

 

I suggest you to convert your Vba macro in .NET code, or create an excel addin which work as a bridge between these two applications (Inventor/Excel).

 

Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 5 of 9

rossano_praderi
Collaborator
Collaborator
Accepted solution

Sorry I've forgot the following option

 

Sub IlogicRun()
    Ilogic ("messaggio.txt") ' file rule name
End Sub
Sub Ilogic(rule As String)
    Dim InventorApplication As Inventor.Application
    Set InventorApplication = GetObject(, "Inventor.Application")
    Dim iLogicAuto As Object
    Dim oDoc As Inventor.Document
    Set oDoc = InventorApplication.ActiveDocument
    If oDoc Is Nothing Then
        MsgBox ("Missing Inventor Document")
    Exit Sub
    End If
    Set iLogicAuto = GetiLogicAddin(InventorApplication)
    If (iLogicAuto Is Nothing) Then Exit Sub
    exe = iLogicAuto.Automation.RunExternalRule(oDoc, rule)
End Sub
        
Private Function GetiLogicAddin(ByRef InvApp As Inventor.Application) As Inventor.ApplicationAddIn
    Dim addIn As Inventor.ApplicationAddIn
        Set addIn = InvApp.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")
        addIn.Activate
        Set GetiLogicAddin = addIn
End Function

Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 6 of 9

rfink
Enthusiast
Enthusiast

I was afaid that was the case!

 

Thanks for the answer!

0 Likes
Message 7 of 9

rfink
Enthusiast
Enthusiast

Rossano,

 

I was able to connect to the iLogic Extension and disable the document rules.

 

Do you know if there is any reference material regarding the object,properties and methods of the iLogic Add In?

 

Thanks for you help.

 

Ross

0 Likes
Message 8 of 9

rossano_praderi
Collaborator
Collaborator
Accepted solution

Ross,

sorry for the late response.

 

I didn't find any reference documentation on the net.

 

The easier way is to use the object explorer of Visual Studio, but this doesn't give you all the required informations.

 

Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 9 of 9

Anonymous
Not applicable

should be:

 

set rules = iLogicAuto.rules(oDoc)

0 Likes