Training or documentation on using the iLogic classes for vb.net?

Training or documentation on using the iLogic classes for vb.net?

awatt
Advocate Advocate
963 Views
2 Replies
Message 1 of 3

Training or documentation on using the iLogic classes for vb.net?

awatt
Advocate
Advocate

I'm trying to port a number of existing iLogic and vba routines to a single vb.net addin.

I've seen the basic 'my first add-in' tutorial, the help files in inventor, and a few web pages.  Good information, but not much of it.

 

Moving forward, now what?  The documentation is becoming quite sparse.

 

At the moment, I'm looking form information on the iLogic.automation class and its brothers.  But there at least a half dozen other battle fronts where I'm trying to learn the API.

 

Does documentation for these classes exist?  Is it only available to adn members?

Are there courses one can take to learn this stuff?

 

Into exactly which priesthood do I need to be initiated?Smiley Frustrated

 

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

Curtis_Waguespack
Consultant
Consultant

Hi awatt,

 

Here is a link that might get you pointed in the right direction:

http://inventortrenches.blogspot.com/2013/10/ilogic-how-to-learn-inventors.html

 

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

0 Likes
Message 3 of 3

rjay75
Advisor
Advisor
Accepted solution

If you're trying to replace the functionality that existing VBA and iLogic routines did you don't need the iLogic automation class at all. The automation class is really for manipulating rules. All the rest of the utility that iLogic provides is short hand to the API.  Just use the Inventor API directly. Some tasks may be more verbose and explicit. It will be very difficult if not impossible to try and use iLogic methods from an add-in. But don't worry. There's nothing mystical to using the API. You just have to approach things in much smaller chunks of functionality. Note: VBA uses the same API so most of those should directly port. You'll just be porting the code from VBA to VB.NET and maybe setting up the context in which it is run.

 

For example, suppressing an object.

 

iLogic Rule Method:

Component.IsActive("Part1:1") = False

 

From an Add-in (Absolutely no error checking, this will normally be broken up.)

Dim comp As ComponentOccurrence = invApplication.ActiveDocument.ComponentDefinition.Occurrences("Part1:1")

comp.BOMStructure = BOMStructureEnum.kReferenceBOMStructure

comp.Suppressed = True

 

How to find the info:

First you have to understand what the iLogic rule and methods are doing. The Component.IsActive method takes the name of a component, finds it in the active document, changes the BOM structure to Reference then suppresses the component.

 

Using the Inventor API help file for reference. I know I want to affect components. Looking through the API under the topic "Building an Assembly" I see how an assembly is structured.

asmDiagram.PNG

I pick the ComponentOccurrence Object cause it's a singular object low on the list that sounds like it could represent a component.

Now I have to see how to get to it. The diagram gives me the hiearchy to get to it. Using the API I look up each object and find the property that exposes the next desired object. I have to always though start from the very top which is the Inventor Application which I've previously defined at the start in my addin.

Thus I get: invApplication.ActiveDocument.ComponentDefinition.Occurrences("Part1:1")

 

Now that I have a component I look at the ComponentOccurrence object in the API to see what I can do from there. (Alot) But all I'm interested is seeing how to change the BOM structure type and suppressing it. There I find the properties, BOMStructure and Suppressed. The help file tells me what kinds of values they can be set too.

 

So you use that process you use for basically everything you want to do. And ask lots of questions here. The API help file will become your best friend.

 

Also best to completely ignore iLogic and iLogic.automation while developing add-ins unless your add-in automates iLogic Rules and only the rules themselves, not what the rules are doing.