API: Component is in Folder?

Feb 17, 2005 11 Replies

OK I tried the help but can't locate anything on determining if a component is in a folder or what components a folder contains. I tried to get the children of the folder but no luck.



Corey.


Cory,

If you do the API help traverse feature tree program you can see how folders are handled. There is a marker in the FMT you have to look for. Unfortunately there isn't a:

b_ret = ModelDoc.IsInFolder

By the way it seems to be my day for questions.

One of the API sessions I sat in at SWW might offer a clue - I haven't checked it out. Earl said that when traversing the stuff, you will find a folder feature at the top & bottom of the stuff in the folder. So, I think that means to you that if you get to a folder feature before you get to your part, then it's in the folder. If not, then no. Maybe??

WT

That might be what pete was getting at. The extra info is appreciated it will make the work a bit easier.

Corey

Cory,

Have a look at "Traversing Assembly at Component and Feature Levels Example (VB)" in the API help.

When you run this against an assembly with a folder called Jacks you will get:

Jacks [FtrFolder] Jack-1 [Reference] Jack-2 [Reference] Jack-3 [Reference] Jack-4 [Reference] Folder1___EndTag___ [FtrFolder]

It should be obvious where the beginning and end of the folder are. So the only way to tell is to go through the list and see what is between the tags. It would be nice if the end tag refered to the start tag like Jack__EndTag__ .

Cory,

Have a look at "Traversing Assembly at Component and Feature Levels Example (VB)" in the API help.

When you run this against an assembly with a folder called Jacks you will get:

Jacks [FtrFolder] Jack-1 [Reference] Jack-2 [Reference] Jack-3 [Reference] Jack-4 [Reference] Folder1___EndTag___ [FtrFolder]

It should be obvious where the beginning and end of the folder are. So the only way to tell is to go through the list and see what is between the tags. It would be nice if the end tag refered to the start tag like Jack__EndTag__ .

Don't forget to search the archives in this group before asking a question. This topic has been discussed ealier. You'll even find some useful code... Have a look at

formatting link
Guglielmetti -
formatting link

And guess who asked the question originally. I sort of remembered that, but I didn't remember the detailed answers that you and Heikko gave. Thanks.

Thanks guys. Sorry Philippe I normally follow most of the API threads and didn't recall that one. I guess I was being a bit lazy though it would have actually saved me a bit of time if I had been a good ngp and searched google.

Corey

I just put my finger on some interesting behavior of folders.

  1. To get something into a folder you can have the folder open and just drag the feature up under the last feature in the folder.

  1. To automatically add parts to a folder on creation, open the folder and roll back to the last feature. New features will end up in the folder. This implies that rolling back to the last feature in a folder goes just past the end of folder marker suppressing it.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required