This examples shows a few operations you can extract ( TKE_Shell, TKE_Comment, TKE_Text, etc) to get started.
The basic idea is create a handler for each different op code in the hoops scene graph, assign them as the handler, and process the stream. Your handler objects will get called in the order of processing the stream's opcodes.
I am still having trouble with this - I can read shells out of a dwf file, and I understand that getting the selection tree will have to do with TK_Open_Segment and TK_Close_Segment, but I am stuck there.
Somewhere in the stream there has to be the string that names the different segments and I can't find it. Eg. in the 3Dpublish sample,
// // open with a name, this will show in the nav tree // oPart1.open( L"First Part" );
I have made some progress, I have found the handler TK_Referenced_Segment handles opcode TKE_Include_Segment which is important for the selection tree.
I also found that if you change the .dwf file to .zip, there are some xml files which designate the names of different segments/selection tree items.Navisworks can still read the names without these xml files though. Help still needed if possible.