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: 

When test Clash using TestsAddCopy crashes Navisworks 2016?

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
608 Views, 6 Replies

When test Clash using TestsAddCopy crashes Navisworks 2016?

Hi,

 

I try to test clash of 2 selection set. First, I wrote function addClashTest()

Using the following code, have have a very strange behavior.


When run to 「docClash.TestsData.TestsAddCopy(oNewTest);」 occurred exception and crashes Navisworks
It is surrounded by a try catch block but the exception is not caught.
Why is the exception not caught? 「TestsAddCopy」API has problems?

Any tips on these will be great help. Thanks in advance.

 

Here is the code I use:

 

DocumentClash docClash = Autodesk.Navisworks.Api.Application.ActiveDocument.GetClash();

// Create a ClashTest ClashTest oNewTest = new ClashTest(); oNewTest.CustomTestName = "Test_Clash"; oNewTest.DisplayName = "Test_Clash"; oNewTest.TestType = ClashTestType.Clearance; oNewTest.Tolerance = 1500; //Set SelectionA and SelectionB of the ClashTest ModelItemCollection oSelA = new ModelItemCollection(); ModelItemCollection oSelB = new ModelItemCollection(); // Create 1st Selection Set: SelectionSet1 // Create 2nd Selection Set: SelectionSet2 // Loop list selection set foreach (SavedItem set in listSelectionSets) { if ("SelectionSet1".Equals(set.DisplayName)) { oSelA.AddRange(SelectionSet1); } else if ("SelectionSet2".Equals(set.DisplayName)) { oSelB.AddRange(SelectionSet2); } } if ((0 < oSelA.Count) && (0 < oSelB.Count)) { oNewTest.SelectionA.Selection.CopyFrom(oSelA); oNewTest.SelectionB.Selection.CopyFrom(oSelB); try { docClash.TestsData.TestsAddCopy(oNewTest); } catch (Exception ex) { // Information of the exception //throw new ApplicationException("Error :", ex); System.Windows.Forms.MessageBox.Show(ex.Message); } }

 

Regards,
MinhHN

6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

I am also having the issue where Try/Catch is being ignored.  The program simply errors and quits.  I am using VS2015 against Simulate 2016.  This is the error it throws that it can not recover from:

 

Exception thrown at 0x00007FFA90BEA837 (ASMKERN221A.dll) in RequestedModelBuild_2016.exe: 0xC0000005: Access violation writing location 0x0000000000000010.

 

This is thrown when using TryAppend with a .DWG file.   I can load the file manually without errors.

 

I do not have this issue with VS2013 or earlier with Simulate 2015 or earlier.  I have not attempted VS2015 with an earlier version of Simulate with the same code.

 

Message 3 of 7
Anonymous
in reply to: Anonymous

Thank you for the reply!

I'm using VS2012 with .Net 4.5
Because no exception has been thrown, I do not know the exact cause

According to what you talked, the cause may be "Visual Studio" and ".Net" version is old ?

Message 4 of 7
Anonymous
in reply to: Anonymous

The version of .NET does not matter. I am using .NET 6.1 in Windows 7 and Windows 10 with the same behavior.  My issue seems to be localized in the Document object, specifically when using TryAppend when reading in .DWG files. My app is a console app, rather than a plug-in.

Message 5 of 7
Anonymous
in reply to: Anonymous

Not because it is old. Because Simulate 2016 has api issues.  I tried with all .NET versions from 4.5 through 6.1. with same result.

Message 6 of 7
Anonymous
in reply to: Anonymous

Hi, thank you!
Because no exception has been thrown, I do not know the exact cause.
I'm investigating the cause 🙂

Message 7 of 7
Anonymous
in reply to: Anonymous

an exception is thrown. The complaint is that it is not handed back to the customization through the api, rather, roamer handles the exception and quits.  I have found that If I am in Windows 10 and turn on Close On Load performance option the error does not occur.  It is still a problem that if an error occurs, the program quits instead of allowing the api calling program to handle the error.

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report