Creating iLogic External Rule Function Collection

Creating iLogic External Rule Function Collection

Anonymous
Not applicable
1,812 Views
3 Replies
Message 1 of 4

Creating iLogic External Rule Function Collection

Anonymous
Not applicable

Hey All,

 

At my work I am trying to make some common functions for interacting with things like text files or particularly common situations. Currently we have the terrible practice of just having the function appear in the ilogic code for each case (a change nightmare). I would love for them to be able to include a .iLogicVB file at the top of the rule and just be able to call the functions from a external rule.

 

My largest issue is that my team is not very code literate (we hire Mech/Civil), as I know likely the right way to do this is to create a class of say TextFile with built in internal methods and then instantiate a object of it in the rule. Past engineers have gone this road and have left code that everyone else is basically afraid to change or reuse. It has even been a bit of a uphill battle introducing functions to the team. I would like to stay in the world of ilogic code instead of straight VB code to hopefully make these tools maintainable if I leave this job. Any way to do this or do I need to teach my team OOP to get this to stick?

 

 

Accepted solutions (1)
1,813 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Yes. You can just reference the other external iLogic rule file, where you defined the function (or Sub or Class, or other module) in, at the top of the other rule that you want to be able to use it using AddVbRule or AddVbFile.  Unfortunately, the external rule file that you want to use as a reference, must have the "Straight VB Code" option enabled, to use it this way.  I don't think the rule you're working with (that is referencing that externally stored function) needs to be set-up that way.  (You may have to check how your iLogic Configuration settings are set to make sure what file extension you're using for your external rule files.)

Here are a couple useful links:

Advanced iLogic Techniques Reference 

To Configure iLogic Options

About iLogic Expansion and Customization 

 

 

I hope this helps.
If this solves your problem, or answers your questions, please click 'Accept As Solution".
Or, if this helps you reach your goal, please click 'LIKES" 👍.

 

Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.
If you agree with any of them, please vote for them.

  • Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
  • Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
  • Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
  • Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
  • Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
  • SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here
  • Create DocumentSubTypeEnum Click Here
  • Add kRevisionTag or kDrawingRevisionTag to ObjectTypeEnum Click Here

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 4

Anonymous
Not applicable

Not exactly the answer I was hoping for, but thanks for the response none the less. Guess I will need to do some classes for my fellow engineers to hopefully make my code last past my tenure.

0 Likes
Message 4 of 4

DRoam
Mentor
Mentor

Hi @Anonymous, coincidentally, I just created a request for exactly this in the Idea board: iLogic: Create library of custom functions that are available in every rule. If you would find it useful, please give it a vote!

 

I wasn't aware of the ability to add external straight-VB code files when I created this, but I still think the idea is valid and would be a great improvement. It would be much more user-friendly (er... programmer-friendly), and it would hopefully be able to support iLogic functions like ThisDoc, Parameter(), iProperties.Value(), etc.