Changing Clash Result Name Programmatically

Changing Clash Result Name Programmatically

garylzimmer
Enthusiast Enthusiast
1,579 Views
2 Replies
Message 1 of 3

Changing Clash Result Name Programmatically

garylzimmer
Enthusiast
Enthusiast

I'm trying to rename my clashes but finding that clash results are read only. The documentation says that clash results' display names are available for get and set. How do I change the display name then?

readonly.PNG

0 Likes
Accepted solutions (1)
1,580 Views
2 Replies
Replies (2)
Message 2 of 3

garylzimmer
Enthusiast
Enthusiast

I'm thinking I may have to follow this path of making copies, changing those names, deleting originals, then readding the altered named copies to the clash test.

https://forums.autodesk.com/t5/navisworks-api/adding-a-comment-to-a-clash-result-through-c-api/m-p/5...

0 Likes
Message 3 of 3

garylzimmer
Enthusiast
Enthusiast
Accepted solution

Dang, I didn't read the documentation enough! The section on Clash Detective had a good example of what to do:

DocumentClash document_clash =
   Autodesk.Navisworks.Api.Application.MainDocument.GetClash();

// get an existing test
ClashTest test = document_clash.TestsData.Tests[test_index] as ClashTest;

// test read from document-part is read-only, create a copy
ClashTest new_test = test.CreateCopy() as ClashTest;

// edit the properties, results and result-groups of the new_test

// Now replace the test stored in the document with the whole of
// our edited hierarchy.  This is efficient as a way of doing many
// edits in one operation.
document_clash.TestsData.TestsReplaceWithCopy(test_index, new_test);