You can try something like this:
Dim doc As PartDocument = ThisDoc.Document
Dim features = doc.ComponentDefinition.Features
Dim f As New Dictionary(Of String, List(Of String))
For Each feature As HoleFeature In features.HoleFeatures
If (Feature.HoleType <> HoleTypeEnum.kDrilledHole) Then Continue For
Dim info = Feature.TapInfo
Dim threadType As String
If (TypeOf info Is HoleTapInfo) Then
Dim tapInfo As HoleTapInfo = info
threadType = tapInfo.ThreadType
End If
If (TypeOf info Is TaperedThreadInfo) Then
Dim tapInfo As TaperedThreadInfo = info
threadType = tapInfo.ThreadType
End If
If (f.ContainsKey(threadType)) Then
f.Item(threadType).Add(Feature.Name)
Else
Dim names As New List(Of String)
names.Add(Feature.Name)
f.Add(threadType, names)
End If
Next
Dim msg = String.Empty
For Each kv As KeyValuePair(Of String, List(Of String)) In f
msg += $"{kv.Key}: {String.Join(", ", kv.Value)}" + System.Environment.NewLine
Next
MsgBox(msg)
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.

Blog: hjalte.nl - github.com