0

I am currently working on a project to fetch all the details like IfcBuilding, IfcDistributionControlElement etc. from an IFC file stored in Opensource BIMserver. Using the Java client library, I managed to get a list of storeys and print their names.

List<IfcBuildingStorey> storeys = model.getAllWithSubTypes(IfcBuildingStorey.class));
for (IfcBuildingStorey storey : storeys) {
    System.out.println(storey.getName());
}

Current Output:

Level 1
Level 2
Level 3
Level 4

What i want is for each storey, e.g. Level 2, to get all the rooms located in that storey, and then all entities of type IfcProduct, e.g. fire detectors, inside those rooms in a hierarchical way.

Expected Output:

Level 2
  Room 1: entity 1, entity 2, entity 3, entity 4
  Room 2: entity 1, entity 2, entity 3, entity 4
  Room 3: entity 1, entity 2, entity 3, entity 4
hlg
  • 1,321
  • 13
  • 29
Shubham
  • 997
  • 1
  • 9
  • 15
  • Most walls are not inside rooms, but between at least 2 different rooms. After all that is their purpose, to separate one part of space from another part of space. How does that fit into a hierarchical structure? – hlg Oct 30 '18 at 08:37
  • I guess i misguided somehow, what i want to achieve is i need a fire detector from Room 1 and if i give some condition on the fire detector i must be able to highlight the Room 1 in the UI, but to achieve that i need to segregate the data , that is Detector A room one is active ,did you get my point? – Shubham Oct 30 '18 at 08:44
  • Given a set of IfcBuildingStorey entities (e.g. Level 1-4), you want for each storey the rooms (e.g. Room 1-3) in that storey and for each room, all contained entities of type IfcProduct (e.g. fire detector). - Is that your question? The Java code seems irrelevant for that. It is more a question of how things are modelled in the IFC – hlg Oct 30 '18 at 09:01
  • you understood the question correct. Yes this code is how i tried and i know that it is not the right way, can you provide some help? i googled a lot but didn't get any help. – Shubham Oct 30 '18 at 09:08
  • well ! i am able to achieve what i wanted but had to use multiple loops. – Shubham Oct 30 '18 at 11:42

1 Answers1

1

Starting from the list of IfcBuildingStorey entities you would have to work your way through the spatial hierarchy as described in the IFC Documentation. Be aware that you do not necessarily have a simple two-level structure of IfcBuildingStorey and IfcSpace, but the aggregation tree may contain up to three hierarchy levels of storeys as well as of spaces:

  1. groups of storey/space (compositiontype COMPLEX) composed of
  2. storey/space elements (compositionType ELEMENT) composed of
  3. storey/space parts (compositionType PARTIAL).

You reach the respective next lower level via the objectified aggregation relationship:

  • IfcSpatialStrutureElement.IsDecomposedBy
  • IfcRelAggregates.RelatedObjects
  • IfcObjectDefinition

Then hope that the IfcObjectDefinition instance is a spatial structure (it should be, but you never know).

In Java this could look like this:

void traverseSpatialStructure(IfcSpatialStructureElement parent){
  for (IfcRelAggregates aggregation: parent.getIsDecomposedBy()){
    for (IfcObjectDefinition child: aggregation.getRelatedObjects()){
      doSomeThingWith(child); // e.g. print name
      assert child instanceof IfcSpatialStructureElement;
      traverseSpatialStructure((IfcSpatialStructureElement) child);
    }
  }
}

Finally, once you reached the IfcSpace level, use the spatial containment relation to get hold of every product contained in the space:

  • IfcSpatialStructureElement.ContainsElements
  • IfcRelContainedInSpatialStructure.RelatedElements
  • IfcProduct

In Java again:

void doSomethingWith(IfcSpace spatialStructure){
  for(IfcRelContainedInSpatialStructure containment: spatialstructure.getContainsElements()){
    for(IfcProduct product : containment.getRelatedElements()){
      // do something with your product, e.g. fire detector
    }
  }
}
hlg
  • 1,321
  • 13
  • 29
  • yes this is how did it, for reference i used the bimviews plugin to identify the relations, but your explanation was very much needed also the documentation, thanks for the input. – Shubham Oct 31 '18 at 04:37
  • I would always suggest to consult the schema. Figuring something out based on a specific model instance may be a good starting point, but if you stop there, your solution will be limited to input similar to that particular case. – hlg Nov 01 '18 at 14:49
  • Hi @hlg i have a question as i am confused , i have to use the 3D view of BimViews in a Spring-boot application. Should i create a new plugin or can i use the existing plugin(which is in java script) and try to integrate it to the current spring-boot application, or can i achieve the same(3D) using Java? i am confused. As i will have to start JavaScript from the scratch – Shubham Nov 12 '18 at 07:57