<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic When test Clash using TestsAddCopy crashes Navisworks 2016? in Navisworks API Forum</title>
    <link>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6744915#M4926</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to test clash of 2 selection set. First, I wrote function addClashTest()&lt;/P&gt;&lt;P&gt;Using the following code, have have a very strange behavior.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When run to ｢&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;docClash.TestsData.TestsAddCopy(oNewTest);&lt;/STRONG&gt;&lt;/FONT&gt;｣ occurred exception and crashes Navisworks&lt;BR /&gt;It is surrounded by a try catch block but the exception is not caught.&lt;BR /&gt;Why is the exception not caught? ｢TestsAddCopy｣API has problems?&lt;/P&gt;&lt;P&gt;Any tips on these will be great help. Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DocumentClash docClash = Autodesk.Navisworks.Api.Application.ActiveDocument.GetClash();&lt;BR /&gt;&lt;BR /&gt;// 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 &amp;lt; oSelA.Count) &amp;amp;&amp;amp; (0 &amp;lt; 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);
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;MinhHN&lt;/P&gt;</description>
    <pubDate>Tue, 13 Dec 2016 02:10:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-12-13T02:10:42Z</dc:date>
    <item>
      <title>When test Clash using TestsAddCopy crashes Navisworks 2016?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6744915#M4926</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to test clash of 2 selection set. First, I wrote function addClashTest()&lt;/P&gt;&lt;P&gt;Using the following code, have have a very strange behavior.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When run to ｢&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;docClash.TestsData.TestsAddCopy(oNewTest);&lt;/STRONG&gt;&lt;/FONT&gt;｣ occurred exception and crashes Navisworks&lt;BR /&gt;It is surrounded by a try catch block but the exception is not caught.&lt;BR /&gt;Why is the exception not caught? ｢TestsAddCopy｣API has problems?&lt;/P&gt;&lt;P&gt;Any tips on these will be great help. Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DocumentClash docClash = Autodesk.Navisworks.Api.Application.ActiveDocument.GetClash();&lt;BR /&gt;&lt;BR /&gt;// 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 &amp;lt; oSelA.Count) &amp;amp;&amp;amp; (0 &amp;lt; 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);
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;MinhHN&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 02:10:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6744915#M4926</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-13T02:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: When test Clash using TestsAddCopy crashes Navisworks 2016?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6746144#M4927</link>
      <description>&lt;P&gt;I am also having the issue where Try/Catch is being ignored. &amp;nbsp;The program simply errors and quits. &amp;nbsp;I am using VS2015 against Simulate 2016. &amp;nbsp;This is the error it throws that it can not recover from:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Exception thrown at 0x00007FFA90BEA837 (ASMKERN221A.dll) in RequestedModelBuild_2016.exe: 0xC0000005: Access violation writing location 0x0000000000000010.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is thrown when using TryAppend with a .DWG file. &amp;nbsp; I can load the file manually without errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not have this issue with VS2013 or earlier with Simulate 2015 or earlier. &amp;nbsp;I have not attempted VS2015 with an earlier version of Simulate with the same code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 15:28:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6746144#M4927</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-13T15:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: When test Clash using TestsAddCopy crashes Navisworks 2016?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6747609#M4928</link>
      <description>&lt;P&gt;Thank you for the reply!&lt;/P&gt;&lt;P&gt;I'm using VS2012 with .Net 4.5&lt;BR /&gt;Because no exception has been thrown, I do not know the exact cause&lt;/P&gt;&lt;P&gt;According to what you talked, the cause may be "Visual Studio" and ".Net" version is old ?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 00:32:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6747609#M4928</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-14T00:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: When test Clash using TestsAddCopy crashes Navisworks 2016?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6754124#M4929</link>
      <description>&lt;P&gt;The version of .NET does not matter. I am using .NET 6.1 in Windows 7 and Windows 10 with the same behavior. &amp;nbsp;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.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 13:50:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6754124#M4929</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-16T13:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: When test Clash using TestsAddCopy crashes Navisworks 2016?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6758074#M4930</link>
      <description>&lt;P&gt;Not because it is old. Because Simulate 2016 has api issues. &amp;nbsp;I tried with all .NET versions from 4.5 through 6.1. with same result.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 14:27:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6758074#M4930</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-19T14:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: When test Clash using TestsAddCopy crashes Navisworks 2016?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6759529#M4931</link>
      <description>&lt;P&gt;Hi, thank you!&lt;BR /&gt;Because no exception has been thrown, I do not know the exact cause.&lt;BR /&gt;I'm investigating the cause &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 00:31:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6759529#M4931</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-20T00:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: When test Clash using TestsAddCopy crashes Navisworks 2016?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6771477#M4932</link>
      <description>&lt;P&gt;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. &amp;nbsp;I have found that If I am in Windows 10 and turn on Close On Load performance option the error does not occur. &amp;nbsp;It is still a problem that if an error occurs, the program quits instead of allowing the api calling program to handle the error.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 19:09:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/when-test-clash-using-testsaddcopy-crashes-navisworks-2016/m-p/6771477#M4932</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-12-27T19:09:22Z</dc:date>
    </item>
  </channel>
</rss>

