0 Replies Latest reply on Aug 1, 2015 8:44 AM by Yong Ning

    How to use the ReorderFeature with API?

    Yong Ning

      0.jpg

       

       

      follow code is false

      e.g. SwModel.ReorderFeature SwFeatArr(1).Name, SwFeatArr(0).Name

       

      code is

       

      Private Sub ll1()

         Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

            Set SwApp = Application.SldWorks

            Set SwModel = SwApp.ActiveDoc

         Dim SwFeat As Feature, SwFeatArr(1) As Feature

            Set SwFeat = SwModel.FirstFeature

            nn = 0

            Do While Not SwFeat Is Nothing

               If SwFeat.GetTypeName = "DrSheet" Then

                   Debug.Print SwFeat.Name, SwFeat.GetTypeName

                   Set SwFeatArr(nn) = SwFeat

                   nn = nn + 1

               End If

               Set SwFeat = SwFeat.GetNextFeature

            Loop

            Stop

           

            SwModel.ReorderFeature SwFeatArr(1).Name, SwFeatArr(0).Name

            Stop

      End Sub