AddVbFile dynamic path

AddVbFile dynamic path

mat_hijs
Collaborator Collaborator
140 Views
2 Replies
Message 1 of 3

AddVbFile dynamic path

mat_hijs
Collaborator
Collaborator

I have an external rule with straight VB code containing some classes I want to be able to re-use across rules. This works by adding the following line at the top of the rule:

AddVbFile "C:\Users\mathijs.stevens\Glas Ceyssens NV\Autodesk Inventor - General\Inventor Instellingen\R2025\iLogicSDK\ContentCenterReynaers.iLogicVb"

However, when migrating to a new release I will also create a whole new folder for all my settings, styles, ... Because of that the "R2025" should become "R2026" after migrating. Is there a way to make this dynamic? I tried this, but it doesn't seem to accept an expression:

AddVbFile "C:\Users\mathijs.stevens\Glas Ceyssens NV\Autodesk Inventor - General\Inventor Instellingen\R" & ThisApplication.SoftwareVersion.DisplayVersion.Substring(0, 4) & "\iLogicSDK\ContentCenterReynaers.iLogicVb"

0 Likes
Accepted solutions (1)
141 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @mat_hijs.  The way I make the AddVbFile line dynamic in the header of my rules is to not include the path at all, just the file name, and file extension.  In order to make that work, I have included that lowest level folder (the folder that the referenced external rule is directly within) in the iLogic Configuration settings, under where it lets us specify the 'External Rule Directories'.  You probably already know this, but those settings are on the Tools tab, Options panel, which may need to be expanded down to see it.  You would only need to do that once per model year change of Inventor, if the model year is in the path.  We have our settings stored on a shared server drive, with no model year in its path, so it rarely needs to be changed.  Unfortunately, last I checked, we can not just list a single higher level directory/folder there, which contains sub folders where the actual rule files are.  If we do that, it will want us to specify the sub folders portion of the path each time we call for a rule to run.  So, since we have a lot of sub folders, representing categories, we include each sub folder directly in that list.  Then, we only have to specify a rule's name to run it, or refer to it.

Since we can list those folders there, you may be able to store your rules in a folder that does not include a model year of Inventor in its path, to avoid the changes per model year of Inventor.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

mat_hijs
Collaborator
Collaborator

Perfect solution for me right now. I don't mind having to change the folder in the iLogic Configuration once for every release, I've been doing that anyway. Thanks!

0 Likes