is it possible to get nummer of holes with treads and Size maybe with ilogic

is it possible to get nummer of holes with treads and Size maybe with ilogic

Darkforce_the_ilogic_guy
Advisor Advisor
293 Views
2 Replies
Message 1 of 3

is it possible to get nummer of holes with treads and Size maybe with ilogic

Darkforce_the_ilogic_guy
Advisor
Advisor

is it possible to get nummer of holes with treads and Size maybe with ilogic

 

Get a output something like this So I could get a list of bolt size without having to need them and save the power on the Computer.

 

8 qty   M6x0.8

10 qty M6x1 

30 qty M12x2

 

0 Likes
294 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @Darkforce_the_ilogic_guy.  I have something that you may be able to use for your task.  I customized it to report the findings similarly to how you have it formatted in your initial post.  Since I do not know if you are working with a part or an assembly, I left it as it was, for working on a part.  It will look at all of the HoleFeatures in the part, and if they are threaded, it will capture their thread designation, and the count of each one with the same thread designation.  It then does the same with ThreadFeatures, but I customized it to only look at internal threaded ThreadFeatures.  Let me know if this will work OK for your needs.

Sub Main
	Dim oPDoc As PartDocument = ThisDoc.Document
	Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
	Dim oHoleFeats As HoleFeatures = oPDef.Features.HoleFeatures
	Dim oThreadFeats As ThreadFeatures = oPDef.Features.ThreadFeatures
	Dim oDict As New Dictionary(Of String, Integer)
	If oHoleFeats.Count = 0 Then GoTo CheckThreadFeats
	For Each oHF As HoleFeature In oHoleFeats
		If Not oHF.Tapped Then Continue For
		Dim oHTI As HoleTapInfo = oHF.TapInfo
		Dim sTD As String = oHTI.ThreadDesignation
		If oDict.Keys.Contains(sTD) Then
			oDict.Item(sTD) = oDict.Item(sTD) + 1
		Else
			oDict.Add(sTD, 1)
		End If
	Next
	CheckThreadFeats :
	If oThreadFeats.Count = 0 Then GoTo FinalReport
	For Each oTF As ThreadFeature In oThreadFeats
		If Not oTF.ThreadInfo.Internal Then Continue For
		Dim sTD As String = oTF.ThreadInfo.ThreadDesignation
		If oDict.Keys.Contains(sTD) Then
			oDict.Item(sTD) = oDict.Item(sTD) + 1
		Else
			oDict.Add(sTD, 1)
		End If
	Next
	FinalReport :
	If oDict.Count = 0 Then
		MsgBox("No Threaded Holes found.", , "")
	Else
		Dim oReport As String = ""
		For Each oEntry In oDict
			oReport = oReport & vbCrLf & oEntry.Value & " qty " & oEntry.Key
		Next
		MsgBox(oReport, vbInformation, "")
	End If
End Sub

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

Darkforce_the_ilogic_guy
Advisor
Advisor

I would like to get it to work on a complete assembly... as a way to find out how many bolt is needed without happing to add them to the 3d model... ofcause it somehow was possible to find the lenght that would be need it would be better.. but so far have no idear how that would be possible:).. but baby step

0 Likes