How to create feature folders in an empty assembly?

InsertFeatureTreeFolder2 requires that you select a folder or component before you call it. If you have not selected something, nothing happens, no error, but also no folder is created.

Is there another way to create feature folders that works on empty assemblies?

Yes, you can select the mates folder (the last feature in the empty assembly), and then use the option swFeatureTreeFolder_EmptyBefore.

Check this macro by Artem https://www.codestack.net/solidworks-api/document/features-manager/batch-create-folders/

Thanks, Deepak. I did take a look at that macro but I didn’t register that that’s what it was doing. I’ll give that a try.

It is basically selecting the last feature, which will be mates folder in the empty assembly, and then will add the folder before the mates folder.

I wonder why they don’t have a “swFeatureTreeFolder_EmptyAfter” option?

Exactly were my thoughts when I was answering yesterday o[