5 Replies Latest reply on Aug 10, 2017 8:38 AM by Cad Admin

    InsertFeatureTreeFolder2 Usage Question (VBA)

    Cad Admin

      I need to create a "Facilities" folder in an assembly model.  I want the folder to be always above the "mates" folder when created...  Ive done this before creating a folder above or below a selected part, but i get nothing wile selecting "mates" feature...


      Dim swApp As Object


      Dim Part As Object

      Dim boolstatus As Boolean

      Dim longstatus As Long, longwarnings As Long


      Sub main()


      Set swApp = Application.SldWorks


      Set Part = swApp.ActiveDoc

      boolstatus = Part.Extension.SelectByID2("Mates", "MATEGROUPS", 0, 0, 0, False, 0, Nothing, 0)

      Dim myFeature As Object

      Set myFeature = Part.FeatureManager.InsertFeatureTreeFolder2(swFeatureTreeFolderType_e.swFeatureTreeFolder_EmptyBefore)

      boolstatus = Part.SelectedFeatureProperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "Facilities")

      End Sub