PlanarFace.Normal取得向量。IsAlmostEqualTo判断向量是否一致。

// ===============================================================
// helper function: given a solid, find a planar 
//Extrusion实体,给一个实体,给一个方向,找到与此方向一致的面。
// face with the given normal (version 2)
// this is a slightly enhaced version of the previous 
// version and checks if the face is on the given reference plane.
// ===============================================================
PlanarFace findFace(Application app, Extrusion pBox, XYZ normal, ReferencePlane refPlane)
{
    // get the geometry object of the given element
    //
    Options op = new Options();
    op.ComputeReferences = true;
    GeometryObjectArray geomObjs = pBox.get_Geometry(op).Objects;

// loop through the array and find a face with the given normal
    //
    foreach (GeometryObject geomObj in geomObjs)
    {
        if (geomObj is Solid)  // solid is what we are interested in.
        {
            Solid pSolid = geomObj as Solid;
            FaceArray faces = pSolid.Faces;
            foreach (Face pFace in faces)
            {
                PlanarFace pPlanarFace = (PlanarFace)pFace;
                // check to see if they have same normal
                //face.Normal是面的向量。IsAlmostEqualTo();
                if ((pPlanarFace != null) && pPlanarFace.Normal.IsAlmostEqualTo(normal))
                {
                    // additionally, we want to check if the face is on the reference plane
                    //还要判断面是否在参考平面上。
                    XYZ p0 = refPlane.BubbleEnd;//终点?
                    XYZ p1 = refPlane.FreeEnd;//起点?
                    Line pCurve = app.Create.NewLineBound(p0, p1);
                    if (pPlanarFace.Intersect(pCurve) == SetComparisonResult.Subset)//子集
                    {
                        return pPlanarFace; // we found the face
                    }
                }
            }
        }

// will come back later as needed.
        //
        //else if (geomObj is Instance)
        //{
        //}
        //else if (geomObj is Curve)
        //{
        //}
        //else if (geomObj is Mesh)
        //{
        //}
    }

// if we come here, we did not find any.
    return null;
}

url:http://greatverve.cnblogs.com/p/revit-family-api-find-face.html

Revit Family API 找到实体某一方向上的面。相关推荐

  1. Revit Family API 添加几何实体

    先创建一个封闭曲线createProfileLShape(); 再创建实体,这里需要手工画一个参考平面Reference Plane: [TransactionAttribute(Autodesk.R ...

  2. Revit 2015 API 的所有变化和新功能

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

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

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

  4. 使用 ASP.NET Core Razor 页、Web API 和实体框架进行分页和排序

    目录 核心类 数据层 The API Razor页面 如何使用 .NET Core Razor 页.Web API 和实体框架实现分页和排序,以产生良好的性能. 该项目的特点是: 选择页面大小(Pag ...

  5. Revit 2014 发布, Revit 2014 API新功能

    Revit 2014 SDK 下载地址: http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975 Major c ...

  6. 利用免费API找到手机归属地

    这里写自定义目录标题 import requests url = "https://www.iteblog.com/api/mobile.php?mobile=XXXXXX" hd ...

  7. SpringBoot整合Mybatis未打成jar正常运行,打成jar包,TypeAliases配置失败致使mybatis无法找到实体类的问题

    请看这里:https://www.cnblogs.com/Franken-Fran/p/mybatis_typeAliase_error.html

  8. 利用ovito计算某一方向上(例如x方向)上某一种原子的原子密度

    打开ovito-->导入文件-->add modifucation选择Select type(选择需要分析的原子类型)-->add modification下选择Histogram- ...

  9. kd-tree : k近邻查询和范围查询

    作者:DylanFrank(滔滔) 转载请注明出处 http://blog.csdn.net/dylan_frank/article/details/77934272 想象一下我们有如下两个任务: 我 ...

最新文章

  1. Ubuntu SVN安装使用命令
  2. xampp mysql.sock_解决xampp自启动和mysql.sock问题
  3. python绘制三维地形shade(vert_exag)参数_Python的地形三维可视化Matplotlib和gdal使用实例...
  4. Vue el-menu高亮设置及点击菜单项实现路由跳转
  5. p服务器不响应,无法加载资源:服务器响应状态为500
  6. 华为怎么改输入法皮肤_微信和QQ个性键盘皮肤
  7. 使用Server 2008新GPO做驱动器映射
  8. xunit-ICollectionFixture
  9. 【图精】徐克镜头里的十大美人
  10. 怎么调用新建模型里文章的内容_读完这篇文章,再难的建筑模型你都能快速上手...
  11. semantic ui中文文档_一起学Vue:UI框架(element-ui)
  12. 3dmax导出fbx没有贴图_实例讲解ArcGIS 与 3DMax 结合建模
  13. Anylogic学习--------------三维窗口
  14. 程序员如何一键批量下载Iconfont图标
  15. JN5169 Bootload 烧录过程和DIY烧录程序(一)
  16. redis分布式锁实现(以抢红包为例)
  17. 学界 | Ian Goodfellow最新论文:是猫还是狗?不光神经网络识别不了,你也能被忽悠...
  18. 如何用nginx部署静态网站
  19. Ubuntu系统软链接的建立与删除
  20. NVM安装nodejs的方法

热门文章

  1. 发货100全功能网站/绿色版
  2. 各家银行黄金T+D业务比较
  3. asp.net 开发知识小结【转】
  4. 使用 jQuery Mobile 与 HTML5 开发 Web App (一) ——开发原则
  5. CSS3 Media Query 响应式媒体查询
  6. jQuery弹出层登录和全屏注册表单
  7. win 7 或 mac 远程桌面到 ubuntu (ssh)
  8. 腾讯图片处理 Tencent AlloyTeam 2013
  9. Perl 第二章 簡單變量
  10. 浅谈spring--AOP与IOC / DI