Search in sources :

Example 1 with IfcSpatialStructureElement

use of org.bimserver.models.ifc2x3tc1.IfcSpatialStructureElement in project BIMserver by opensourceBIM.

the class IfcUtils method getDecompositionAndContainmentRecursive.

public static Set<IfcProduct> getDecompositionAndContainmentRecursive(Set<IfcProduct> result, IfcObjectDefinition parent) {
    for (IfcRelDecomposes ifcRelDecomposes : parent.getIsDecomposedBy()) {
        for (IfcObjectDefinition ifcObjectDefinition : ifcRelDecomposes.getRelatedObjects()) {
            if (ifcObjectDefinition instanceof IfcProduct) {
                result.add((IfcProduct) ifcObjectDefinition);
            }
            getDecompositionAndContainmentRecursive(result, ifcObjectDefinition);
        }
    }
    if (parent instanceof IfcSpatialStructureElement) {
        IfcSpatialStructureElement ifcSpatialStructureElement = (IfcSpatialStructureElement) parent;
        for (IfcRelContainedInSpatialStructure ifcRelContainedInSpatialStructure : ifcSpatialStructureElement.getContainsElements()) {
            for (IfcProduct ifcProduct : ifcRelContainedInSpatialStructure.getRelatedElements()) {
                result.add(ifcProduct);
                getDecompositionAndContainmentRecursive(result, ifcProduct);
            }
        }
    }
    return result;
}
Also used : IfcSpatialStructureElement(org.bimserver.models.ifc2x3tc1.IfcSpatialStructureElement) IfcObjectDefinition(org.bimserver.models.ifc2x3tc1.IfcObjectDefinition) IfcProduct(org.bimserver.models.ifc2x3tc1.IfcProduct) IfcRelContainedInSpatialStructure(org.bimserver.models.ifc2x3tc1.IfcRelContainedInSpatialStructure) IfcRelDecomposes(org.bimserver.models.ifc2x3tc1.IfcRelDecomposes)

Example 2 with IfcSpatialStructureElement

use of org.bimserver.models.ifc2x3tc1.IfcSpatialStructureElement in project BIMserver by opensourceBIM.

the class RichIfcModel method addContains.

public void addContains(IfcSpatialStructureElement parent, IfcProduct... children) throws IfcModelInterfaceException {
    IfcRelContainedInSpatialStructure rel = this.create(IfcRelContainedInSpatialStructure.class);
    rel.setRelatingStructure(parent);
    for (IfcProduct child : children) {
        rel.getRelatedElements().add(child);
    }
}
Also used : IfcRelContainedInSpatialStructure(org.bimserver.models.ifc2x3tc1.IfcRelContainedInSpatialStructure) IfcProduct(org.bimserver.models.ifc2x3tc1.IfcProduct)

Aggregations

IfcProduct (org.bimserver.models.ifc2x3tc1.IfcProduct)2 IfcRelContainedInSpatialStructure (org.bimserver.models.ifc2x3tc1.IfcRelContainedInSpatialStructure)2 IfcObjectDefinition (org.bimserver.models.ifc2x3tc1.IfcObjectDefinition)1 IfcRelDecomposes (org.bimserver.models.ifc2x3tc1.IfcRelDecomposes)1 IfcSpatialStructureElement (org.bimserver.models.ifc2x3tc1.IfcSpatialStructureElement)1