On Dec 2, 2010, at 8:47 AM, Watkins, Steven M CIV NSWCDD, G24 wrote: > Hi > > Thanks for the suggestions. I had looked at the db_walk_tree > example but it appeared to me that it required an object name in > order to walk that objects tree. What I was looking for was code > that would show the overall tree hierarchy without knowing any of > the internal objects names. I was able to display all the object > names after a rt_dirbuild function by looping through the directory > structs via rti_dbip, however, I currently cannot see the tree > relationships. I would prefer to use code available via the librt, > if possible.
Steve, Many of the tree traversal methods (and there are several) require a starting point. Fortunately, every .g database has a specific set of starting points known as the top-level objects. The "tops" command in mged displays this list. You can get that list of object names by calling ged_tops() after some setup or use the same lower-level librt method that the tops command uses (via src/libged/tops.c). Basically, the iteration you already performed by looping through the directory structs is what you need to do in order to identify the top- level objects. For each directory pointer, there's a field that records how many objects reference that object (you may need to call db_update_nrefs() first). The ones with zero references are your top- level objects. > I just finished compiling the 7.16.10 version of Brl-Cad (had been > using 7.14 precompiled windows binaries). The Windows Visual > Studio build seems to have quite a few issues. I also needed to > throw a "struct resource rt_uniresource;" line in my application > code to get it to link with librt. Hm, the Windows build does have a variety of issues (work-in- progress), but you shouldn't have needed to add that resource struct. I suspect you're missing a preprocessor declaration to import librt objects. I believe you may have to define BRLCAD_DLL. See if that helps. Cheers! Sean ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ BRL-CAD Developer mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/brlcad-devel
