AnsweredAssumed Answered

How to create a folder inside an assembly using API?

Question asked by Marco Wu on Jun 15, 2017
Latest reply on Jun 17, 2017 by Peter Brinkhuis

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")