Skip to content

Commit

Permalink
Update document.py
Browse files Browse the repository at this point in the history
  • Loading branch information
marcantondahmen committed Oct 28, 2020
1 parent 41dad25 commit bbe95fc
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion revitron/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,32 @@ def __init__(self, doc = None):
else:
self.doc = revitron.DOC



def getDuplicateInstances(self, preferOlderElement = False):
"""
Returns a list of duplicate family instances.
By default, the list contains always the younger more recently created duplicate instance.
Args:
preferOlderElement (bool, optional): Optionally return the list with the older instances. Defaults to False.
Returns:
list: A list with duplicate instances, either the younger or the older ones.
"""
index = 1
if preferOlderElement:
index = 0
import revitron
of = revitron.DB.BuiltInFailures.OverlapFailures
duplicates = []
for warning in self.doc.GetWarnings():
if warning.GetFailureDefinitionId().Guid == of.DuplicateInstances.Guid:
ids = warning.GetFailingElements()
duplicates.append(ids[index])
duplicates = list(set(duplicates))
return duplicates


def getPath(self):
"""
Returns the path to the document.
Expand Down

0 comments on commit bbe95fc

Please sign in to comment.