# Copying Views and details

**URL:** <https://forum.dynamobim.com/t/copying-views-and-details/30026>\
**Category:** Revit\
**Created:** [December 24, 2018, 12:20pm UTC](https://forum.dynamobim.com/t/copying-views-and-details/30026 "2018-12-24T12:20:53Z")\
**Posts on this page:** 1\
**Showing post:** 43

<div class="post-metadata">

**Author:** ![Mike.Buttery](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@Mike.Buttery](https://forum.dynamobim.com/u/Mike.Buttery)\
**Post date:** [November 18, 2024, 11:59pm UTC](https://forum.dynamobim.com/t/copying-views-and-details/30026/43 "2024-11-18T23:59:19Z")

</div>

Steam nodes are getting quite long in the tooth  
Here is some python to copy filtered views from a single link document  
Requires **IronPython** due to sub-classing to stop duplicate type warnings

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/f/2f2b387eae6f3cd3e376f0b405ce139218c74468.png)

```python
import clr

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

from System.Collections.Generic import List

class SuppressDuplicateTypeNames(IDuplicateTypeNamesHandler):
    def OnDuplicateTypeNamesFound(self, args):
        return DuplicateTypeAction.UseDestinationTypes

# **Use IronPython**

doc = DocumentManager.Instance.CurrentDBDocument

link_doc = IN[0]
name_contains = IN[1]
copy_views = IN[2]

# Collect views
views = (
    FilteredElementCollector(link_doc)
    .OfCategory(BuiltInCategory.OST_Views)
    .ToElements()
)

# Filter views
views = list(filter(lambda v: name_contains in v.Name, views))
view_ids = List[ElementId](map(lambda e: e.Id, views))

# Copy views
if copy_views:
    options = CopyPasteOptions()
    options.SetDuplicateTypeNamesHandler(SuppressDuplicateTypeNames())

    TransactionManager.Instance.EnsureInTransaction(doc)

    views = ElementTransformUtils.CopyElements(link_doc, view_ids, doc, None, options)

    TransactionManager.Instance.TransactionTaskDone()

    OUT = [doc.GetElement(vid) for vid in views], views

else:
    OUT = views, view_ids

```

---

_[View the full topic](https://forum.dynamobim.com/t/copying-views-and-details/30026)._
