csv to cost schedule - support more cases of 0 quantity #4704

Before - https://i.imgur.com/CYwSGxY.png
After - https://i.imgur.com/Wbe6Ij6.png
I'll attach example .csv and .ifc in #4704

What changed:

1) If query was provided but it didn't found any elements, then it will still autoassign quantity = 0 instead of cost item end up without quantities at all (which has a different meaning in ifc). Works both with Property provided and without it.

2) If provided quantity = 0, it will now load as quantity = 0 instead of not creating any quantities at all.

3) You can provide both Query and Quantity and they all will be added to the cost item. E.g. if Quantity = 15, Query = "IfcWall", Property="Prop" and there are 3 walls in the model each having Prop = 25 then final quantity will be 15+25*3=90. Previously Quantity would take the priority and the result would be just = 15.

Though this is still doesn't work with counting quantities due behaviour in cost.assign_cost_item_quantity.
E.g. if Quantity = 7, Query = "IfcWall", Property="" (to make sure it will just count them) and there are 3 walls in the model then final quantity will be not 7+3=10 but just = 3, as query will take the priority here.
This commit is contained in:
Andrej730
2024-05-22 13:40:22 +05:00
parent 53d02446bf
commit 382e028b90
2 changed files with 23 additions and 9 deletions
@@ -44,6 +44,10 @@ def assign_cost_item_quantity(
cost item and the product, so it is not necessary to use
ifcopenshell.api.control.assign_control.
If cost item has just 1 quantity and it's IfcQuantityCount, API will
assume that quantity is used for counting controlled objects
and it will recalculate the quantity value at the end of the API call.
:param cost_item: The IfcCostItem to assign parametric quantities to
:type cost_item: ifcopenshell.entity_instance
:param products: The IfcObjects to assign parametric quantities to