码迷,mamicode.com
首页 > 其他好文 > 详细

Revit二次开发,删除载入的族

时间:2018-08-30 00:16:36      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:null   als   eof   out   reac   symbol   red   pass   二次开发   

            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二次开发,删除载入的族

标签:null   als   eof   out   reac   symbol   red   pass   二次开发   

原文地址:https://www.cnblogs.com/wenqiang1266/p/9557480.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!