-
Notifications
You must be signed in to change notification settings - Fork 179
Closed
Description
@martin1cerny , thanks for the right pointer to hierarchy decomposition through this code in issue #73
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($"{GetIndent(level)}{o.Name} [{o.GetType().Name}]");
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;
}
}
}
Anyway, this does not return the elements under the IfcSpace object.
For e.g, as attached pictures show, the code retireves the ifcSpace object, but it doesn"t get the ifcAirFlowTerminal that resides under that.
I tried on another code to get IfcSpatialStructureElement.getcontaineditems(), which retrieves the elements.
Is there a way to do the same so that your example can retrieve the deeper levels of the tree structure?
You can consider me a noob if iI am missing something very simple/obvious! I need help, please!
Best,
Ani
Metadata
Metadata
Assignees
Labels
No labels