Community
Navisworks API
Welcome to Autodesk’s Navisworks API Forums. Share your knowledge, ask questions, and explore popular Navisworks API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Clash status lag

2 REPLIES 2
Reply
Message 1 of 3
anzi
534 Views, 2 Replies

Clash status lag

Hi,

 

I'm writing a plugin for Navisworks 2012 using COM that changes a status of some clashes to "approved". I go through all the clashes in a batch and do this:

clash.status = ComApi.nwETestResultStatus.eTestResultStatus_APPROVED;

However when I run this code on about 1000 clashes in a batch each clash takes 5-10 seconds. I checked it several times in VS 2010 and the most time consuming code is the code above. 

 

At the moment I can approve all the clashes manually faster than by the means of API.

 

I've got a pretty modern computer (i7, 8gb ram).

 

Is there a way to make it faster? May be I need to switch off some options like redraw or other?

 

Thanks in advance,

 

Andrew

 

Tags (2)
2 REPLIES 2
Message 2 of 3
xiaodong_liang
in reply to: anzi

 

It is a bit hard to address, some suggestions:


- In UI, select all the results and batch change the status manually to see if it is also very slow. In theory, there would be a little slower to communicate from .NET with COM, but it should not be a big lag if it is just changing a status.

- Check if the problem occurs with this line only if you comment out other lines. e.g. get clash, iterate each clash, change the status.


- Switch off ‘Hardware Acceleration’ to see if it helps


- If with NW 2013, use .NET API directly to see if works better. Two blogs talk about the new API


http://adndevblog.typepad.com/aec/2012/05/navisworks-net-api-2013-new-feature-part-1.html
http://adndevblog.typepad.com/aec/2012/05/navisworks-net-api-2013-new-feature-part-2.html


 

Message 3 of 3
anzi
in reply to: xiaodong_liang

Thank you for the solutions.

 

If I approve clashes manually by selecting all of them and changing the status it takes about 20-30 seconds to approve 1000 clashes. 

 

I found out that the problem occurs not only when I automatically change the status of a clash but when I change the properties "ApprovedBy" and "ApprovedTime".

 

Here is my code

public override int Execute(params string[] parameters)
{
	try
	{
		ComApi.InwOpState10 state;
		state = ComApiBridge.ComApiBridge.State;

		ComApi.InwOpClashElement m_clash = null;

		foreach (dynamic d_plugin in state.Plugins())
		{
			m_clash = d_plugin as ComApi.InwOpClashElement;
			if (m_clash != null)
				break;
		}

		if (m_clash == null)
			throw new System.NullReferenceException("Clash Detective not found");

		foreach (ComApi.InwOclClashTest test in m_clash.Tests())
		{
			foreach (ComApi.InwOclTestResult clash in test.results())
			{
				clash.status = ComApi.nwETestResultStatus.eTestResultStatus_APPROVED;
			}
		}
	}
	catch (Exception e)
	{
	}
	return 0;
}

 

It lags only when I change the status.

 

I tried to switch the "Hardware acceleration" off but it didn't help.

 

At the moment I can't use NW 2013, so I need to fix this problem in NW 2012

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report