AnsweredAssumed Answered

Why can only delete a General Table

Question asked by Yong Ning on May 10, 2014
Latest reply on Jun 3, 2016 by Yong Ning

SwSubFeat.Select False

editdelete → can be delete One General table

0.jpg

 

SwSubFeat.Select True

editdelete  →  don't delete the General table

 

1.jpg

 

Select many Feature of GeneralTableFeature, but don't delete General table.

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

follow code

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

Sub main()

 

    Dim SwApp                                   As SldWorks.SldWorks

    Dim SwModel                                 As SldWorks.ModelDoc2

    Dim SwFeat                                  As SldWorks.Feature

    Dim SwSubFeat                               As SldWorks.Feature

    Dim sFeatType                               As String

    Set SwApp = Application.SldWorks

    Set SwModel = SwApp.ActiveDoc

    'Debug.Print "File = " & SwModel.GetPathName

    Set SwFeat = SwModel.FirstFeature

    Do While Not SwFeat Is Nothing

        'Debug.Print SwFeat.Name, SwFeat.GetTypeName

        Set SwSubFeat = SwFeat.GetFirstSubFeature

        Do While Not SwSubFeat Is Nothing

            'Debug.Print SwSubFeat.Name, SwSubFeat.GetTypeName

            If SwSubFeat.GetTypeName = "GeneralTableFeature" Then

               Debug.Print SwSubFeat.Name

               SwSubFeat.Select False

               SwModel.EditDelete

            End If

            Set SwSubFeat = SwSubFeat.GetNextSubFeature

        Loop

        Set SwFeat = SwFeat.GetNextFeature

    Loop

End Sub

'-----------------------------------------------

 

Hope , Select Many General Table → delete many general table

Thanks

Attachments

Outcomes