xBIM 基础16 IFC的空间层次结构
本篇介绍如何从文件中检索空间结构。IFC中的空间结构表示层次结构的嵌套结构,表示项目,站点,建筑物,楼层和空间。如果您查看IFC文档, 您会发现建筑物可以包含楼层以及其他建筑物,楼层可以包含空间以及其他楼层等。此类关系也使用IfcRelAggregates建模, 但如果要查找特定空间结构中包含的元素,则将其建模为 IfcRelContainedInSpatialStructure, 因此它取决于您要查找的内容。下面的示例演示如何使用上述两种关系搜索和遍历数据以获得完整的层次结构。
using System;
using System.Linq;
using Xbim.Ifc;
using Xbim.Ifc4.Interfaces; namespace BasicExamples
{
class SpatialStructureExample
{
public static void Show()
{
const string file = "SampleHouse.ifc"; using (var model = IfcStore.Open(file))
{
var project = model.Instances.FirstOrDefault<IIfcProject>();
PrintHierarchy(project, );
}
} private static void PrintHierarchy(IIfcObjectDefinition o, int level)
{
Console.WriteLine(string.Format("{0}{1} [{2}]", GetIndent(level), o.Name, o.GetType().Name)); // 只有空间元素可以包含建筑元素
var spatialElement = o as IIfcSpatialStructureElement;
if (spatialElement != null)
{
// 使用 IfcRelContainedInSpatialElement 获取包含的元素
var containedElements = spatialElement.ContainsElements.SelectMany(rel => rel.RelatedElements);
foreach (var element in containedElements)
Console.WriteLine(string.Format("{0} ->{1} [{2}]", GetIndent(level), element.Name, element.GetType().Name));
} // 使用 IfcRelAggregares 获取空间结构元素的空间分解
foreach (var item in o.IsDecomposedBy.SelectMany(r => r.RelatedObjects))
PrintHierarchy(item, level +);
} private static string GetIndent(int level)
{
var indent = "";
for (int i = ; i < level; i++)
indent += " ";
return indent;
}
}
}
输出结果如下:
Project Number [IfcProject]
Default [IfcSite]
[IfcBuilding]
Ground Floor [IfcBuildingStorey]
->Basic Wall:Wall-Ext_102Bwk-75Ins-100LBlk-12P: [IfcWall]
->Basic Wall:Wall-Ext_102Bwk-75Ins-100LBlk-12P: [IfcWall]
->Basic Wall:Wall-Ext_102Bwk-75Ins-100LBlk-12P: [IfcWall]
->Curtain Wall:Curtain_Wall-Exterior_Glazing: [IfcCurtainWall]
->Curtain Wall:Curtain_Wall-Exterior_Glazing: [IfcCurtainWall]
->Basic Wall:Wall-Partn_12P-70MStd-12P: [IfcWallStandardCase]
->Basic Wall:Wall-Partn_12P-70MStd-12P: [IfcWallStandardCase]
->Doors_ExtDbl_Flush:1810x2110mm: [IfcDoor]
->Doors_IntSgl:810x2110mm: [IfcDoor]
->Doors_IntSgl:810x2110mm: [IfcDoor]
->Windows_Sgl_Plain:1810x1210mm: [IfcWindow]
->Windows_Sgl_Plain:1810x1210mm: [IfcWindow]
->Windows_Sgl_Plain:1810x1210mm: [IfcWindow]
->Compound Ceiling:Plain: [IfcCovering]
->Compound Ceiling:Plain: [IfcCovering]
->Compound Ceiling:Plain: [IfcCovering]
->Floor:Floor-Grnd-Susp_65Scr-80Ins-100Blk-75PC: [IfcSlab]
->Windows_Sgl_Plain:1810x1210mm: [IfcWindow]
- Living room [IfcSpace]
->Furniture_Table_Dining_w-Chairs_Rectangular:2000x1000x750mm_w-6_Seats: [IfcFurniture]
->Chair - Dining:Chair - Dining: [IfcFurniture]
->Chair - Dining:Chair - Dining: [IfcFurniture]
->Chair - Dining:Chair - Dining: [IfcFurniture]
->Chair - Dining:Chair - Dining: [IfcFurniture]
->Chair - Dining:Chair - Dining: [IfcFurniture]
->Chair - Dining:Chair - Dining: [IfcFurniture]
->Furniture_Couch_Viper:2290x950x340mm: [IfcFurniture]
->Furniture_Chair_Viper:1120x940x350mm: [IfcFurniture]
->Furniture_Chair_Viper:1120x940x350mm: [IfcFurniture]
->Furniture_Table_Coffee_1:1200x550x450mm: [IfcFurniture]
->Furniture_Piano:1370x600x1170mm: [IfcFurniture]
- Bedroom [IfcSpace]
->Furniture_Desk:1525x762mm: [IfcFurniture]
->Furniture_Bed_1:1525x2007x355mm-Queen: [IfcFurniture]
- Entrance hall [IfcSpace]
Roof [IfcBuildingStorey]
->Basic Roof:Roof_Flat-4Felt-150Ins-50Scr-150Conc-12Plr: [IfcRoof]
->Floor:Simple floor: [IfcSlab]
- Roof [IfcSpace]
xBIM 基础16 IFC的空间层次结构的更多相关文章
- xBIM 基础15 IFC导出Excel报表
系列目录 [已更新最新开发文章,点击查看详细] IFC导出Excel空间报表文件 本篇将向您展示从IFC文件读取数据所需的一些概念.它使用IFC4接口,适用于IFC2x3和IFC4型号.要创建 ...
- xBIM 多个IFC文件合并
目录 xBIM 应用与学习 (一) xBIM 应用与学习 (二) xBIM 基本的模型操作 xBIM 日志操作 XBIM 3D 墙壁案例 xBIM 格式之间转换 xBIM 使用Linq 来优化查询 x ...
- [.net 面向对象编程基础] (16) 接口
[.net 面向对象编程基础] (16) 接口 关于“接口”一词,跟我们平常看到的电脑的硬件“接口”意义上是差不多的.拿一台电脑来说,我们从外面,可以看到他的USB接口,COM接口等,那么这些接口的目 ...
- 十六. Python基础(16)--内置函数-2
十六. Python基础(16)--内置函数-2 1 ● 内置函数format() Convert a value to a "formatted" representation. ...
- Java基础16:Java多线程基础最全总结
Java基础16:Java多线程基础最全总结 Java中的线程 Java之父对线程的定义是: 线程是一个独立执行的调用序列,同一个进程的线程在同一时刻共享一些系统资源(比如文件句柄等)也能访问同一个进 ...
- xBIM 基础10 WeXplorer 浏览器检查
系列目录 [已更新最新开发文章,点击查看详细] 在上一篇 <xBIM基础 09 WeXplorer 基本应用> 已经提到,查看器不会在所有浏览器的所有设备上运行.为了操作效率和简单 ...
- Flask基础(16)-->WTForms表单创建和简单验证
Flask基础(16)-->WTForms表单创建和简单验证 前言:使用Flask_WTF需要配置参数SECRET_KEYCSRF_ENABLED是为了CSRF(跨站请求伪造)保护.SECRET ...
- 基础图像处理之混合空间增强——(Java:拉普拉斯锐化、Sobel边缘检测、均值滤波、伽马变换)
相信看过冈萨雷斯第三版数字图像处理的童鞋都知道,里面涉及到了很多的基础图像处理的算法,今天,就专门借用其中一个混合空间增强的案例,来将常见的几种图像处理算法集合起来,看能发生什么样的化学反应 首先,通 ...
- xBIM 基础02 快速入门
系列目录 [已更新最新开发文章,点击查看详细] 一.新建项目 Visual Studio 新建项目.项目创建完成后 Nuget ,项目添加 Xbim.Essentials,那么如果项目需要几何 ...
随机推荐
- POJ 3660 Floyd传递闭包
题意:牛有强弱,给出一些牛的强弱的胜负关系,问可以确定几头牛的排名. 思路: Floyd传递闭包 // by SiriusRen #include <bitset> #include &l ...
- Request.QueryString["id"] 、Request.Params["id"] 的强大
<form> <input type="text" name="id" value="值"> </form&g ...
- 利用jqueryzoom实现图片放大镜效果
在你的页面中包含 jqzoom.css <link rel="stylesheet" href="your_path/jqzoom.css" type=& ...
- Oracle数据库基础(二)
1.表名命名规则:必须以字母开头,不能超过30个字符,不要有Oracle保留字 2.数据类型 字符型: char :2000个字符 定长 效率高 ...
- WCF(一)控制台寄宿
WCF是微软开发的一款通信框架.具有跨平台跨操作系统的特点,所以,WCF一般用于开发第三方接口或者在分布式系统用做数据交互. WCF三要素分别是地址(Address).绑定(Binding).契约(C ...
- (2016北京集训十三)【xsy1531】魔法游戏 - Nim游戏
题解: 好题!我的结论很接近正解了... 把一个数化成二进制,每次至少要拿走一位,最多全拿走,不能不拿.那么这就是一个经典的Nim问题了,子树异或起来就是根节点的答案,随便递推一下就行了. 代码: # ...
- thinkphp queue
composer create-project topthink/think composer require topthink/think-queue php think queue:work -- ...
- [TJOI2015]线性规划
题目:洛谷P3973.BZOJ3996. 题目大意:给你n,参数b[][]和c[](里面的数均>0),要你求一个数组A[](0/1,1表示选择),已知:1. 若同时选择X和Y,获得B[x][y] ...
- 2019-03-19 用SSIS把SQLServer中的数据导出来保存到Excel中
Control FLow 点击空白处,右键打开Variable,配置存储过程 Excel路径 在SQL Server 中新建一个存储过程,用于从数据表提取特定的数据 create proc Prici ...
- 2019-03-19 SQL Server简单存储过程的创建 删除 执行
--创建名为 Get 的有输入参数的存储过程 create proc Get --设置默认值 @TrustId int ='001' as begin select * from [DealStruc ...