diff --git a/src/blenderbim/blenderbim/bim/module/cost/ui.py b/src/blenderbim/blenderbim/bim/module/cost/ui.py index 072d008e63..8f3b42598d 100644 --- a/src/blenderbim/blenderbim/bim/module/cost/ui.py +++ b/src/blenderbim/blenderbim/bim/module/cost/ui.py @@ -157,7 +157,8 @@ class BIM_PT_cost_schedules(Panel): op.cost_category = self.props.cost_category for cost_value_id in Data.cost_items[self.props.active_cost_item_id]["CostValues"]: - self.draw_readonly_cost_value_ui(self.layout, cost_value_id) + row = self.layout.row(align=True) + self.draw_readonly_cost_value_ui(row, cost_value_id) if self.props.active_cost_item_value_id: box = self.layout.box() @@ -166,42 +167,57 @@ class BIM_PT_cost_schedules(Panel): def draw_readonly_cost_value_ui(self, layout, cost_value_id): cost_value = Data.cost_values[cost_value_id] - row = layout.row(align=True) - row.label(text=str(cost_value["Category"]), icon="DISC") - row.label(text=str(cost_value["AppliedValue"])) + cost_value_label = "{0:.2f}".format(cost_value["AppliedValue"]) + if cost_value["Category"]: + cost_value_label += " ({})".format(cost_value["Category"]) + layout.label(text="", icon="DISC") + self.draw_cost_value_operator_ui(layout, cost_value_id) + layout.label(text=cost_value_label) + + for component_id in cost_value["Components"] or []: + self.draw_readonly_component_cost_value_ui(layout, component_id) + + def draw_readonly_component_cost_value_ui(self, layout, cost_value_id, level=1): + self.draw_cost_value_operator_ui(layout, cost_value_id) + cost_value = Data.cost_values[cost_value_id] + cost_value_label = ">" * level + cost_value_label += "{0:.2f}".format(cost_value["AppliedValue"]) + if cost_value["Category"]: + cost_value_label += " ({})".format(cost_value["Category"]) + layout.label(text=cost_value_label) + + for component_id in cost_value["Components"] or []: + self.draw_readonly_component_cost_value_ui(layout, component_id, level + 1) + + def draw_cost_value_operator_ui(self, layout, cost_value_id): if self.props.active_cost_item_value_id and self.props.active_cost_item_value_id == cost_value_id: - op = row.operator("bim.edit_cost_value", text="", icon="CHECKMARK") + op = layout.operator("bim.edit_cost_value", text="", icon="CHECKMARK") op.cost_value = cost_value_id - op = row.operator("bim.add_cost_value", text="", icon="ADD") + op = layout.operator("bim.add_cost_value", text="", icon="ADD") op.parent = cost_value_id op.cost_type = self.props.cost_types if self.props.cost_types == "CATEGORY": op.cost_category = self.props.cost_category - row.operator("bim.disable_editing_cost_item_value", text="", icon="CANCEL") + layout.operator("bim.disable_editing_cost_item_value", text="", icon="CANCEL") elif self.props.active_cost_item_value_id: - op = row.operator("bim.add_cost_value", text="", icon="ADD") + op = layout.operator("bim.add_cost_value", text="", icon="ADD") op.parent = cost_value_id op.cost_type = self.props.cost_types if self.props.cost_types == "CATEGORY": op.cost_category = self.props.cost_category - op = row.operator("bim.remove_cost_item_value", text="", icon="X") + op = layout.operator("bim.remove_cost_item_value", text="", icon="X") op.cost_value = cost_value_id else: - op = row.operator("bim.enable_editing_cost_item_value", text="", icon="GREASEPENCIL") + op = layout.operator("bim.enable_editing_cost_item_value", text="", icon="GREASEPENCIL") op.cost_value = cost_value_id - op = row.operator("bim.add_cost_value", text="", icon="ADD") + op = layout.operator("bim.add_cost_value", text="", icon="ADD") op.parent = cost_value_id op.cost_type = self.props.cost_types if self.props.cost_types == "CATEGORY": op.cost_category = self.props.cost_category - op = row.operator("bim.remove_cost_item_value", text="", icon="X") + op = layout.operator("bim.remove_cost_item_value", text="", icon="X") op.cost_value = cost_value_id - if len(cost_value["Components"]): - box = layout.box() - for component_id in cost_value["Components"]: - self.draw_readonly_cost_value_ui(box, component_id) - def draw_editable_cost_value_ui(self, layout, cost_value): for attribute in self.props.cost_value_attributes: row = layout.row(align=True) @@ -226,6 +242,7 @@ class BIM_UL_cost_items(UIList): props = context.scene.BIMCostProperties cost_item = Data.cost_items[item.ifc_definition_id] row = layout.row(align=True) + for i in range(0, item.level_index): row.label(text="", icon="BLANK1") if item.has_children: @@ -239,17 +256,18 @@ class BIM_UL_cost_items(UIList): ).cost_item = item.ifc_definition_id else: row.label(text="", icon="DOT") - row.prop(item, "name", emboss=False, text="") - row.label(text="M3") + split1 = row.split(factor=0.7) + split1.prop(item, "name", emboss=False, text="") + op = row.operator("bim.enable_editing_cost_item_quantities", text="", icon="PROPERTIES") op.cost_item = item.ifc_definition_id - row.label(text=str(cost_item["TotalCostQuantity"])) + row.label(text=str("{0:.2f}".format(cost_item["TotalCostQuantity"])) + " (M3)") op = row.operator("bim.enable_editing_cost_item_values", text="", icon="DISC") op.cost_item = item.ifc_definition_id - row.label(text=str(cost_item["TotalAppliedValue"])) - row.label(text=str(cost_item["TotalCostValue"]), icon="CON_TRANSLIKE") + row.label(text=str("{0:.2f}".format(cost_item["TotalAppliedValue"]))) + row.label(text=str("{0:.2f}".format(cost_item["TotalCostValue"])), icon="CON_TRANSLIKE") if context.active_object: oprops = context.active_object.BIMObjectProperties diff --git a/src/blenderbim/blenderbim/bim/module/pset/ui.py b/src/blenderbim/blenderbim/bim/module/pset/ui.py index fd63268a90..ff1ea46e5c 100644 --- a/src/blenderbim/blenderbim/bim/module/pset/ui.py +++ b/src/blenderbim/blenderbim/bim/module/pset/ui.py @@ -31,7 +31,7 @@ def draw_psetqto_ui(context, pset_id, pset, props, layout, obj_type): op = row.operator("bim.edit_pset", icon="CHECKMARK", text="") op.obj = context.active_object.name if obj_type == "Object" else context.active_object.active_material.name op.obj_type = obj_type - op = row.operator("bim.disable_pset_editing", icon="X", text="") + op = row.operator("bim.disable_pset_editing", icon="CANCEL", text="") op.obj = context.active_object.name if obj_type == "Object" else context.active_object.active_material.name op.obj_type = obj_type if pset["is_expanded"]: diff --git a/src/ifcopenshell-python/ifcopenshell/util/element.py b/src/ifcopenshell-python/ifcopenshell/util/element.py index df8c72cd92..dbe28a0bb3 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/element.py +++ b/src/ifcopenshell-python/ifcopenshell/util/element.py @@ -154,6 +154,7 @@ def copy_deep(ifc_file, element): if isinstance(attribute, ifcopenshell.entity_instance): attribute = copy_deep(ifc_file, attribute) elif isinstance(attribute, tuple) and attribute and isinstance(attribute[0], ifcopenshell.entity_instance): + attribute = list(attribute) for j, item in enumerate(attribute): attribute[j] = copy_deep(ifc_file, item) new[i] = attribute