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, 0);}}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 +1);}private static string GetIndent(int level){var indent = "";for (int i = 0; i < level; i++)indent += "  ";return indent;}}
}

輸出結果如下:

Project Number [IfcProject]Default [IfcSite][IfcBuilding]Ground Floor [IfcBuildingStorey]->Basic Wall:Wall-Ext_102Bwk-75Ins-100LBlk-12P:285330 [IfcWall]->Basic Wall:Wall-Ext_102Bwk-75Ins-100LBlk-12P:285395 [IfcWall]->Basic Wall:Wall-Ext_102Bwk-75Ins-100LBlk-12P:285459 [IfcWall]->Curtain Wall:Curtain_Wall-Exterior_Glazing:285582 [IfcCurtainWall]->Curtain Wall:Curtain_Wall-Exterior_Glazing:285684 [IfcCurtainWall]->Basic Wall:Wall-Partn_12P-70MStd-12P:285792 [IfcWallStandardCase]->Basic Wall:Wall-Partn_12P-70MStd-12P:285846 [IfcWallStandardCase]->Doors_ExtDbl_Flush:1810x2110mm:285860 [IfcDoor]->Doors_IntSgl:810x2110mm:285959 [IfcDoor]->Doors_IntSgl:810x2110mm:285996 [IfcDoor]->Windows_Sgl_Plain:1810x1210mm:286105 [IfcWindow]->Windows_Sgl_Plain:1810x1210mm:286188 [IfcWindow]->Windows_Sgl_Plain:1810x1210mm:286238 [IfcWindow]->Compound Ceiling:Plain:286319 [IfcCovering]->Compound Ceiling:Plain:286329 [IfcCovering]->Compound Ceiling:Plain:286337 [IfcCovering]->Floor:Floor-Grnd-Susp_65Scr-80Ins-100Blk-75PC:286349 [IfcSlab]->Windows_Sgl_Plain:1810x1210mm:287567 [IfcWindow]1 - Living room [IfcSpace]->Furniture_Table_Dining_w-Chairs_Rectangular:2000x1000x750mm_w-6_Seats:289768 [IfcFurniture]->Chair - Dining:Chair - Dining:289769 [IfcFurniture]->Chair - Dining:Chair - Dining:289770 [IfcFurniture]->Chair - Dining:Chair - Dining:289771 [IfcFurniture]->Chair - Dining:Chair - Dining:289772 [IfcFurniture]->Chair - Dining:Chair - Dining:290097 [IfcFurniture]->Chair - Dining:Chair - Dining:290098 [IfcFurniture]->Furniture_Couch_Viper:2290x950x340mm:290852 [IfcFurniture]->Furniture_Chair_Viper:1120x940x350mm:291916 [IfcFurniture]->Furniture_Chair_Viper:1120x940x350mm:292127 [IfcFurniture]->Furniture_Table_Coffee_1:1200x550x450mm:293046 [IfcFurniture]->Furniture_Piano:1370x600x1170mm:293961 [IfcFurniture]2 - Bedroom [IfcSpace]->Furniture_Desk:1525x762mm:287689 [IfcFurniture]->Furniture_Bed_1:1525x2007x355mm-Queen:295878 [IfcFurniture]3 - Entrance hall [IfcSpace]Roof [IfcBuildingStorey]->Basic Roof:Roof_Flat-4Felt-150Ins-50Scr-150Conc-12Plr:286419 [IfcRoof]->Floor:Simple floor:295048 [IfcSlab]4 - Roof [IfcSpace]
系列目錄????【已更新最新開發文章,點擊查看詳細】?

轉載于:https://www.cnblogs.com/SavionZhang/p/10983394.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/247813.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/247813.shtml
英文地址,請注明出處:http://en.pswp.cn/news/247813.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

如何判斷兩個jq對象是同一個對象

如果說要判斷是否同一對象&#xff0c;當然是用 來判斷&#xff0c;但實際上兩個不同的 jQuery 對象可能是對同一個/組 DOM 對象的封裝&#xff0c;這個時候可以用 is 來判斷&#xff0c;比如 var a $(".editor"); var b $(".editor");console.log(a b…

狀態管理工具vuex的基本使用(vuebus的理解)

