Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to Create/Update clash tests with the following code:
private ClashTest GetClashTest(string ClashtestName, double tolerance)
{
DocumentClash documentClash = Autodesk.Navisworks.Api.Application.ActiveDocument.GetClash();
ClashTest ct = documentClash.TestsData.Tests.Where(x => x.DisplayName == ClashtestName).FirstOrDefault() as ClashTest;
if (ct == null)
{
ct = new ClashTest();
ct.Tolerance = tolerance;
ct.TestType = ClashType;
ct.DisplayName = ClashtestName;
documentClash.TestsData.TestsAddCopy(ct);
ct = documentClash.TestsData.Tests.Where(x => x.DisplayName == ClashtestName).FirstOrDefault() as ClashTest;
}
else
{
ct.Tolerance = tolerance;
ct.TestType = ClashType;
}
return ct;
}The code works in the If part where I am creating a new Clash Test, but it throws an exception in the Else part where I am trying to set the tolerance of the existing ClashTest ( ct.tolerance=tolerance).
The exception says that the clash test is unmodifiable.
Please help me in setting the tolerance of existing clash tests
Solved! Go to Solution.