To Run a Clash test using api

To Run a Clash test using api

Anonymous
Not applicable
1,318 Views
3 Replies
Message 1 of 4

To Run a Clash test using api

Anonymous
Not applicable

 

Inside a plugin, I am creating a new clash test and trying to run it. Using this command "documentClash.TestsData.TestsRunAllTests();" it runs without any errors. However, if I try using "documentClash.TestsData.TestsRunTest(oTest);" where oTest is the newly created instance, it throws "ArgumentException Argument is not in Clash Detective Parameter name: test". No other tests are defined in the model !

 

 

0 Likes
1,319 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

SavedItemCollection clashTests = documentClash.TestsData.Tests;
documentClash.TestsData.TestsRunTest(clashTests[clashTests.Count-1] as ClashTest);

0 Likes
Message 3 of 4

jabowabo
Mentor
Mentor

You can also try this:

 private void RunClash(string clashTestName)
        {
            Document doc = NavisApp.ActiveDocument;
            DocumentClash clash = doc.GetClash();
            DocumentClashTests clashTests = clash.TestsData;

            using (ClashTest clashTest = (ClashTest)clashTests.Tests.FirstOrDefault(t => t.DisplayName == clashTestName))
            {
                clash.TestsData.TestsRunTest(clashTest);
            }
        }
Message 4 of 4

Ta7a
Enthusiast
Enthusiast
Hello jabowabo,

this method is really great but i have a small issue if i get test and try to run it the object of this test is disposed and i can't use it ( i remove using block to avoid disposing of clashtest but it still disposed)
0 Likes