Message 1 of 7
When test Clash using TestsAddCopy crashes Navisworks 2016?
Not applicable
12-12-2016
06:05 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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