Avoiding Family Renaming With Copy Elements API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all, I am working on a plugin which basically will copy/replace/update drafting views in the current project with our Master Detail revit file. To do this, I am using the copyelements API like so:
def copy_elements(dest, source, elements):
class CustomCopyHandler(IDuplicateTypeNamesHandler):
def OnDuplicateTypeNamesFound(self, args):
return DuplicateTypeAction.UseDestinationTypes
transform = Transform.Identity
cpOptions = CopyPasteOptions()
cpOptions.SetDuplicateTypeNamesHandler(CustomCopyHandler())
new_element_ids = ElementTransformUtils.CopyElements(source, elements, dest, transform, cpOptions)
return new_element_ids
However, even with the above code I sometimes still get warning about families being renamed due to conflict with the version loaded into the library file. The warning is this:
https://www.revitapidocs.com/2020/f91a433b-d41a-92f5-1512-d10776211150.htm?section=seeAlsoToggle
How can I avoid this error/warning? I don't want to just suppress the message, I want to use the families/types loading into the Master Detail file rather than the ones being sent. I do not like ending up with multiple versions of a detail family with "1", "2", etc as a result of the automatic renaming from this error.