连接器的类别,风管不仅有两端,可能在曲线上也有。

//连接器
[TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class cmdConnector : IExternalCommand
{
    public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
    {
        UIApplication app = commandData.Application;
        Document doc = app.ActiveUIDocument.Document;
        Selection sel = app.ActiveUIDocument.Selection;         Transaction ts = new Transaction(doc, "revit");
        ts.Start();         Reference refDuct = sel.PickObject(ObjectType.Element, "duct");
        Duct duct = doc.GetElement(refDuct) as Duct;
        ConnectorSetIterator csi = duct.ConnectorManager.Connectors.ForwardIterator();
        int iCount = ;
        int iEnd = ;
        int iCurve = ;
        while (csi.MoveNext())
        {
            iCount += ;
            Connector conn = csi.Current as Connector;
            if (ConnectorType.End == conn.ConnectorType)//一般风管的连接器
            {
                iEnd += ;
            }
            else if (ConnectorType.Curve == conn.ConnectorType)//风管曲线上的连接器
            {
                iCurve += ;
            }
        }
        TaskDialog.Show("count", iCount + "," + iEnd + "," + iCurve + "," + duct.UniqueId);         ts.Commit();         return Result.Succeeded;
    }
}

url:http://greatverve.cnblogs.com/p/revit-mep-api-ConnectorType.html

Revit MEP API连接器类别的更多相关文章

  1. Revit MEP API找到连接器连接的连接器

    通过conn.AllRefs;可以找到与之连接的连接器. //连接器连接的连接器 [TransactionAttribute(Autodesk.Revit.Attributes.Transaction ...

  2. Revit 2015 API 的全部变化和新功能

    这里从SDK的文章中摘录出全部的API变化.主要是希望用户用搜索引擎时能找到相关信息: Major changes and renovations to the Revit API APIchange ...

  3. Revit Family API 添加对齐

    没测试成功,留待以后研究. [TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)] ; ; i < nV ...

  4. Revit Family API 添加几何实体

    先创建一个封闭曲线createProfileLShape();再创建实体,这里需要手工画一个参考平面; ; i < nVerts; ++i)        {            Line l ...

  5. Revit Family API 添加类型

    FamilyManager.NewType("");添加新类型,然后设置参数,就是为新类型设置参数. [TransactionAttribute(Autodesk.Revit.At ...

  6. Revit Family API 创建参考平面

    使用API来编辑族时,使用doc.FamilyCreate.NewReferencePlane();创建参考平面. )         {  ];         }         // canno ...

  7. Revit Family API 添加参数与尺寸标注

    使用FamilyManager其他的与普通添加参数与标注没区别. [TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Man ...

  8. Revit API得到类别Category设置类别可见性

    start [Transaction(TransactionMode.Manual)] [Regeneration(RegenerationOption.Manual)] public class c ...

  9. Revit通过API创建共享参数

    Revit共享参数是通过创建一个.txt类型的文件来保存相关信息,一旦与项目保存完毕之后,共享参数也就变成了项目参数(项目参数无法通过API创建),项目参数是保存在Revit项目里面的,所以此时这个. ...

随机推荐

  1. Expression Tree Build

    The structure of Expression Tree is a binary tree to evaluate certain expressions.All leaves of the ...

  2. linux下的usb转串口的使用(修改)【转】

    环境:Ubuntu 10.10 Server minicom是linux下串口通信的软件,它的使用完全依靠键盘的操作,虽然没有“超级终端”那么易用,但是使用习惯之后读者将会体会到它的高效与便利,下面将 ...

  3. 006_mac osx 应用跨屏幕

    一般情况下 mac osx 中一个应用程序只能在一个屏幕上显示,作为从 windows 转过来的用户有点不太习惯,Goolge 后发现还是有解决方案的(虽然不是很好用). 打开 Mac 的系统偏好设置 ...

  4. hashlib和hmac

    hashlib hashlib模块用于加密相关的操作,代替了md5和sha模块,主要提供SHA1,SHA224,SHA256,SHA384,SHA512,MD5算法. #!/usr/bin/env p ...

  5. 数组slice方法

    slice slice(start,end):方法可从已有数组中返回选定的元素,返回一个新数组,包含从start到end(不包含该元素)的数组元素.(不会改变原数组) start参数:必须,规定从何处 ...

  6. net MongoDB安装

    Mongo服务器端下载链接:https://www.mongodb.com/download-center?jmp=nav 客户端查看工具Mongovue工具下载链接:http://pan.baidu ...

  7. [整理] mysql操作

    0.启动mysql(在windows中MySql以服务形式存在,在使用前应确保此服务已经启动) net start mysql 0.5获取版本信息 select version(); 1.root 登 ...

  8. java 异常历史 和观点

    异常起源于PL/1和Mesa之类的系统中. 1.) 不在于编译器是否会强制程序员去处理错误,而是要由一致的,使用异常来报告错误 2.) 不在于什么时候进行检查,而是一定要有检查.

  9. PHP 字符串截取()[]{} 中内容

    $str="你好<我>(爱)[北京]{天安门}"; echo f1($str); //返回你好 echo f2($str); //返回我 echo f3($str); ...

  10. c++ primer 学习杂记1

    读到p483 公有,私有,受保护的继承. 1.关于基类成员在派生类中的访问级别: 1) 无论何种继承方式, 派生类都无法访问基类中的private成员. 2) 派生类可以限制,而不能放松对所继承成员的 ...