Well it should be stated that an iLogic rule can contain VB.net code (or just regular ol' VBA), and not have any 'iLogic' code in it. In a nut shell, iLogic is an exclusive collection of methods that are only recognized when used in the context of an iLogic rule inside of Inventor. For instance the command :
Component.IsActive("ComponentName : #") = True / False
This will change the suppression state of the component named, and is an ilogic statement. Becasue of this you may notice that you don't have to declare just where that component exists, as it tries to derive the context from the place you are running the actual rule from. That is, if you run that command in a rule that is in the main assembly and your componet named exists inside the first level of that assembly, it will have its state changed. However, if you attempt to run that from a part file it will simply error out as it can not grasp the correct context from the environment.
So when you start to mash the two together inside of a rule, you can get the full power of the API plus the additional ease of having some of the methods automatically applied within the correct context.
Using the sollution code I will provide an example of a mashup
There is a line :
iProperties.Value(docFName, "Project", "Authority")
That bit of code would not work inside of VBA or VB.net, but iLogic (please refere to your iLogic snippets specifically for this line of code) is able to handle and point to iproperties that I would otherwise have to map out, making life easier.
Normally I would have to work my way through the PropertySets of an object, but this way I can simply declare the name of the document I would like to interact with, the iproperty tab, and the iproperty itself, and it does the rest.
It should also be said that most things you write in VBA can work in the iLogic rule editor so long as you remove the ‘Set’ and ‘Let’ keywords. You can also get a lot of ilogic code working inside of VBA if you include the Set keyword when setting the value of an object. Of course, no matter what you will not be able to use the iLogic only keywords inside of anything other than iLogic.
I hope that this helps!
If my solution worked or helped you out, please don't forget to hit the kudos button 🙂iLogicCode Injector:
goo.gl/uTT1IB