Open SunilApte opened 2 months ago
When you say subcomponents, do you mean the geometrical parts (often terrain surface in case of IfcSite
), or do you mean semantic breakdown (building(s), level(s), space(s))?
Subcomponents in case of HOOPS is breakdown like buildings and other subcomponents of different Ifc elements. In case of xbim how to achieve above?
You just need to iterate through the aggregation relation recursively.
private static void ExploreDecomposition(IIfcObjectDefinition entity, string indent)
{
Console.WriteLine(indent + entity.Name);
var children = entity.IsDecomposedBy.SelectMany(r => r.RelatedObjects);
indent += " ";
foreach (var child in children)
{
ExploreDecomposition(child, indent);
}
}
var site = model.Instances.FirstOrDefault<IIfcSite>();
ExploreDecomposition(site);
Note: Code is subject to optimisation and refactoring before used in production.
We are currently replacing HOOPS with Xbim. In HOOPS we have following code:
I can get IfcSite using xbim. But how can I get sub components? I can get buildings and spaces from ifcsite. But I need all sub components under site whose type is not building.
How to achieve this?