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

you can try this:

Dim doc As PartDocument = ThisDoc.Document
Dim def As SheetMetalComponentDefinition = doc.ComponentDefinition

If (def.HasFlatPattern) Then
    def.FlatPattern.Edit()
Else
    def.Unfold()
End If

Dim flat As FlatPattern = def.FlatPattern
Dim sketch As PlanarSketch = flat.Sketches.Add(flat.TopFace, True)

sketch.Profiles.AddForSolid()


Dim profile As Profile = sketch.Profiles.Item(1)
MsgBox("Number of bends: " & def.Bends.Count & System.Environment.NewLine &
       "Number of profiles (that includes outerprofile): " & profile.Count & System.Environment.NewLine &
       "Number of breakthroughs: " & profile.Count - 1)

'you don't need this part but might be good to know that it Is possible
'For Each path As ProfilePath In profile
'    Dim addMaterial = Path.AddsMaterial
'    For Each ent As ProfileEntity In Path
'        ' in the ProfileEntities you can find the 
'        ' Information to calulate the perimeter of the 
'        ' breakthroughs and the outer perimeter
'    Next
'Next
sketch.Delete()
flat.ExitEdit()

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com