3 Replies Latest reply on Jun 17, 2017 7:55 AM by Peter Brinkhuis

    How to create a folder inside an assembly using API?

    Marco Wu

      I visited the SW API site and copied part of the code. To what I know, this should create a folder called "folder 1". However, it does not create any folder in the assembly

       

          Dim swApp1 As SldWorks.SldWorks

          Dim swModel1 As SldWorks.modelDoc2

          Set swApp1 = Application.SldWorks

          Set swModel1 = swApp1.ActiveDoc

          Set modelDoc2 = swApp1.ActiveDoc

          Set assemblyDoc = modelDoc2

          Set featureMgr = modelDoc2.FeatureManager

          Set feature = featureMgr.InsertFeatureTreeFolder2(swFeatureTreeFolder_EmptyBefore)

          Set feature = assemblyDoc.FeatureByName("Folder1")