Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to read item number as per structured view

21 REPLIES 21
SOLVED
Reply
Message 1 of 22
abilabib
2162 Views, 21 Replies

How to read item number as per structured view

I'm try for read item number like a picture below and wanna get the data structure as per Structured View.

But I can't. Because the program read the ItemNumber as per Model data or Hierarchy in object history. 

I wanna the data like this:

1
1.1
1.2
1.3
1.4
1.5
2
2.1
2.2
2.3
3
3.1
3.2
4
5
6

 

But I get actual data like this :

1
1.1
1.2
1.3
1.4
1.5
4
2
2.1
2.2
2.3
5
6
3
3.1
3.2

Here's the code :

 

Sub ListBomItems()
        Dim asm As AssemblyDocument
        asm = invApp.ActiveDocument

        Dim b As BOM
        b = asm.ComponentDefinition.BOM

        b.StructuredViewEnabled = True

        Dim bv As BOMView
        bv = b.BOMViews("Structured")

        Call ListItems(bv.BOMRows, 0)
    End Sub

    Sub ListItems(rows As BOMRowsEnumerator, indent As Integer)
        Dim row As BOMRow
        For Each row In rows
            Debug.Print(row.ItemNumber.ToString)
            If Not row.ChildRows Is Nothing Then
                Call ListItems(row.ChildRows, indent + 2)
            End If
        Next
    End Sub

Is there way for rearrange data structure in Model Data / Hierarchy model ?

 

 

 

BOM Structured.jpg

21 REPLIES 21
Message 21 of 22
chandra.shekar.g
in reply to: abilabib

@abilabib,

 

 

It is nice to hear that your program is completed successfully 🙂

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 22 of 22
tonythm
in reply to: abilabib

Hello @abilabib @chandra.shekar.g 

 

Can you share with me the vba code completed?

I need it to refer to the Structure - first level.

I am using excel to assign renumber according to itemnumber in bomrow. If you know please help me.

 

Thank you.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report