Revit二次开发,删除载入的族
Posted wenqiang1266
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Revit二次开发,删除载入的族相关的知识,希望对你有一定的参考价值。
Document doc = commandData.Application.ActiveUIDocument.Document; Family family = null; string s = "c:/xxx.rfa"; Transaction tran = new Transaction(doc,"载入族"); tran.Start(); bool b = doc.LoadFamily(s, out family); tran.Commit(); if (b) { //获取族类型 UploadBll.getFamilySymbol(family); Element element = family as Element; //获取族文件参数 UploadBll.getParameter(element, "族参数"); //获取族类型参数 UploadBll.getSymbolpara(family); ElementFilter sanshuiCategoryFilter = new ElementCategoryFilter(family.FamilyCategoryId); ElementFilter familySymbolFilter = new ElementClassFilter(typeof(FamilySymbol)); LogicalAndFilter andFilter = new LogicalAndFilter(sanshuiCategoryFilter, familySymbolFilter); FilteredElementCollector sanshuiSymbols = new FilteredElementCollector(doc); sanshuiSymbols = sanshuiSymbols.WherePasses(andFilter); FamilySymbol symbol = null; foreach (FamilySymbol f in sanshuiSymbols) { if (f.FamilyName.Equals(dataGirdObjList[i].FileName)) { symbol = f; break; } } using (Transaction tran1 = new Transaction(doc, "删除载入族")) { tran.Start(); doc.Delete(symbol.Family.Id); tran.Commit(); } }
在Revit二次开发里,当我载入族后,如何用代码删除,这个问题我研究了2天,幸得高人指点方才突破,感谢她@若爱,请深爱
以上是关于Revit二次开发,删除载入的族的主要内容,如果未能解决你的问题,请参考以下文章
在Revit二次开发里,如何在代码实现获得Revit里 所有的族的类别?