@A.Acheson
I commented out the 'Logging' lines and yours ran, but it still errorred out like @NachoShaw's did.
I assume this is what 'Logging' is.
Logging doesn't run in my version of Inventor.
I would like to know how I can use MessageBox.Show() to see any nonString value.
Can you show me how to do that?
@NachoShaw
Since your rule was easier to follow, I tried fixing the error in yours.
I thought that if I could figure out what was wrong in the simpler code, I could do it in the more complex code.
So I added "Footing" and "Post" to the Case list, and ran it, but it didn't work for them either.
It only worked for the Decking like originally.
I thought that maybe the problem was the FG parts.
But since the Footing is a non-FG part, and since it didn't work on the Footing, I concluded it's something else that isn't working. But I can't figure out what it is b/c I don't know what to look for. It's a gigantic SECRET buried somewhere on the Internet, or in a book, or in some expert's mind. But I do think it has to do with the way iLogic identifies the part files in the assembly and then how it turns around and uses that name to process them. So I tried changing the code to get iLogic to see the filename instead of the part name listed in the model tree. But I'm guessing on exactly what words to use to make that happen, which is why it isn't working for me.
After wasting 3 more hours on this, I'm stuck (as usual).
Here is why I can't figure this out:
1. I'm a LINEAR THINKER, so I need LINEAR PATHWAYS to LEARN what to do.
I put that in all caps b/c nobody in here seems to get that.
All the code developed in here is anything but linear.
2. I started out w/the Object Model poster to look for what I want to use, which in this case is FILENAME.
But FILENAME isn't in the Object Model poster. I'm guessing that it must be a PROPERTY of the object FILE. The closest thing to it is "Application>FileManager>...FILE".
But I don't know how to write code to access that.
3. What I try to do is First locate the Object I need (which is a guess most of the time) in the Object Model poster. Then I go to Inventor's VBA Object Reference app. Then I type in the Object that's in the Object Model poster, and a list of objects appears. Then I scroll down through that list and try to find something related to what's happening in the code. Most of the time I have no idea what to pick b/c there are multiple entries that may or may not be relevant, b/c I don't know how these objects work. At that point, I get stuck, almost every time. But if I DO find an object that MAY work, b/c the WORD of it seems to indicate that it will, I then press F1 to see what the Help says. Almost always it doesn't mean squat to me, so I just close that and get angry.
Right now, after WASTING another 3 hours, I'm ANGRY.
Where can I find a LINEAR PATHWAY that will STEP ME THROUGH what I want to accomplish?
Let me give you an example of what I'm talking about:
When I diagnose engine runnability issues, I first look at the bullshyt trouble codes. Unless you know how that particular vehicle's computer system works in detail, you won't have a clue where to start diagnosing BASED ON that bullshyt code. That's how it is MOST of the time. So instead, you go read about it on the internet and see if other people have the same problem. For older cars and trucks you usually find your solution, or at least a clue where to look next. But if you're like me, and you know cars and trucks and have all that info CATEGORIZED in your mind already (b/c of a lifetime of experience), you just need to do one of two things to get started: 1) go to the service manual and look up the CODE PROCEDURE and follow it (which MOST of the time is just more bullshyt), or 2) start testing circuits: components, wires and connections. I absolutely HATE that part b/c sometimes it's very difficult to access things. But either way, it's a LINEAR PROCESS from start to finish, once you locate what you need to test.
That is just like coding. You start with an idea (like a vehicle a Trouble Code or 'customer complaint') and figure out where to begin testing. The Code gives you a HINT based on the WORD (P0016, B1220, etc.). But that code doesn't tell you what it means and what's connected to that system. You MUST pay for that SECRET information to know that. So if you don't have the wiring schematics, you're f*cked most of the time. And if you don't know the BASICS, you're wasting your time trying (like with me and VB). But fixing a vehicle is really only a 2 step process: DIAGNOSE and TEST. Same w/coding. The only difference is, I possess the TOOLS to do the troubleshooting and testing on vehicles. But w/Inventor, I STILL don't know which tools to use OR how to use them. And IF I needed a LINEAR PATHWAY, I can't find it w/Inventor. Sometimes (like with Honda and Ford) the linear pathway is the easiest method of troubleshooting. Just get the book, look up the Code, and follow the steps. MOST other cars and trucks are a clusterf*ck of bullshyt computer gobledygook, and their linear troubleshooting pathway isn't effective most of the time. So most times I resort to the DVM and a lab scope. But w/iLogic and VB I have NO IDEA what to use to get to where I need to get. It's a GIGANTIC CLUSTERF*CK of DISORGANIZED and SCATTERED information designed to be used by those 'in the know'. Like I've said many times in the past, this is no different from trying to navigate the court systems of government. If you aren't a trained lawyer, with a paralegal and a bunch of other 'connections', then good luck. You'll get your one bite at the apple, but don't be surprised if it's full of worms and pesticides that'll kill you. And even if you manage to make a good showing in the courts like Clif High did recently, you hardly stand a chance against big money or government, b/c the system is RIGGED against you for them to always win.
When I attempt to learn how to code, that is what comes to mind at my points of failure and frustration. I know I'm right. Incidentally, my previous rant above about VISUAL PROGRAMMING like in RHINO3D, I discovered from a friend at Berkley that the visual programming language has been around since the mid 80's. All the more reason to shyt on Auodesk for saddling us w/this this unmanageable burden and POS they call their MACRO LANGUAGE.
Incidentally, here's a screen shot of the error I get on from macros:

