|
你直接用Family这个类名来获取就可以了。
请看下面代码:- <p>
- </p><p>[csharp] view plaincopy</p><p>public void GetAllStandardFamilies() </p><p>{ </p><p> Application app = this.Application; </p><p> </p><p> Document doc = this.ActiveUIDocument.Document; </p><p> FilteredElementCollector collector = new FilteredElementCollector(doc); </p><p> collector.OfClass(typeof(Family)); </p><p> string familyNames = null; </p><p> </p><p> foreach(Element elem in collector) </p><p> { </p><p> if(elem is Family) </p><p> { </p><p> Family f = elem as Family; </p><p> familyNames += f.Name + "\r\n"; </p><p> } </p><p> </p><p> } </p><p> TaskDialog.Show("all families",familyNames); </p><p>} </p>
复制代码 转载请复制以下信息:
原文链接: http://blog.csdn.net/joexiongjin/article/details/9495281
作者: 叶雄进 , Autodesk ADN
|
|