Skip to content

Commit

Permalink
Update document.py
Browse files Browse the repository at this point in the history
  • Loading branch information
marcantondahmen committed Feb 8, 2021
1 parent 1206e7f commit 5243f8a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions revitron/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,31 @@ def getDuplicateInstances(self, preferOlderElement = False):
return duplicates


def getLinkedDocuments(self, scope = None):
"""
Returns a dictionary of all linked documents.
The key is the ID of the link and the value is the actual document object.
Args:
scope (mixed, optional): List or view ID. Defaults to None.
Returns:
dict: A dictionary of all linked documents.
"""
import revitron
linkedDocuments = dict()
extension = '.rvt'
for link in revitron.Filter(scope).byCategory('RVT Links').noTypes().getElements():
linkType = revitron.Parameter(link, 'Type').getValueString()
if linkType.endswith(extension):
linkType = linkType[:-len(extension)]
for openDoc in revitron.APP.Documents:
if openDoc.IsLinked:
if openDoc.Title == linkType:
linkedDocuments[link.Id] = openDoc
return linkedDocuments


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

0 comments on commit 5243f8a

Please sign in to comment.