- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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!
---------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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 FunctionBregs
Rossano Praderi
--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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!
---------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report