話不多說,直接代碼 ...
話不多說,直接代碼
var doc = commandData.Application.ActiveUIDocument.Document;
FilteredElementCollector linkInstances = new FilteredElementCollector(doc); linkInstances = linkInstances.WherePasses(new ElementClassFilter(typeof(RevitLinkInstance))); if (linkInstances != null && linkInstances.Any()) { foreach (RevitLinkInstance linkIns in linkInstances) { Autodesk.Revit.DB.Document linkDoc = linkIns.GetLinkDocument(); if (linkDoc != null) { //選取你想要的構件 } } }