How to improve the speed of adding properties to selected items?

How to improve the speed of adding properties to selected items?

SergeyShevtsov
Enthusiast Enthusiast
1,041 Views
6 Replies
Message 1 of 7

How to improve the speed of adding properties to selected items?

SergeyShevtsov
Enthusiast
Enthusiast

Hello,

I have adding properties algorithm using COM, that adds properties to selected items, it works fine with count less than 10, but in my case model contains more than 360k objects, and adding props process takes ages, because i have to add one by one, using for/foreach methods. 

Is it possible to improve speed of this process, for example add props not foreach object but a bunch?

 

1,042 Views
6 Replies
Replies (6)
Message 2 of 7

ulski1
Collaborator
Collaborator
ssdiesel, we have models a lot larger than what you mention and we manage to add a lot of user property data. I did have the same situation as you describe but I found that adding properties in itself is super fast and wasn't the bottleneck. I suggest that you create several stopwatches Stopwatch sw1 = new Stopwatch(); Stopwatch sw2 = new Stopwatch(); Stopwatch sw3 = new Stopwatch(); and then start and stop the stopwatches when various sub tasks are run so you can pin point what is taking time. often you can get huge performance penalties by operating on larger collections of objects than is really necessary
0 Likes
Message 3 of 7

SergeyShevtsov
Enthusiast
Enthusiast

ulski, yeah adding properties itself do not takes a lot of time, but counting is very slow process. Well you almost right i use a different Threat for adding props, and i show a progressbar for user, but it is too long for him, he can abort the process, but it has to be finished, I use modeless pane for this and do not block working process untill user selects something else.

 

0 Likes
Message 4 of 7

Anonymous
Not applicable

A few possible areas of improvement from experience:

 

1. Close all the UI dockpanes, including the default Navisworks ones, as some of them really slow down the process (in particular: FindItem, SelectionInspector etc.). You may need to close them, close Navisworks and restart it so that they are not even loaded, as some of them (mostly custom plugins) will react whether they are showing or not.

2. Ensure the items are not selected when adding properties (minimize risk of plugins reacting to selection change)

3. Make sure you have no search sets (worst case, export them and import them back after the process)

4. if you add several properties to the same object / category, do it with a single call to the InwOpState, InwOaPropertyVector and all the COM jargon (spelling not guaranteed)

Message 5 of 7

SergeyShevtsov
Enthusiast
Enthusiast

ngombault, thanks for your suggestions.

But why dockpanes slow the process? Because I can't close them all, I use it (FindItem) for items selection.

Yeah, I've had I bad experience with selection sets, from one hand I thought that it is a native searching instrument and it should work fast, but I was wrong, because it was soooo slow! 

Yeah for sure i use InwOaPropertyVec for bunch of props

 

0 Likes
Message 6 of 7

Anonymous
Not applicable

It's not the panel itself, it is the plugin/code attached to it that is often listening to application events and slowing down execution.

For instance, when the FindItem panel is showing, every time a property is added/removed/edited, it refreshes its index of properties for the drop down menus, and that can be very slow. Similarly when the Properties panel is active, every time a property is added to one of the selected object, it refreshes. etc.

0 Likes
Message 7 of 7

dgorsman
Consultant
Consultant

Both steps can help (avoid re-creating the COM bridge components, only iterate over objects that you actually need to modify).  But the process is known to be slow (there's several threads similar to this question already).  Until they implement a native dotNET version of custom property manipulation it will continue to be this way.

 

If you have truly massive datasets I'd recommend using a Datalink with an external database if possible, possibly including scheduled NWD publishing.  It may be beneficial to research the possibility of auto-exporting NWC (including calling the plug-in to add the custom properties) rather than natively reading the model file so the property creation is handled at the side of the design software rather than at the Navisworks end.  Or using event handlers to only populate custom properties on objects that are selected for inspection.  The general idea is to move the population task away from Navisworks and spread out the actual work as much as possible.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes