Reading each columns of BomRow with VB.NET?

Reading each columns of BomRow with VB.NET?

mucip
Collaborator Collaborator
576 Views
10 Replies
Message 1 of 11

Reading each columns of BomRow with VB.NET?

mucip
Collaborator
Collaborator

Hi,

I have assembly file and try to reading BomTable with structured ad first level options.

By the way I want to use custom BomTableFormat with below code:

 

 

oBOM.ImportBOMCustomization("C:\EXAMPLE\StansardIAM.xml")

 

 

I can read BomRow but I can not get the cell (column) of the each row. Because I need the information cell by cell from custom BOM format.

 

My Code is:

 

 Dim activeDoc As Document = inv_App.ActiveDocument

        ' Cast the active document as an assembly document
        Dim assemblyDoc As AssemblyDocument = DirectCast(activeDoc, AssemblyDocument)

        ' Get the Bill of Materials
        Dim bom As BOM = assemblyDoc.ComponentDefinition.BOM

        'İhtiyaç duyulan bilgiler eklenmiş hali...
        bom.ImportBOMCustomization(baslangicKlasor & "\StructuredBOM.xml")

        bom.StructuredViewFirstLevelOnly = True

        ' Make sure that the structured view is enabled.
        bom.StructuredViewEnabled = True


        Dim bomView As BOMView = bom.BOMViews.Item("Structured")

        If bomView Is Nothing Then
            MessageBox.Show("The 'Structured' BOM view is not available.", "Error")
            'hataliGiris = True
            Exit Sub
        End If

        'Tabloyu okuyor.
        For Each row As BOMRow In bomView.BOMRows              
            Console.WriteLine(row.ItemNumber & " --- " & row.ItemQuantity)
        Next

 

 

By the way I want to read BomTable from IAM file not IDW.

 

Regards,

Mucip:)

0 Likes
Accepted solutions (1)
577 Views
10 Replies
Replies (10)
Message 2 of 11

marcin_otręba
Advisor
Advisor

Hi,

 

you can read xml to get columns directly from it, the same you can create invisible drawing and place partlist and read columns.

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 3 of 11

mucip
Collaborator
Collaborator

Hi,

Yes I can Export BOM List to csv file and parse it. But It must be easier way I guess? Because I can reach bom list already and I should reach to each cell of the row.

 

Regards,

Mucip:)

0 Likes
Message 4 of 11

marcin_otręba
Advisor
Advisor
Accepted solution

nope, there is no way to access columns in bom directly.

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

Message 5 of 11

Michael.Navara
Advisor
Advisor

Hi @mucip 

As @marcin_otręba mentioned above, it is not possible to access BomRow cells. But BomRow provides some information such as quantity, item number, etc. Rest of information you need to extract from associated ComponentDefinitions of the BomRow.

Message 6 of 11

mucip
Collaborator
Collaborator

Hi,

Well, I need to parse bom output csv file than.🤔

Thanks...

 

Regards,

Mucip:)

0 Likes
Message 7 of 11

mslosar
Advisor
Advisor

You can also access the parts/assemblies from the BOMRow as well and pull the data from their parameters/iproperties.

0 Likes
Message 8 of 11

mucip
Collaborator
Collaborator

Hi,
Can you give any sample code or website please?

 

Regards,

Mucip:)

0 Likes
Message 9 of 11

mucip
Collaborator
Collaborator

Hi,

By the way when I use Structured BOM and try to read BomRow I can see only the main branch.

mucip_0-1734867040516.png

 

 

How can I open all rows and read them?

 

Regards,

Mucip:)

0 Likes
Message 10 of 11

marcin_otręba
Advisor
Advisor

use .childrows, for complete code see this:

 

Solved: How to read item number as per structured view - Autodesk Community

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 11 of 11

mucip
Collaborator
Collaborator

Hi,

I export the structured list as csv file. I don't know why, Exported csv file has full list. Then I read this csv file row by row very easily.

 

It's very strange behaviour. It looks only first branch but it exports all branch?

 

Anyway, I solved  by using csv file now.

 

Regards,

Mucip:)

0 Likes