Macro for tapped hole callout in hole wizard

I am looking for a macro to toggle off the thread callout within the tapped holes created with hole wizard. These always seem to get toggled back on & then when you generate the drawing there's all these incidental hole callouts from them. Really a pain to have to pick them and then delete them if there's several. This would be for those tapped holes already created & not for new ones. 

Comments 2
IH
IH 2021-06-10

I always wondered why this was stock "On" and wouldn't stay off.  I have just gotten in the habit of un-checking it when modeling a feature but it's an extra click that would be nice not to have to do.  If anyone finds a solution I'd be interested as well.

AS
AS 2021-06-10

Option Explicit

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swSelMgr As SldWorks.SelectionMgr
Dim swFeatMgr As SldWorks.FeatureManager

Dim toggleCount As Integer

Sub main()

    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    
    If Not swModel Is Nothing Then
        If swModel.GetType <> swDocumentTypes_e.swDocPART Then
            MsgBox "Please open a part."
            End
        End If
        
        Set swModelDocExt = swModel.Extension
        Set swSelMgr = swModel.SelectionManager
        Set swFeatMgr = swModel.FeatureManager
                
        TraverseFeatures
    Else
        MsgBox "Please open the model"
    End If
    
    swModel.ClearSelection2 True
    MsgBox "Total hole feature thread callouts unchecked: " & toggleCount

End Sub

Private Sub TraverseFeatures()

Dim swFeat As SldWorks.Feature
Dim swSubFeat As SldWorks.Feature

    Set swFeat = swModel.FirstFeature
    toggleCount = 0
    
    Do While Not swFeat Is Nothing
        If swFeat.GetTypeName = "HoleWzd" Then
            ToggleCosmeticThreadType swFeat
        End If
        Set swFeat = swFeat.GetNextFeature
    Loop
    
End Sub

Private Sub ToggleCosmeticThreadType(swHoleWzdFeat As SldWorks.Feature)

Dim swHoleWzdFeatData As SldWorks.WizardHoleFeatureData2
    
    Debug.Print swHoleWzdFeat.Name
    Set swHoleWzdFeatData = swHoleWzdFeat.GetDefinition

    If swHoleWzdFeatData.CosmeticThreadType = swWzdHoleCosmeticThreadTypes_e.swCosmeticThreadWithCallout Then
        swHoleWzdFeatData.CosmeticThreadType = swWzdHoleCosmeticThreadTypes_e.swCosmeticThreadWithoutCallout
        swHoleWzdFeat.ModifyDefinition swHoleWzdFeatData, swModel, Nothing
        toggleCount = toggleCount + 1
    End If
            
End Sub