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,那么如果项目需要几何 ...
随机推荐
- 2017-3-4 leetcode 414 485 495
虽说周末要早起来着,但是日子过得有点奇怪,一不小心就忘掉了... leetcode414 https://leetcode.com/problems/third-maximum-number/?tab ...
- java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getClassLoader")
转自:https://blog.csdn.net/bluecard2008/article/details/80921682?utm_source=blogxgwz0 摘要: 今天在使用jetty做容 ...
- maven的pom.xml配置标签
转自:https://blog.csdn.net/wf787283810/article/details/76188595 <project xmlns="http://maven.a ...
- 没有被广泛采用的box-sizing属性
在标准盒模型下设置的width和height只是内容的宽和高,但在设置了宽和高的情况下若还要设置border.margin.padding等时,会发生溢出的现象,因此需要将盒模型更改. box-siz ...
- C#——单元测试
测试搭建请看:http://www.cnblogs.com/Look_Sun/p/4514732.html 右键不出现Generate Unit Test选项请参考:http://www.jb51.n ...
- mysql学习 1
1.数据库(Database)是按照数据结构来组织.存储和管理数据的仓库 2.RDBMS即关系数据库管理系统(Relational Database Management System)的特点: 1) ...
- 使用Latex写book类型文本的体会
晚上参考中科院上海交大清华北大等学校的模板,终于重新把博一时候没解决的问题解决了.中科院吴老师的CTeX论坛因为维护压力比较大不得不关了,查不到之前的Latex解决答案.经过一下午和一晚上的摸索,忽然 ...
- 一.Windows I/O模型之选择(select)模型
1.选择(select)模型:选择模型:通过一个fd_set集合管理套接字,在满足套接字需求后,通知套接字.让套接字进行工作.避免套接字进入阻塞模式,进行无谓的等待.选择模型的核心的FD_SET集合和 ...
- 关于Android Studio更新后一直Refreshing的解决办法!
今天更新了一下studio一直是这个问题 查了很多资料终于解决了 造成这个问题的原因是要更新的gradle版本和studio安装路径中的gradle版本不一致导致的 把他们改成一致的即可 在这个目录里 ...
- failed to push some refs to 'git@github.com:RocsSun/mytest.git
Git推送到GitHub仓库失败 使用Git将文件推送至GitHub的远程仓库时,报错failed to push some refs to 'git@github.com:RocsSun/mytes ...