Poor Performance Loading Model Properties
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.