Slow to build custom selection tree

By Xiaodong Liang

Issue

I wanted to build a Selection Tree like Navisworks GUI. The code of .NET API traverses the whole model and add each model item to the tree node. But it is too slow, especially for a large model. Is there any way to improve the speed?

Solution

The standard Windows tree controls are very poor at handling very large trees, and as such are often unsuitable for representing large selection trees. Traversing the entire hierarchy will be slow for large models using recursion, and added to the use of the Windows tree control, the slow performance is as expected.

We suggest doing something similar to the AppInfo sample by storing the ModelItem with the TreeNode and only looking at the children when the node is expanded, that way you limit the effect of the expansion speed to only examine children when it is needed.


Comments

One response to “Slow to build custom selection tree”

  1. Xiaodong
    Thanks for your post. I need to create nwc file using api to appending SAT (Acis) files. After append, I need attach Custom properties for each entity and after that,I need to build a Custom selection tree based in some custom properties. Is possible to do it just using API? Do you have suggestions? My SAT files have typically 130.000 entities.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading