Disable screen updating

Disable screen updating

kirill78zah
Contributor Contributor
1,156 Views
6 Replies
Message 1 of 7

Disable screen updating

kirill78zah
Contributor
Contributor

 I noticed a very strange problem in the API (NavisWorks 2018). I created a script that adds a large number of custom properties to model items according to an Excel table. I followed this article - http://adndevblog.typepad.com/aec/2012/08/addmodifyremove-custom-attribute-using-com-api.html.

 

When I run my script if the properties panel is open, it starts to flicker intensively as if it is constantly updated and most importantly it has a very strong effect on the program's running time. If I run the script when the properties panel is closed the run time is much less.

 

Can I turn off screen updating?

Is it possible to close the properties panel programmatically?

 

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

kirill78zah
Contributor
Contributor

I noticed another thing. My program also uses Search API (http://adndevblog.typepad.com/aec/2012/05/navisworks-net-api-find-item.html) and if when you start the program open Find Items panel, it behaves the same way and it is also very much slows down the program.

Message 3 of 7

Dricosr
Participant
Participant

Please try this>
While your code runs during you have a active progress, the NW will not update the Ui.

/// <summary>
/// Shows the basic concept of using the Progress class
/// </summary>
private static void SimpleProgressExample()
{
   //first get reference to an instance of the Progress class
   Progress progress = Autodesk.Navisworks.Api.Application.BeginProgress();

   double stage;

   for (stage = 0.0; stage < 1.0; stage += 0.1)
   {
      //Update progress bar
      progress.Update(stage);

      //#####Execute your code here##########
      //You need to adapt this code to your context.
   }

   //Update progress bar to 100%
   progress.Update(1.0);

   //notify the API that the operation has finished
   Autodesk.Navisworks.Api.Application.EndProgress();
}

 

0 Likes
Message 4 of 7

roomn
Explorer
Explorer

Hello,
I encountered the same performance issue with the properties and find item pane.
The UI keeps refreshing even with an active Progress.

I've seen other posts on this forum board asking for ways to close/open a native DockPane by code but the API doesn't seems to allow this use case.

 

If there is a workaround to telling my users to manually close the native panes before using custom actions, I'd gladly hear about it.

 

Regards

0 Likes
Message 5 of 7

mikhail_khrushchev
Explorer
Explorer

Better iterate through ItemCollection, rather than items one by one 

 

And wrap it into Transaction, this way you could undo all changes in one action call.

 

 

Message 6 of 7

lanneauolivier
Enthusiast
Enthusiast

Hi,

It is possible to hide/show dock panel, even created by Navisworks itself.

The easiest is to virtualy click on the ribbon panel's button.

 

This toggles the tree window

using Autodesk.Windows;
...
var ribbonItem = Autodesk.Windows.ComponentManager.Ribbon.FindItem("RoamerGUI_OM_VIEW_TREE", false);
Autodesk.Windows.ComponentManager.ApplicationMenu.CommandHandler.Execute(ribbontItem);

 

You can access visibility thanks to isChecked property when casting ribbonItem as RibbonButton or RibbonCheckBox.

You can get button id inside the xaml file of the native ribbon in the installation directory of Navisworks

Message 7 of 7

roomn
Explorer
Explorer

Thanks for your reply.
I add no issue finding the right RibbonButton IDs and the toggle works as expected.

Strangly enough (for the FindItem "
RoamerGUI_OM_FIND_ITEM" Button at least), isChecked is always False but IsActive toggle with the button executing.
By storing the IsActive value, I can even toggle back on the pane which makes it transparent for the user.

0 Likes