vuex的展示圖 1. vuex 的基本結構 const store new Vuex.Store({state: {} //相當于 vue結構中的 data getters: {}, // 相當于vue結構中的計算屬性使用actions: {}, // 相當于vue結構中的監聽屬性使用mutations: {},//相當于vue結構中的 methods 方法集合 &#xff08;其中方…

Memcache

前戲 Memcached是一個高性能的分布式內存對象緩存系統&#xff0c;用于動態Web應用以減輕數據庫負載。它通過在內存中緩存數據和對象減少讀取數據庫的次數&#xff0c;從而減小數據庫的壓力&#xff0c;提高動態&#xff0c;數據庫網站的速度。Memcached基于一個存儲 鍵/值對的…

解決Button自動刷新頁面的問題

一、問題 <button class"am-btn am-btn-default am-btn-xs am-text-secondary" data-id"99" data-type1><span class"am-icon-pencil-square-o"></span>修改</button>11 頁面上有這樣一個按鈕&#xff0c;每次點擊這個…

Django.1

Django官方網站&#xff1a;https://www.djangoproject.com/ 使用終端創建Django文件 創建工程 django-admin startproject XXX 創建應用 python manage.py startapp YYY 遷移系統指令&#xff1a; 首先生成遷移文件 python manage.py makemigrations 執行遷移文件 python ma…

vue項目水印添加

import DomSize from wd-domsize-monitor; // 此處為 npm 下載的第三方模塊包 import Api_login from "/assets/api/login" // 此處是用戶信息接口調用var id shuiyinDiv var isInit false let callback function (ele) {DomSize.bind(ele, function () {//水印被…

mybatis傳參

在mybatis的學習中&#xff0c;會發現經常需要傳參&#xff0c;這里以上一節寫的實體類為基礎&#xff0c;當我們要添加一個員工時&#xff0c;需要添加員工的基本信息&#xff0c;以及所屬部門&#xff0c;按照以前的方法&#xff0c;在實體類中&#xff0c;添加部門id屬性&am…

自定義步驟條

展示圖&#xff1a; <template><div classcreateorder><!-- 頂部步驟條 --><div class"createorder_top"><div class"createorder_top_left"><!-- 0 --><span class"createorder_left_set" :class"…

jquery讓頁面滾動到底部

function scrollToEnd(){//滾動到底部var h $(document).height()-$(window).height();$(document).scrollTop(h); }

迭代器

一、定義 1.iterator.(迭代器&#xff09; 2.iterable.&#xff08;可迭代的&#xff09; 一般來說&#xff0c;可以被for循環的就是可以迭代的&#xff0c;迭代器一定可以迭代&#xff0c;但是可迭代的類型不一定是迭代器。 二、說明 1.有__iter__方法&#xff0c;說明可迭代 …

css獲取到指定元素的寬度,在回調返回寬度值

<script type"text/javascript">//獲取到指定元素的寬度&#xff0c;在回調返回寬度值//通過處理這個value&#xff0c;重新設置新的寬度$(.sixth).css("width",function(index,value){//value帶單位&#xff0c;先分解value value.split(px);//返回…

android 文件讀寫

讀取&#xff1a; public static String _getJsonString(String fileName) throws IOException { if ((fileName null) || fileName.isEmpty()) { return ""; } String retString ""; FileInputStream fis null; String state Environment.getExternal…

element組件庫中table自定義分頁效果

1.在data中設置初始值 // 頁數 頁碼search: { offset: 1, // 當前頁limit: 10, // 條數total:0, //總數},2.設置獲取后的數據分配 :data"tableData.slice((search.offset - 1) * search.limit, search.offset * search.limit)" 3.展示效果&#xff1a;

Django信號量

信號 Django中提供了“信號調度”&#xff0c;用于在框架執行操作時解耦。通俗來講&#xff0c;就是一些動作發生的時候&#xff0c;信號允許特定的發送者去提醒一些接受者。 1、Django內置信號 1 Model signals2 pre_init # django的modal執行其構造方…

uni-app 調用接口封裝文檔

1.創建 util 文件夾 &#xff0c;并在文件夾中創建 api.js const BASE_URL http://localhost:8082 // 域名頭 export const myRequest (options)>{return new Promise((resolve,reject)>{uni.request({url:BASE_URLoptions.url,method: options.method || GET,data: …

HTML中INPUT type=date標簽如何賦值注意問題

現在的html5 input標簽支持type"date" 顯示有日期的日歷控件&#xff0c;一行簡單的代碼就能顯示出一個日歷控件&#xff0c;但是有的時候需要給它一個默認的日期值&#xff0c;這個時候可能就要用到val()&#xff0c; attr("value","")等方法&a…

數據輪播圖翻頁封裝(左右點擊)

效果圖&#xff1a; <template><div class"box" style"height:200px;"><!-- 左 --><div class"box-left" click"submitrote(left)" mouseenter"chenge_menu(1)" mouseleave"chenge_menu(2)"…

jquery自動點擊按鈕

jquery自動點擊按鈕$(document).ready(function(){$("#imgcode_img").trigger("click");});

087-把PHP數組中的元素按隨機順序重新排列shuffle

<?php$arrarray(3,23,A,f,123,hello); //定義一個數組echo 排序之前的數組信息&#xff1a;<br>;print_r($arr);shuffle($arr); //對數組進行隨機排序echo <br>排序之后的數組信息&#xff1a;<br>;print_r($arr); //輸出數組信息#…

highcharts圖表高級入門之polar:極地圖的基本配置以及一些關鍵配置說明

highcharts圖表組件內的極地圖polar的實現和效果都還是很簡單和美觀的。 1、需要設置chart的polar屬性為true&#xff1b;以表示是極地圖&#xff1b; 2、其他的設置和普通圖表就沒什么區別了的&#xff0c;這里附上一個完整的示例代碼&#xff1a; highcharts圖表組件內的極地…