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 ...
随机推荐
- 利用gcc自带的功能-fstack-protector检测栈溢出及其实现【转】
转自:https://www.cnblogs.com/leo0000/p/5719186.html 最近又遇到了一个崩溃,栈回溯非常怪异. /lib/i386-linux-gnu/libc.so.6( ...
- 《剑指offer》写一个函数,求两个整数之和,要求在函数体内不得使用+、-、*、/四则运算符号。
弱菜刷题还是刷中文题好了,没必要和英文过不去,现在的重点是基本代码能力的恢复. [题目] 剑指offer 写一个函数,求两个整数之和,要求在函数体内不得使用+.-.*./四则运算符号. [思路] 直觉 ...
- CAS5.2x单点登录(二)cas服务器连接数据库
前面一节应该已经告诉大家如何搭建cas的服务器了,可是搭建好能用吗?我们现在的用户验证是在哪呢?哪个默认的用户名和密码有是在哪呢? 本节就讲一下如何使用cas服务器连接我们自己的用户数据库,毕竟没有哪 ...
- **PHP二维数组遍历时同时赋值
php 二维数组遍历赋值 我个人在项目中的写法: //遍历二维数组foreach($tmp_array as $key => $value){ //动态生成图片的URL $attach_url ...
- PS 切图、抠图
PS切图https://www.cnblogs.com/xiongmanli/p/6079172.html https://tech.youzan.com/cut-boy/?hmsr=toutiao. ...
- HTML5练习4
1.菜单条 主要代码 <!doctype html> <html> <head> <meta charset="utf-8"> &l ...
- centos7 mysql5.7 rpm 安装
卸载MariaDB CentOS7默认安装MariaDB而不是MySQL,而且yum服务器上也移除了MySQL相关的软件包.因为MariaDB和MySQL可能会冲突,故先卸载MariaDB. 查看已安 ...
- SpringBoot的Controller使用
一: 1.注解 2.control注解 3.效果 4.RespomseBody package com.caojun.springboot; import org.springframework.be ...
- python django查询一周,一月,一年时间
首先是当前时间的确定,对于年月日,orm模型都有对应的方法直接查询,周是没有方法直接查询的,我是没有找到这个方法,只能间接的查询 1 2 3 now_time = datetime.datetime. ...
- JavaWeb中Tomcat与Eclipse的集成—步骤详解
前面会简单介绍,下翻Tomcat与Eclipse的集成 一.先介绍一下应用程序的结构: 1.到目前为止应用程序物理结构有两种: C/S——Client / server:这种结构的应用,客户端与服务端 ...