📜  获取 linkinstance revit api - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:28.677000             🧑  作者: Mango

代码示例1
import clr
import sys
import System

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

elements = UnwrapElement(IN[0]) if isinstance(IN[0],list) else [UnwrapElement(IN[0])]

dicDocLink = {link.GetLinkDocument().GetHashCode() : link for link in  FilteredElementCollector(doc).OfClass(RevitLinkInstance) }

OUT = [dicDocLink.get(elem.Document.GetHashCode()) for elem in elements]