Oh yes, and I tried converting the Inventor iLogic macro into Inventor VBA, but got stuck at 'Parameter' b/c it said it "Compile error: Sub or function not defined". I figured that maybe I could see more of what's going on in the VBA editor, even though I still don't understand most of what I'm looking at or now to use that tool (even though I studied on it for many hours). So I tried figuring out what to change but couldn't, b/c I don't know what I'm doing. AND, as always, I have NO IDEA where to look for the answer. The amount of hunting I do on the internet and in other resources just to find ONE G.D. SOLUTION among the MYRIAD of G.D. PROBLEMS in coding makes this learning process TORTURE. Here's my attempt at converting Inventor iLogic to VBA:
' This rule calculates the total weight of the entire assembly
' Here is my (NachitoMax) version using a select case on the Category iProperty per document (oRefDoc)
Sub Main()
'set up the active assembly document
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
'set up the enumerator to loop through the assembly
Dim oRefDocs As DocumentsEnumerator
Set oRefDocs = oDoc.AllReferencedDocuments
'loop through the references (not occurrences so that you only change 1 of each file)
Dim oRefDoc As Document
For Each oRefDoc In oRefDocs
'get the Category iProperty to use as the condition
Select Case iProperties.Value(oRefDoc.DisplayName, "Summary", "Category")
Case "Footing"
Dim oVol As Double
Set oVol = Parameter(oRefDoc.DisplayName, "Volume")
Dim oCost As Double
Set oCost = Price_per_cf_concrete_HD * (oVol / 12 ^ 3)
If Not oCost = 0 Then iProperties.Value(oRefDoc.DisplayName, "Project", "Estimated Cost") = oCost
Case "Post"
Dim oG_L As Double
Set oG_L = Parameter(oRefDoc.DisplayName, "G_L")
Dim oCost As Double
Set oCost = Price_per_ft_4x4_post_HD * (oG_L / 12)
If Not oCost = 0 Then iProperties.Value(oRefDoc.DisplayName, "Project", "Estimated Cost") = oCost
Case "Joist"
Dim oG_L As Double
Set oG_L = Parameter(oRefDoc.DisplayName, "G_L")
Dim oCost As Double
Set oCost = Price_per_ft_2x6_board_HD * (oG_L / 12)
If Not oCost = 0 Then iProperties.Value(oRefDoc.DisplayName, "Project", "Estimated Cost") = oCost
Case "Decking"
Dim oLength As Double
Set oLength = Parameter(oRefDoc.DisplayName, "SheetMetalLength")
Dim oWidth As Double
Set oWidth = Parameter(oRefDoc.DisplayName, "SheetMetalWidth")
Dim oArea As Double
Set oArea = oLength * oWidth
Dim oCost As Double
Set oCost = Price_per_sq_in_4x8_HD * oArea
If Not oCost = 0 Then iProperties.Value(oRefDoc.DisplayName, "Project", "Estimated Cost") = oCost
End Select
Next
End Sub
Incidentally, I got one of my degrees in TEACHING, and can honestly say that this is not how people should learn. FAR FROM IT!
... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator