Run iLogic rule from Zero Document ribbon state

Run iLogic rule from Zero Document ribbon state

BrandonBG
Collaborator Collaborator
608 Views
10 Replies
Message 1 of 11

Run iLogic rule from Zero Document ribbon state

BrandonBG
Collaborator
Collaborator

Any suggestions on how to run an external iLogic rule from a ribbon button macro in the Zero Document state?

 

I'm getting stuck with the VBA line:

 

iLogicAuto.RunExternalRule oDoc, ExternalRuleName

Is it possible to run rules without referencing a document?

 

Brandon

0 Likes
609 Views
10 Replies
Replies (10)
Message 2 of 11

Curtis_Waguespack
Consultant
Consultant

HI BrandonBG,

 

I don't know of a way to do this but you can run rules from doc0 on doc1, by opening doc1 and then using ActiveEditDocument.

 

Example:

 

If I run this from any file, it opens Part1.ipt and returns it full file name in a messagebox then closes it.

 

ThisDoc.Launch("C:\TEMP\Part1.ipt")
oEditDoc = ThisApplication.ActiveEditDocument
MessageBox.Show(oEditDoc.FullFileName, "iLogic")
oEditDoc.Close

I'm not sure if that help what you're wanting to do or not, but this is how I've managed with iLogic in the past.

 

 

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

EESignature

Message 3 of 11

Anonymous
Not applicable

The snippet in Inventor doesn't require a document to be referenced as long as your external iLogic folder is set up correctly.

iLogicVb.RunExternalRule("ruleFileName")

 Does this not work in VBA?

0 Likes
Message 4 of 11

BrandonBG
Collaborator
Collaborator

Brian--

 

Your line of code shown is an iLogic-specific command, not VBA. I know the best solution for my issue is to jump into writing an add-in in VB, but I'm not there yet.

 

Thanks,

Brandon

0 Likes
Message 5 of 11

BrandonBG
Collaborator
Collaborator

Curtis--

 

That gives me a new avenue to explore. I hadn't thought of using a dummy object as a workaround.

 

Thanks,

Brandon

0 Likes
Message 6 of 11

BrandonBG
Collaborator
Collaborator

Just to close this out, I ended up ditching the external iLogic rule, and rewrote it inside VBA. Not ideal in my situation, but it works.

 

Brandon

0 Likes
Message 7 of 11

JBerns
Advisor
Advisor

Have there been any improvements since Inv 2022 in its ability to run an external iLogic rule, from the ZeroDoc environment (ribbon state)?

I think development would be much easier if we could edit the external rule versus the Inventor AddIn.

 

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes
Message 8 of 11

bradeneuropeArthur
Mentor
Mentor

Better is to start using vb.net and add ins for these cases, really.

If needed I can support on this. 

With vba and ilogic it is more complex than needed. Easy done with an add in...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 9 of 11

JBerns
Advisor
Advisor

@bradeneuropeArthur,

 

I am actively developing the add-in.

 

I had an external iLogic rule that did what I needed, but I had to have a document open to run the external rule.

I began developing an addin that could run from ZeroDoc.

A basic version is working that just creates a new assembly document, but no action beyond that (part placement, constraints, etc.)

Next I tried to make the addin button run the external rule, but this is where I am stuck.

 

Here is the other post of my code:

https://forums.autodesk.com/t5/inventor-programming-ilogic/run-external-rule-without-an-open-documen... 

 

I thought using an external rule would make it easier to update the process versus editing, compiling, and redistributing the DLL and ADDIN to users.

The external rule would live in a shared, network folder that all could access. If I edit it, all are "updated" without changing the addin.

 

I have been writing internal rules for 5+ years and external rules for 2+ years. I am comfortable with those.

I am now venturing into the world of addins. A bit over my head, but learning.

Any assistance is appreciated.

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes
Message 10 of 11

bradeneuropeArthur
Mentor
Mentor

Personally I use I logic only for testing. After this I simply copy and paste it in to my addin. This takes not more than half an hour in most cases. Sharing and distribution is even more easy than ilogic. Using bat files on startup. Let me know where I can guide you future with.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 11 of 11

JBerns
Advisor
Advisor

Thank you, Arthur. I look forward to working with you.

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional