I'm trying to run an external iLogic rule on a model from inside the drawing of that model. I found a few threads with references to iLogicVB.RunExternalRule that reference the part and external rule. This thread here shows what I want to do, but trying to call out a component in that command throws an error.
Using the new handy iLogic editor, the RunExternalRule command doesn't list the option for supplying a component to run the rule on. Did this get removed in recent versions? I'm currently using 2020.2.1.
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi @pball
I'm not sure if something changed or not, but this does work in Inventor 2020:
iLogicVb.Automation.RunExternalRule(oDoc, "MyRule")
You can use something like this to open the document so that the external rule will "see" it
oDoc = ThisDrawing.ModelDocument Dim openedView As Inventor.View = Nothing If oDoc IsNot ThisApplication.ActiveDocument Then openedView = oDoc.Views.Add() oDoc.Activate() End If 'optional, hide openedView afer it opens 'openedView.Visible = False iLogicVb.Automation.RunExternalRule(oDoc, "MyRule") If openedView IsNot Nothing Then openedView.Close() End If
'example external rule "MyRule" MessageBox.Show(ThisApplication.ActiveDocument.fullfilename, "iLogic")
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
You would just have to activate whichever document you want the external rule to work on, before you run the external rule. This can easily be done by code.
Wesley Crihfield
(Not an Autodesk Employee)
@Curtis_Waguespack Adding the Automation in there is exactly what I needed. Interesting the shorter version doesn't work.
@WCrihfield I knew that was an option but for this script I want things to be seamless.
Can't find what you're looking for? Ask the community or share your knowledge.