Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
in reply to: Vladimir.Ananyev

Hello Vladimir.

 

This is nice but actually not what i am locking for?

 

your code will not work when we have cosmetic bendlines in the model.?

 

here is my code so fare.

 

I want to be able to get the bend order number attached to each bendline in the model.

 

this will give us the rigth bend count. see attached model, picture and code.

 

The bend count on the attached model will be 9, this is wrong.

 

But the highest bend order number in the flatpattern is 7, this is right

 

I want to read out the highest bend order number "7".

 

please help.

 

regards kent boettger

 

        Dim m_invapp As Inventor.Application = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")

        ' Set a reference to the sheet metal document.
        ' This assumes a part document is active.

        Dim oPartDoc As PartDocument

        oPartDoc = m_invapp.ActiveDocument

        ' Make sure the document is a sheet metal document.

        If oPartDoc.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then

            MsgBox("A sheet metal document must be open.")

            Exit Sub

        End If

        Dim oSheetMetalCompDef As SheetMetalComponentDefinition

        oSheetMetalCompDef = oPartDoc.ComponentDefinition

        If (Not oSheetMetalCompDef.HasFlatPattern) = True Then

            oSheetMetalCompDef.Unfold()

        End If

        Dim oFlatPattern As FlatPattern

        oFlatPattern = oSheetMetalCompDef.FlatPattern

        Dim oBendResults As FlatBendResults = oFlatPattern.FlatBendResults

        MsgBox("Bendlines = " & oBendResults.Count / 2)

        Dim oTotalBends As Integer = oBendResults.Count / 2

        Dim oBendresult As FlatBendResult

        For Each oBendresult In oBendResults

            ' Here i want to get the bend order number attached to the bendline?
            ' but i dont know how to do this.

            Dim oBendordernumber As Integer = oBendresult.GetBendOrder()

        Next