2 Replies Latest reply on Mar 28, 2017 2:08 AM by Norbert Gal

    BOM GetComponents - why more objects?

    Norbert Gal



      I try to write a code based upon SWX Help article:
      2017 SOLIDWORKS API Help - Get Components in Each BOM Table Row Example (VB.NET)


      The interesting part for me is in the end of the ProcessTableAnn sub.

      UBound(vPtArr) is gives equal value as the quantity of the component's  of the row.

      But looping trough the vPtArr object, there is no differences of the elements: vPtArr(0) = vPtArr(1) =... vPtArr(n)

      Why get back GetComponents2 function multiple elements for each row, what equals?

      There is some cases when the elements of the vPtArr object are differents?


      vPtArr = swBOMTableAnn.GetComponents2(J, ConfigName)

                  If (Not vPtArr Is Nothing) Then

                      For I = 0 To UBound(vPtArr)

                          pt = vPtArr(I)

                          swComp = pt

                          If Not swComp Is Nothing Then

                              Debug.Print("           Component Name: " & swComp.Name2)

                              Debug.Print("           Configuration Name: " & swComp.ReferencedConfiguration)

                              Debug.Print("           Component Path: " & swComp.GetPathName)


                              Debug.Print("  Could not get component.")

                          End If


                  End If