1 Reply Latest reply on Jan 23, 2015 5:04 AM by Yong Ning

    Change Hole Wizard Hole Diameter

    Sam King

      Does anyone know of a way to find a certain hole wizard hole, then change the diameter of that hole?


      I read that you can use AccessSelections, ChangeStandard, and Modify Definition but I cannot get these functions to actually do anything.


      In the code I'm trying to change the diameter of a dowel hole (Fastener TYpe: 703)


      So far I've been able to search through the part and select the dowel hole I want.  But that is as far as I got



      Here is what I have so far


      Option Explicit


      Sub ChaneHoleSize()


          Dim swApp As SldWorks.SldWorks

          Dim swModel As SldWorks.ModelDoc2
          Dim NewFeatureData As SldWorks.WizardHoleFeatureData2

          Dim Feature As SldWorks.Feature
          Dim FeatureCount As Long
          Dim FeatureType As String
          Dim NewFeature As SldWorks.Feature

          Dim NewFeatureType As String
          Dim NewFeatureName As String

          Dim swComponent As SldWorks.Component2
          Dim swPart As SldWorks.PartDoc
          Dim i As Integer
          Dim FastenerType As Long
          Dim HoleFeature As Long

          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          Set swPart = swModel
          Set Feature = swPart.FirstFeature
          FeatureType = Feature.GetTypeName2
          FeatureCount = swModel.GetFeatureCount
          HoleFeature = 0

          For i = 0 To FeatureCount - 2
              Set NewFeature = Feature.GetNextFeature
              NewFeatureType = NewFeature.GetTypeName2

              If NewFeatureType = "HoleWzd" Then
                      Set NewFeatureData = NewFeature.GetDefinition
                          FastenerType = NewFeatureData.FastenerType2
                          If FastenerType = 703 Then
                          End If

              End If
              Set Feature = NewFeature
             Next i

      End Sub