4 Replies Latest reply on Apr 17, 2014 12:14 AM by Oleg Bezyaev

    Through hole

    Oleg Bezyaev

      Is there a possibility to know if the hole is throught or not, if I have only ICurve. Feature is not compulsory to be cut throught all.

        • Re: Through hole
          Amirtharaj Vk

          Hi Oleg:

           

          You can get feature definition. From feature definition you can retreiw the end condition of the feature. If end condition is of cut/hole is through all, you can consider it as through hole. Following is an sample code.

          ----------------------------------------------------

          Dim swApp As SldWorks.SldWorks
          Dim swmodel As SldWorks.ModelDoc2
          Dim swsel As SldWorks.SelectionMgr
          Dim swfeat As SldWorks.Feature
          Dim fdata As SldWorks.ExtrudeFeatureData2
          Dim hdata As SldWorks.WizardHoleFeatureData2
          Dim bret As Boolean

          Sub main()

          Set swApp = Application.SldWorks
          Set swmodel = swApp.ActiveDoc
          Set swsel = swmodel.SelectionManager
          Set swfeat = swsel.GetSelectedObject5(1)
          If LCase(swfeat.GetTypeName2) = "cut" Then
              Set fdata = swfeat.GetDefinition
              If fdata.GetEndCondition(True) = 1 Then
                  MsgBox "It is a Through Hole!!"
              Else
                  MsgBox "It is not a Through Hole!!"
              End If
          Else
              Set hdata = swfeat.GetDefinition
              If hdata.EndCondition = 1 Then
                  MsgBox "It is a Through Hole!!"
              Else
                  MsgBox "It is not a Through Hole!!"
              End If
          End If

          End Sub

          ----------------------------------------------------

           

          V K Amirtharaj

          EGS Computers India Pvt Ltd

          http://www.egsindia.com

          http://www.egs.co.in