Navisworks API

Reply
Member
anzi
Posts: 3
Registered: ‎03-24-2011
Message 1 of 3 (143 Views)

Clash status lag

143 Views, 2 Replies
05-23-2012 12:49 AM

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

 

ADN Support Specialist
xiaodong.liang
Posts: 1,271
Registered: ‎06-12-2011
Message 2 of 3 (134 Views)

Re: Clash status lag

05-23-2012 08:39 PM 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


 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Member
anzi
Posts: 3
Registered: ‎03-24-2011
Message 3 of 3 (129 Views)

Re: Clash status lag

05-23-2012 09:55 PM 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

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.