打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Revit API判断是不是柱族模板
//判断是不是柱族模板
[TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class cmdCheckFamily : IExternalCommand
{
    bool ValidateDocument(Document rvtDoc)
    {
        if (!rvtDoc.IsFamilyDocument)//判断是不是族文档
        {
            TaskDialog.Show("Family API""This command works only in the family editor.");
            return false;
        }
        Family ownerFamily = rvtDoc.OwnerFamily;
        if (ownerFamily == null)//判断是否使用了族模板
        {
            TaskDialog.Show("Family API""This document does not have Owner Family.");
            return false;
        }
        //取得族类别的方法
        Category catColumn = rvtDoc.Settings.Categories.get_Item(BuiltInCategory.OST_Columns);
        if (!ownerFamily.FamilyCategory.Id.Equals(catColumn.Id))
        {
            TaskDialog.Show("Family API""The category of this document does not match the context of this commands. Please open Metric Column.rft");
            return false;
        }
        return true;
    }
    public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
    {
        UIApplication app = commandData.Application;
        Document doc = app.ActiveUIDocument.Document;
        Selection sel = app.ActiveUIDocument.Selection;

        ValidateDocument(doc);

        return Result.Succeeded;
    }
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
如何免费看腾讯动漫?100%破解腾讯漫画方法分享
RevitAPI是什么?Revit二次开发对象结构有几类?
Dynamo应用秘籍:13:全能的Python Script标准模板
小升初英语自我介绍模板
Rhino.Inside.Revit节点包FunBIM v0.1 beta版介绍
revit2014,走起
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服