1 Reply Latest reply on Feb 24, 2014 6:07 PM by Chris Manger

    Weldment cutlist quantity

    Terry Raymond

      So in SW2010, GetBodyCount does not always return an accurate quantity for cutlist items.


      I finally figured out a way to get an accurate quantity!  Seems so obvious now...



          Set swFeature = g_swDoc.FirstFeature

          Do While Not swFeature Is Nothing


              'look for cutlist items, If the type of feature is "CutListFolder" then dive into its properties

              If swFeature.GetTypeName = "CutListFolder" Then

                  Set swCustPropMgr = swFeature.CustomPropertyManager

                        'BAD=>   CutListQty = swFeature.GetSpecificFeature2.GetBodyCount


                  'Get quantity.  SW2010 GetBodyCount glitches; loop thru manually to get right body count

                  CutListQty = 0

                  vBodies = swFeature.GetSpecificFeature2.GetBodies

                  If Not IsEmpty(vBodies) Then

                      For Each Body In vBodies

                          If (Not Body Is Nothing) Then CutListQty = CutListQty + 1

                      Next Body

                  End If




              End If

              Set swFeature = swFeature.GetNextFeature