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 MEP API找到连接器连接的连接器

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

  2. Revit Family API 添加几何实体

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

  3. Revit Family API 添加对齐

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

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

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

  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找到风管穿过的墙(当前文档和链接文档)

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

  9. 8.2 使用Fluent API进行实体映射【Code-First系列】

    现在,我们来学习怎么使用Fluent API来配置实体. 一.配置默认的数据表Schema Student实体 using System; using System.Collections.Gener ...

随机推荐

  1. 使用Cobbler批量部署Linux和Windows:CentOS/Ubuntu批量安装(二)

    通过前面服务端的部署,已经配置好了 Cobbler Server 端,接下来开始进行 CentOS/Ubuntu 的批量安装,在进行 CentOS/Ubuntu 批量安装时,也需要通过Cobbler来 ...

  2. python3之模块psutil系统性能信息

    psutil是个跨平台库,能够轻松实现获取系统运行的进程和系统利用率,包括CPU.内存.磁盘.网络等信息. 它主要应用于信息监控,分析和限制系统资源及进程的管理.它实现了同等命令命令行工具提供的功能, ...

  3. apropos找命令助手

    apropos (意即"关于")能够搜索 Linux 帮助文档来帮你找到你想要的命令.比如说,你不记得你用的发行版用的什么防火墙工具了.你可以输入 apropos "fi ...

  4. 如何提升mysql replication的性能&amp;多线程传输二进制日志

    1,最好使用内网或者专线链路传输binlog数据 (千兆网卡.还不够的话,bounding 技术,扩展带宽) 在my.cnf中强制使用内网ip传输数据bind-address=ip2,将二进制保存在独 ...

  5. 【linux kernel】 中断处理-中断上半部【转】

    转自:http://www.cnblogs.com/embedded-tzp/p/4451354.html 欢迎转载,转载时需保留作者信息,谢谢. 邮箱:tangzhongp@163.com 博客园地 ...

  6. 使用Eclipse Memory Analyzer分析Tomcat内存溢出

    前言 在平时开发.测试过程中.甚至是生产环境中,有时会遇到OutOfMemoryError,Java堆溢出了,这表明程序有严重的问题.我们需要找造成OutOfMemoryError原因.一般有两种情况 ...

  7. Linux挂载qcow2格式的镜像

    qcow2格式的镜像一般用于KVM/QEMU的hypervisor,当我们需要修改guest host内的一些配置而又不想启动VM时则可以通过挂载guest host进行修改. 需要安装的工具包: l ...

  8. 3种高效的Tags标签系统数据库设计方案分享

    需求背景 目前主流的博客系统.CMS都会有一个TAG标签系统,不仅可以让内容链接的结构化增强,而且可以让文章根据Tag来区分.相比传统老式的Keyword模式,这种Tag模式可以单独的设计一个Map的 ...

  9. SpringMVC介绍及参数绑定

    本节内容: SpringMVC介绍 入门程序 SpringMVC架构 SpringMVC整合MyBatis 参数绑定 SpringMVC和Struts2的区别 一.SpringMVC介绍 1. 什么是 ...

  10. VSCode配置简单的vue项目

    VSCode配置简单的vue项目 https://www.cnblogs.com/wnxyz8023/p/9989447.html 由于最近要使用的项目框架为前后端分离的,采用的是vue.js+web ...