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: 

To Run a Clash test using api

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1066 Views, 3 Replies

To Run a Clash test using api

 

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 !

 

 

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

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

Message 3 of 4
jabowabo
in reply to: Anonymous

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
in reply to: jabowabo

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)

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report