この導入はどのようにファイルから空間構造を取得します。IFC空間構造は、プロジェクト、サイト、建物、および床面積を表す入れ子構造の階層を表します。あなたが見ればIFCの文書、 あなたは床や他の建物、フロアスペースを含むことができ、建物を見つけることができます、というように他の階とを含有することができます。このような関係も使用IfcRelAggregatesのモデリングをしていますが、特定の空間構造要素が含ま検索したい場合は、それは次のようにモデル化され IfcRelContainedInSpatialStructure、 それはあなたが探しているものに依存します。次の例では、これらの2つの関係を使用して、完全な階層を取得するためにデータを検索する方法を示します。
使用してシステムを。 使用してSystem.Linqのを。 使用してXbim.Ifcを。 使用してXbim.Ifc4.Interfacesを。 名前空間BasicExamples { クラスSpatialStructureExample { 公共 静的 ボイドショー() { constの 文字列ファイル= " SampleHouse.ifc " 。 使用(VARのモデル= IfcStore.Open(ファイル)) { VARのプロジェクト= model.Instances.FirstOrDefault <IIfcProject> (); PrintHierarchy(プロジェクト、0 ); } } プライベート 静的 ボイド PrintHierarchy(IIfcObjectDefinition O、INTのレベル) { Console.WriteLineを(文字列 .Format(" {0}}。1 - {[{2}] " 、getIndent(レベル)、o.name、o.GetType() .nameの)); // のみ空間要素は、建築要素含みうる するvar = O spatialElementをAS IIfcSpatialStructureElement; IFは!(spatialElement = NULL ) { // IfcRelContainedInSpatialElementを使用する要素が含まれている取得 するvar containedElements = spatialElement.ContainsElements.SelectMany(REL =>rel.RelatedElements); foreachの(VARの要素でcontainedElements) Console.WriteLineを(文字列 .Format("{0} - > {} 1 [{2}] " 、getIndent(レベル)、element.name、element.GetType() .nameの)); } // 使用IfcRelAggregares空間分解空間構造要素を得る のforeach(VARのアイテムに o.IsDecomposedBy.SelectMany(R&LT => r.RelatedObjects))を PrintHierarchy(項目、レベル + 1 ); } プライベート 静的 文字列 getIndent (INTのレベル) { VARのインデント= "" ; 以下のために(int型 i = 0 ; iは、レベルを<; iは++ ) インデント + = " " ; リターンインデント。 } } }
出力:
プロジェクト番号は、[IfcProject] デフォルト[IfcSite] [IfcBuilding] 階は[IfcBuildingStorey] - >基本ウォール:壁Ext_102Bwk-75Ins-100LBlk-12P:285330 [IfcWall] - >基本ウォール:壁Ext_102Bwk-75Ins-100LBlk-12P :285395 [IfcWall] - >基本ウォール:壁Ext_102Bwk-75Ins-100LBlk-12P:285459 [IfcWall] - >カーテンウォール:Curtain_Wall-Exterior_Glazing:285582 [IfcCurtainWall] - >カーテンウォール:Curtain_Wall-Exterior_Glazing:285684 [IfcCurtainWall] - >基本ウォール:壁Partn_12P-70MStd-12P:285792 [IfcWallStandardCase] - >基本ウォール:壁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] - >化合物天井:プレーン:286319 [IfcCovering] - >化合物天井:プレーン:286329[IfcCovering] - > [複合天井:平野:286337 [IfcCovering] - >床:床GRND-Susp_65Scr-80Ins-100Blk-75PC:286349 [IfcSlab] - > Windows_Sgl_Plain:1810x1210mm:287567 [IfcWindow] 1 - リビングルーム[IfcSpace ] - > Furniture_Table_Dining_w-Chairs_Rectangular:2000x1000x750mm_w-6_Seats:289768 [IfcFurniture] - >椅子-ダイニング:チェア-ダイニング:289769 [IfcFurniture] - >椅子-ダイニング:チェア-ダイニング:289770 [IfcFurniture] - >椅子-ダイニング:チェア-ダイニング:289771【IfcFurniture] - >椅子-ダイニング:チェア-ダイニング:289772 [IfcFurniture] - >椅子-ダイニング:チェア-ダイニング:290097 [IfcFurniture] - >椅子-ダイニング:チェア-ダイニング: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 - ベッドルーム[IfcSpace] - > Furniture_Desk:1525x762mm:287689 [IfcFurniture] - > Furniture_Bed_1:1525x2007x355mm-女王:295878 [IfcFurniture] 3 - エントランスホール[IfcSpace] 屋根[IfcBuildingStorey] - >基本屋根:Roof_Flat- 4Felt-150Ins-50Scr-150Conc-12Plr:286419 [IfcRoof] - >床:単純床:295048 [IfcSlab] 4 -ルーフ[IfcSpace]
参考:http://docs.xbim.net/examples/spatial-hierarchy.html
2019年6月5日