AnsweredAssumed Answered

check if folder exists feature manager tree

Question asked by Jonathan Hoffman on Apr 29, 2020
Latest reply on Apr 29, 2020 by Anthony Kanov

Hi,

 

I am working on a macro to put any purchased parts in an assembly into folders sorted by vendor, and I can't figure out a robust way to find out if a folder of a given name exists in the feature manager tree, then either add a component to it or create the folder then add component. 

 

I worked out how to walk through each component and determine which parts I want to put in folders, and I've generated the names for the folders, but I can't figure out how to generate the folders while ensuring that I don't create any duplicated. insertfeaturetreefolder2 needs to know if the folder to already exist, and I haven't been able to find a good way to check if it does.

 

I attached what I have to give you an idea of what I'm doing, which is basically just a code to traverse each component (I grabbed it from another code, so it may not be perfectly efficient, but it does the job), then the logic to find the vendor folder.  If anyone knows a good way to create a folder in the top level of the feature manager tree if and only if a folder of that name does not exist, I'd really appreciate the help.

Outcomes