Find BOMRow Parent Row object

Find BOMRow Parent Row object

Raider_71
Collaborator Collaborator
753 Views
1 Reply
Message 1 of 2

Find BOMRow Parent Row object

Raider_71
Collaborator
Collaborator

Hi guys,

 

Am I missing something here? I need to check and then initiate the parent BOM row from the current one. So basically I need to iterate upward through the tree up to the root BOM node.

 

This is what I have done (which does not work)

    Function GetBOMTreeTotalQTY(oRow As Inventor.BOMRow, intQTY As Integer) As Integer
        Dim oParentRow As Inventor.BOMRow

        If oRow.Parent IsNot Nothing Then
            oParentRow = oRow.Parent()   <== This is where it fails
            GetBOMTreeTotalQTY(oParentRow, oParentRow.ItemQuantity * intQTY)
        End If

        Return intQTY

    End Function

Can someone please tell me how to grab the parent BOM row. The help doc says the "parent" property is to find the BOMView OR BOMRow object so I am not sure.

 

Any help would be appreciated.

 

Cheers

 

0 Likes
Accepted solutions (1)
754 Views
1 Reply
Reply (1)
Message 2 of 2

MechMachineMan
Advisor
Advisor
Accepted solution

Hi.

 

As oParentRow is strongly typed, it will fail every time you run the code on a top BOMRow item as that would be trying to assign a BOMView to an object of type BOMRow.

 

Implement a check to see what type the .Parent is before assigning it to a strongly typed variable, or implement some error catching to handle such an issue.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type