It probably doesn't make any sense to start from the results of leHiTree() - it would be awkward to intercept, and then you'd have to parse the output it produces (from the window it puts it in). Easier to traverse the hierarchy yourself, and build the hiCreateTree form yourself.
You could base it on my Cadence Online Support Solution 11300048 . This is to do a tree on a schematic hierarchy (layout is simpler, because you don't need to worry about view switching). But you may find it a useful starting point.