Getting surface area of an IFCBUILDINGELEMENTPROXY

56 Views Asked by At

I am trying to get the surface area of all the IFCBUILDINGELEMENTPROXY using ifcopenshell and python. also would be great to know how to get all the physical properties of this element for example coordinates, perimeter, etc. I am at beginners level and would like some direction on this.

import ifcopenshell

# Open the IFC file
ifc_file_path = "/Users/x/Documents/Laakso/LYS_Työmaa_Alueet3D.ifc"
model = ifcopenshell.open(ifc_file_path)

# Find all IfcBuildingElementProxy elements
building_elements = model.by_type("IfcBuildingElementProxy")

for element in building_elements:
    # Initialize the total area for the element
    total_area = 0.0
    
    # Iterate through the representations of the element
    for representation in element.Representation.Representations:
        for item in representation.Items:
            # Check if the item is of type 'IfcExtrudedAreaSolid'
            if item.is_a("IfcExtrudedAreaSolid"):
                # Extract the area and depth of the solid
                area = item.SweptArea.Area
                depth = item.Depth
                
                # Calculate the surface area as area * depth and add it to the total
                total_area += area * depth
    
    # Print the results for each element
    print(f"Element ID: {element.id()}")
    print(f"Total Surface Area: {total_area} sq. meters")


I am expecting a value that will represent the area in m2 however i get 0 as a result.

The areas when loaded into the model look like this for reference.

enter image description here

0

There are 0 best solutions below