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 Run External rule has no option to run in another component?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
pball
685 Views, 3 Replies

iLogic Run External rule has no option to run in another component?

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.

 

image.png

3 REPLIES 3
Message 2 of 4
Curtis_Waguespack
in reply to: pball

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

 

Message 3 of 4
WCrihfield
in reply to: pball

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

EESignature

(Not an Autodesk Employee)

Message 4 of 4
pball
in reply to: Curtis_Waguespack

@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.

Post to forums  

Technology Administrators


Autodesk Design & Make Report