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 ...
随机推荐
- scrapy主动触发关闭爬虫
在spider中时在方法里直接写 self.crawler.engine.close_spider(self, 'cookie失效关闭爬虫') 在pipeline和downloaderMiddle ...
- Cling项目demo实现Android+DLNA实现
dlna多屏互动技术在Android和ios上面应用很广,所以自己为了学习,就官方提供的远吗进行了学习. http://4thline.org/projects/cling 由于是一个maven构建的 ...
- sonarLint--强大的代码审查工具(插件)
idea也有的一个插件 贴上一个eclipse的sonarlint用法 http://blog.csdn.net/limm33/article/details/51166840 不过听说从2015年1 ...
- JQ实现弹幕效果
JQ实现弹幕效果,快来吐糟你的想法吧 效果图: 代码如下,复制即可使用: <!DOCTYPE html> <html> <head> <meta charse ...
- PHP时间戳和日期转换
获取当前时间 <?php var_dump(time()); //获取当前时间戳 int(1502245603) 时间戳转换为时间,可以用date(‘Y-m-s h:i:s’, 具体时间戳来实现 ...
- java 内部类使用 .this 和 .new
如果需要生成对外部类对象的引用,可以使用外部类的名字后面紧跟圆点和this,这样产生的引用自动地具有正确的类型,这一点在编译器就被知晓并受到检查,因此并没有运行时开销 //: innerclasses ...
- PHP获取客户端的IP地址
首先我们来了解相关变量的含义: $_SERVER['REMOTE_ADDR']:浏览当前页面的用户计算机的ip地址 $_SERVER['HTTP_CLIENT_IP']:客户端的ip $_SERVER ...
- Dynamic Rankings || 动态/静态区间第k小(主席树)
JYF大佬说,一星期要写很多篇博客才会有人看 但是我做题没有那么快啊QwQ Part1 写在前面 区间第K小问题一直是主席树经典题=w=今天的重点是动态区间第K小问题.静态问题要求查询一个区间内的第k ...
- js中的prototype原型解析
在典型的面向对象的语言中,如java,都存在类(class)的概念,类就是对象的模板,对象就是类的实例.但是在Javascript语言体系中,是不存在类(Class)的概念的,javascript中不 ...
- Linux下jdk、Tomcat、MySQL的安装
1. 安装JDK 1.上传jdk-7u45-linux-x64.tar.gz到Linux上(使用WinSCP工具) 2.解压jdk到/usr/local目录 tar -zxvf jdk-7u45- ...