Revit Family API 找到实体某一方向上的面。
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 找到实体某一方向上的面。的更多相关文章
- Revit MEP API找到连接器连接的连接器
通过conn.AllRefs;可以找到与之连接的连接器. //连接器连接的连接器 [TransactionAttribute(Autodesk.Revit.Attributes.Transaction ...
- Revit Family API 添加几何实体
先创建一个封闭曲线createProfileLShape();再创建实体,这里需要手工画一个参考平面; ; i < nVerts; ++i) { Line l ...
- Revit Family API 添加对齐
没测试成功,留待以后研究. [TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)] ; ; i < nV ...
- Revit 2015 API 的全部变化和新功能
这里从SDK的文章中摘录出全部的API变化.主要是希望用户用搜索引擎时能找到相关信息: Major changes and renovations to the Revit API APIchange ...
- Revit Family API 添加类型
FamilyManager.NewType("");添加新类型,然后设置参数,就是为新类型设置参数. [TransactionAttribute(Autodesk.Revit.At ...
- Revit Family API 创建参考平面
使用API来编辑族时,使用doc.FamilyCreate.NewReferencePlane();创建参考平面. ) { ]; } // canno ...
- Revit Family API 添加参数与尺寸标注
使用FamilyManager其他的与普通添加参数与标注没区别. [TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Man ...
- Revit API找到风管穿过的墙(当前文档和链接文档)
start [Transaction(TransactionMode.Manual)] [Regeneration(RegenerationOption.Manual)] public class c ...
- 8.2 使用Fluent API进行实体映射【Code-First系列】
现在,我们来学习怎么使用Fluent API来配置实体. 一.配置默认的数据表Schema Student实体 using System; using System.Collections.Gener ...
随机推荐
- Linux那些事儿之我是Hub(大结局)挂起自动化【转】
转自:http://blog.csdn.net/fudan_abc/article/details/1805471 目睹了当今大学校园的素质流氓化,kiss公开化,消费白领化,上课梦游化,逃课普遍化, ...
- struct termios结构体详解
一.数据成员 termios 函数族提供了一个常规的终端接口,用于控制非同步通信端口. 这个结构包含了至少下列成员:tcflag_t c_iflag; /* 输入模式 */tcflag_t ...
- MongoDB 3.x 安装及权限验证
1.首先在网上下载MongoDB的安装包,我这边使用的是3.2版本: 2.安装MongoDB安装程序,安装完成后设置环境变量,我这边的安装路径是:“C:\Program Files\MongoDB\S ...
- springboot整合Thymeleaf模板引擎
引入依赖 需要引入Spring Boot的Thymeleaf启动器依赖. <dependency> <groupId>org.springframework.boot</ ...
- Python黑魔法
1. 赋值 In [1]: x = 1 ...: y = 21 ...: print x, y ...: ...: x, y = y, x ...: print x, y 1 21 21 1 2. 列 ...
- 使用html+css+js实现弹球游戏
使用html+css+js实现弹球游戏 效果图: 代码如下,复制即可使用: <!doctype html> <head> <style type="text/c ...
- TcxGrid 内容 行高度
- Python3.6安装OpenCV
1.安装依赖 pip install --upgrade setuptools pip install numpy Matplotlib -i https://mirrors.aliyun.com/p ...
- zabbix】问题 Time zone for PHP is not set (configuration parameterdate.timezone)
https://blog.csdn.net/jing875480512/article/details/79002404
- Codeforces 486E LIS of Sequence
LIS of Sequence 我们先找出那些肯定不会再LIS里面. 然后我们从前往后扫一次, 当前位置为 i , 看存不存在一个 j 会在lis上并且a[ j ] > a[ i ], 如果满足 ...