Poor Performance Loading Model Properties

Poor Performance Loading Model Properties

Anonymous
Not applicable
1,498 Views
5 Replies
Message 1 of 6

Poor Performance Loading Model Properties

Anonymous
Not applicable

As part of integrating the Navisworks model into our product, we need to be able to load up all model items and their associated properties at the time of the model being opened. This needs to be done because we build model filters on the available properties and values.

 

While walking the model to load the properties, this takes an extremely long time, based on the size of the model. We are currently testing with the Autodesk_Hospital_Architectural.nwc sample model installed (by default) here: C:\Program Files\Autodesk\Navisworks Manage 2016\Samples\Quantification

 

Our code is set up in a recursive method to walk the tree and load the items. The code below, without actually creating any items, takes over 20 seconds to just walk every item. This model has around 47K items (a rather small model). Once we start creating objects, the time required to execute is completely unacceptable.

 

        private void WalkNavisModelItemsForStats(ModelItem item)
        {
            // create internal model item with the properties we need
 
            foreach (var cat in item.GetUserFilteredPropertyCategories())
            {
                foreach (var property in cat.Properties)
                {
                    // create internal model item properties related to the internal model item
                }
            }
 
            foreach (var child in item.Children)
            {
// create the child model items down the tree                 WalkNavisModelItemsForStats(child);             }         }

 We have attempted to run this multi-threaded. However, when that didn't work, we found that the API objects are not thread safe, so that is out.

 

Any guidance for importing the model items and properties in a reasonable amount of time would be much appreciated.

 

0 Likes
1,499 Views
5 Replies
Replies (5)
Message 2 of 6

xiaodong_liang
Autodesk Support
Autodesk Support
Hi Jon,

It is not a nice practice to iterate every items. The larger size / complexity of the model, the slower with the integration. The scenarios with properties are mostly locating the object/properties on demand, or linking to the external database with the corresponding items. And as far as I know, Navisworks does not support multi-thread.

While it looks you want to know the available property category, properties and even values. I cannot think of a better way than iteration because API does not provide a direct way, but one I’d suggest is to try with the workflow on OnIdle event. I believe your user would not run the menu like [Find Item] right after opening the model. So the code can iterate when Navisworks is not busy. I cannot guarantee whether it could help, however it is worth to give it a try. In addition, you may provide a progress bar when iteration to ask for the patience of users.
0 Likes
Message 3 of 6

jonathanbowser
Contributor
Contributor

Would the NwCreate API offer better performance for reading and exploring the model for its properties?

0 Likes
Message 4 of 6

xiaodong_liang
Autodesk Support
Autodesk Support
no, NwCreate API does not such job. I had some comments about .NET, COM and NwCreate in the other thread, message 7:
http://forums.autodesk.com/t5/navisworks-api/read-nwd-nwc-nwf-data/td-p/5652857
0 Likes
Message 5 of 6

jabowabo
Mentor
Mentor
If you skip retrieving unneeded property values it will speed things up somewhat. I have a filtering app that uses a form for user input and an xml file to store settings for including only relevant properties. You can see how it works by downloading QFinder 2016 here:
https://sites.google.com/site/wjasonhudson/my-projects
0 Likes
Message 6 of 6

Anonymous
Not applicable

Thanks for the suggestion. That is the approach we took. We now have a "whitelist" of properties we are interested in and only pull those properties. While still not perfect, it has sped up the process significantly. We are still looking at ways to shave the load time.

0 Likes