IfcOpenShell Python - Calculate Quantities

13»

Comments

  • @steverugi
    Thanks for the tip of using the filter :-) Apart from that the result is unfortunately the same. No new properties or values were added to the selected objects. I have a feeling that something is broken on my side. I'll download a more recent/stable version of the BlenderBIM plugin and try again. I'm currently using version 0.0.240502 onBlender 4.1 (Ubuntu 22.04)

  • @Lars can you share the IFC model?

  • OK. I got a step further. It seems I have to save the imported project to a blend file before the feature starts working. In my first attempt, I only opened the IFC file without saving to a .blend file. Once the .blend file was saved things started working. I managed to create Quantity_sets for a few walls. But not all. Some walls give the following error message:

     File "/.../.config/blender/4.1/scripts/addons/blenderbim/tool/ifc.py", line 211, in execute
        IfcStore.execute_ifc_operator(self, context)
      File "/.../.config/blender/4.1/scripts/addons/blenderbim/bim/ifc.py", line 349, in execute_ifc_operator
        result = getattr(operator, "_execute")(context)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/.../.config/blender/4.1/scripts/addons/blenderbim/bim/module/qto/operator.py", line 198, in _execute
        core.calculate_objects_base_quantities(tool.Ifc, tool.Cost, tool.Qto, QtoCalculator(), selected_objects = context.selected_objects)
      File "/.../.config/blender/4.1/scripts/addons/blenderbim/core/qto.py", line 48, in calculate_objects_base_quantities
        calculate_object_base_quantities(ifc, cost, qto, calculator, obj)
      File "/.../.config/blender/4.1/scripts/addons/blenderbim/core/qto.py", line 66, in calculate_object_base_quantities
        calculated_quantities = qto.get_calculated_object_quantities(calculator, base_quantity_name, obj)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/.../.config/blender/4.1/scripts/addons/blenderbim/tool/qto.py", line 101, in get_calculated_object_quantities
        return {
               ^
      File "/.../.config/blender/4.1/scripts/addons/blenderbim/tool/qto.py", line 105, in <dictcomp>
        and (value := calculator.calculate_quantity(qto_name, quantity_name, obj)) is not None
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/.../.config/blender/4.1/scripts/addons/blenderbim/bim/module/pset/qto_calculator.py", line 65, in calculate_quantity
        value: float = eval(string)
                       ^^^^^^^^^^^^
      File "<string>", line 1, in <module>
      File "/.../.config/blender/4.1/scripts/addons/blenderbim/bim/module/pset/qto_calculator.py", line 799, in get_gross_side_area
        gross_side_area = self.get_lateral_area(obj, exclude_end_areas=True, subtract_openings=False, main_axis="x") / 2
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/.../.config/blender/4.1/scripts/addons/blenderbim/bim/module/pset/qto_calculator.py", line 776, in get_lateral_area
        0 if subtract_openings else self.get_opening_area(obj, angle_z1=angle_z1, angle_z2=angle_z2)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/.../.config/blender/4.1/scripts/addons/blenderbim/bim/module/pset/qto_calculator.py", line 710, in get_opening_area
        if ifc_opening_element.PredefinedType is not None
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/.../.config/blender/4.1/scripts/addons/blenderbim/libs/site/packages/ifcopenshell/entity_instance.py", line 197, in __getattr__
        raise AttributeError(
    AttributeError: entity instance of type 'IFC2X3.IfcOpeningElement' has no attribute 'PredefinedType'
    
  • @Lars it should work also without the blend file but if it works, good to know :-)
    The real problem is because the model is IFC2x3, so that schema hasn't the right Qto PSet..you should update the model i guess... :-)

    steverugi
  • @Massimo Thanks, but I don't think that is the reason. The feature does work for many objects like windows, wall standardcase and slabs it works nicely. For other objects, it gives the error above. It seems to fail more often on complex geometry of elements with holes in them, but there is no clear pattern. When I save the project, the result is correctly written as IfcElementQuantity according to ifc2x3:

    So there must be something else going on. The IFC file I've imported gives no errors when validating using ifcOpenshell (I'm unfortunately not able to share the file)

  • I downloaded the most recent build of blenderBIM (https://github.com/IfcOpenShell/IfcOpenShell/compare/blenderbim-240527...v0.7.0) as there were commit messages related to QTO in the build. One with the title "limit quantity types for each resource based on IFC documentation"
    After a brief test, I found :

    • it's no longer possible to calculate quantiles for the objects that used to work before. Maybe ifc 2x3 no longer is supported? If so why?
    • I no longer get any error messages. Nor any messages saying that ifc2x3 isn't supported.
    • QTO has moved under "Costing and Scheduling" This might make sense from a grouping perspective, but in general I find it cumbersome having to move between tabs just to check if the function did what it was supposed to do. Personally, I would like to see the tools that "do something on selections" in a toolbox that can be visible at the same time as the panel where you see the properties of the selected objects. On the positive side, I can quickly jump between tabs using Ctrl+tab.
  • Short update. Dion told me the QTO feature was in a bit of a flux at the moment. I'll cross my fingers and wait for the next official update. Ifc 2x3 will (still) be supported.

    steverugi
  • Where this model origanates from? Was it IFC4 file downgraded to IFC2X3 or ...?
    As Massimo mentioned above e.g. Qto_WallBaseQuantities was added only in IFC4, therefore there are issues with using it on IFC2X3.

  • @Andrej730 said:
    Where this model origanates from? Was it IFC4 file downgraded to IFC2X3 or ...?
    As Massimo mentioned above e.g. Qto_WallBaseQuantities was added only in IFC4, therefore there are issues with using it on IFC2X3.

    The file mentioned above is an IFC2X3 file with Qto_WallBaseQuantities added from BlenderBIM (using BlenderBIM 0.0.240502). I know IFC2X3 doesn't have built-in Qto support like IFC4. However, it would be great if BlenderBIM could offer a way to improve IFC2X3 quantities by calculating and storing property sets (psets) with IFC4 Qto names and properties, while ensuring compatibility with the IFC2X3 standard as outlined in https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcproductextension/lexical/ifcelementquantity.htm.

  • @Lars said:
    The file mentioned above is an IFC2X3 file with Qto_WallBaseQuantities added from BlenderBIM (using BlenderBIM 0.0.240502).

    But how? Qto_WallBaseQuantities is not available from dropdown list in ifc2x3 as it's not present in ifc2x3 templates.

  • I can't really explain why it happened, but what I did was to open the ifc2x3 file. Save the .blend file. Then select a few objects (walls, slabs and windows) and then click "Calculate All Quantities". The quantities then appeared on the Object Information panel. Finally, I saved the project back to ifc2x3 an opened in notepad++ to inspect. (the screenshot above) This was on BlenderBIM 0.0.240502 while the tool was still on its own tab to the left of the properties panel. The feature worked for some objects and gave an error message for others. (See above)

Sign In or Register to comment.