@이슬이
Here's an example of one possible variation of my other suggestion:
If the hole is a clearance hole, it uses the fastener size in the name of the hole feature.
If the hole is threaded, it uses the nominal size in the name of the hole feature.
If neither of the above checks were true, it does something similar to my first suggestion, but goes one step further to eliminate the trailing info after the hole diameter in the extended name info.
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oHoles As HoleFeatures = oPDef.Features.HoleFeatures
Dim oSimple As Boolean = True
Dim oHCI As HoleClearanceInfo
Dim oHTI As HoleTapInfo
Dim oExtName As String 'Extended Name
For i As Integer = 1 To oHoles.Count
If oHoles(i).IsClearanceHole Then
oHCI = oHoles(i).ClearanceInfo
MsgBox("Fastener Size = " & oHCI.FastenerSize)
oHoles(i).Name = oHCI.FastenerSize & " :" & i
oSimple = False
ElseIf oHoles(i).Tapped Then
oHTI = oHoles(i).TapInfo
MsgBox("Nominal Size = " & oHTI.NominalSize)
oHoles(i).Name = oHTI.NominalSize & " :" & i
oSimple = False
End If
If oSimple = True Then
oExtName = Mid(oHoles(i).ExtendedName, 2, Len(oHoles(i).ExtendedName) -2)
oHoles(i).Name = Split(oExtName," ")(0) & " :" & i
End If
Next
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE" 👍.
Also, when you have time, please review & vote for these 'Ideas' I'd like to get implemented.
- Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
- Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
- Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
- Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
- Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
- SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here
- Create DocumentSubTypeEnum Click Here
- Add kRevisionTag or kDrawingRevisionTag to ObjectTypeEnum Click Here
Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield

(Not an Autodesk Employee)