5 Replies Latest reply on Dec 29, 2015 8:57 AM by Divyanshu Bhardwaj

    How to select swWzdHoleTypes_e value

    Yong Ning

      follow code.

      How to  select  the "swWzdHoleTypes_e" value→

       

      SwFeatData.Type = swTapThruCounterSinkBottom

      → SwFeatData = ?????

       

      for example

       

      Specifies values for wizard hole type values.

      Legacy Hole Types

      swSimple

      swTapered

      swCounterBored

      swCounterSunk

       

      *************************

       

       

      0.jpg

       

       

       

      Private Sub ll2()

         Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

            Set SwApp = Application.SldWorks

            Set SwModel = SwApp.ActiveDoc

         Dim SwSelMgr As SelectionMgr

            Set SwSelMgr = SwModel.SelectionManager

         Dim Feature As SldWorks.Feature

         Dim SwFeatData As SldWorks.WizardHoleFeatureData2

             ' Here Write code for selecting the feature

             Set Feature = SwSelMgr.GetSelectedObject5(1)

             Set SwFeatData = Feature.GetDefinition

             ''

             With SwFeatData         

                 Debug.Print .Standard, .Type

                 SwModel.ForceRebuild3 True

             End With

      End Sub

        • Re: How to select swWzdHoleTypes_e value
          Amen Allah Jlili

          Can you rephrase your question please (use more words and less symbols)?

            • Re: How to select swWzdHoleTypes_e value
              Yong Ning

              I can read English, but written in English is not very good.

               

              ********************************************

               

              Hole type of the hole wizard feature as defined in swWzdHoleTypes_e. There are many options→ more than 60 options.

               

               

              For example

               

              swWzdHoleTypes_e

              Specifies values for wizard hole type values.

              Legacy Hole Types

              swSimple

              swTapered

              swCounterBored

              swCounterSunk

              swCounterDrilled

              swSimpleDrilled

              swTaperedDrilled

              swCounterBoredDrilled

              swCounterSunkDrilled

              swCounterDrilledDrilled

              Counterbore Hole Types

              swCounterBoreBlind

              swCounterBoreBlindCounterSinkMiddle

              swCounterBoreBlindCounterSinkTop

              swCounterBoreBlindCounterSinkTopmiddle

              swCounterBoreThru

              swCounterBoreThruCounterSinkBottom

              swCounterBoreThruCounterSinkMiddle

              swCounterBoreThruCounterSinkMiddleBottom

              swCounterBoreThruCounterSinkTop

              swCounterBoreThruCounterSinkTopBottom

              swCounterBoreThruCounterSinkTopMiddle

              swCounterBoreThruCounterSinkTopMiddleBottom

              Simple and Countersink Hole Types

              swHoleBlind

              swHoleBlindCounterSinkTop

              swCounterSinkBlind

              swHoleThru

              swHoleThruCounterSinkBottom

              swHoleThruCounterSinkTop

              swHoleThruCounterSinkTopBottom

              swCounterSinkThru

              swCounterSinkThruCounterSinkBottom

              Tapped Hole Types

              swTapBlind

              swTapBlindCounterSinkTop

              swTapThru

              swTapThruCounterSinkBottom

              swTapThruCounterSinkTop

              swTapThruCounterSinkTopBottom

              Pipe Tapped Hole Types

              swPipeTapBlind

              swPipeTapBlindCounterSinkTop

              swPipeTapThru

              swPipeTapThruCounterSinkBottom

              swPipeTapThruCounterSinkTop

              swPipeTapThruCounterSinkTopBottom

               

              Countersink Without Head Clearance Hole Types

              swCounterSinkBlindWithoutHeadClearance

              swCounterSinkThruWithoutHeadClearance

              swCounterSinkThruCounterSinkBottomWithoutHeadClearance

               

              Cosmetic Thread Tapped Hole Types

              swTapBlindCosmeticThread

              swTapBlindCosmeticThreadCounterSinkTop

              swTapThruCosmeticThreadCounterSinkBottom

              swTapThruCosmeticThreadCounterSinkTopBottom

              Tapped Thru Thread Hole Types

              swTapThruThredThru

              swTapThruThreadThruCounterSinkTop

              swTapThruThreadThruCounterSinkBottom

              swTapThruThreadThruCounterSinkTopBottom

            • Re: How to select swWzdHoleTypes_e value
              Divyanshu Bhardwaj

              Try to be specific while stating a problem. As far as i can understand what you're looking for, i'd suggest to use either SelectByID2 method if you manually want to select it or use FastnerType2 in IWizardHoleFeatureData2 to get type of fastner as:

              Dim instance As IWizardHoleFeatureData2 
              Dim value As System.Integer  
              instance.FastenerType2 = value  
              value = instance.FastenerType2
                • Re: How to select swWzdHoleTypes_e value
                  Yong Ning

                  0.jpg

                  Private Sub ll2()

                     Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

                        Set SwApp = Application.SldWorks

                        Set SwModel = SwApp.ActiveDoc

                     Dim SwSelMgr As SelectionMgr

                        Set SwSelMgr = SwModel.SelectionManager

                     Dim Feature As SldWorks.Feature

                     Dim SwFeatData As SldWorks.WizardHoleFeatureData2

                         ' Here Write code for selecting the feature

                         Set Feature = SwSelMgr.GetSelectedObject5(1)

                         Set SwFeatData = Feature.GetDefinition

                         ''

                         With SwFeatData

                             Debug.Print .FastenerType, .FastenerType2

                             .FastenerType2 = 146

                             SwModel.ForceRebuild3 True

                         End With

                  End Sub

                    • Re: How to select swWzdHoleTypes_e value
                      Divyanshu Bhardwaj

                      I don't know what you're looking for, try this:

                           'Part of code for selecting all the features, you can filter as per name or type

                           Dim swFeat As SldWorks.Feature

                           Dim feat_count As Integer                           

                           feat_count = swModel.GetFeatureCount()

                           Dim swFeatMgr As SldWorks.FeatureManager   

                           Set swFeatMgr = swModel.FeatureManager         

                           Dim feat_array As Variant                                                 

                           feat_array = swFeatMgr.GetFeatures(False)                          

                           Dim i As Integer

                           Dim Bool As Boolean

                           For i = 0 To UBound(feat_array) - 1

                               Set swFeat = feat_array(i)

                               Bool = swFeat.Select2(True, 0)

                           Next i