@@ -94,8 +94,7 @@ class EnableEditingCostSchedule(bpy.types.Operator):
9494 def execute (self , context ):
9595 self .props = context .scene .BIMCostProperties
9696 self .props .active_cost_schedule_id = self .cost_schedule
97- while len (self .props .cost_schedule_attributes ) > 0 :
98- self .props .cost_schedule_attributes .remove (0 )
97+ self .props .cost_schedule_attributes .clear ()
9998 self .enable_editing_cost_schedule ()
10099 self .props .is_editing = "COST_SCHEDULE"
101100 return {"FINISHED" }
@@ -276,8 +275,7 @@ class EnableEditingCostItem(bpy.types.Operator):
276275
277276 def execute (self , context ):
278277 props = context .scene .BIMCostProperties
279- while len (props .cost_item_attributes ) > 0 :
280- props .cost_item_attributes .remove (0 )
278+ props .cost_item_attributes .clear ()
281279
282280 data = Data .cost_items [self .cost_item ]
283281 blenderbim .bim .helper .import_attributes ("IfcCostItem" , props .cost_item_attributes , data )
@@ -538,8 +536,7 @@ class EnableEditingCostItemQuantity(bpy.types.Operator):
538536
539537 def execute (self , context ):
540538 self .props = context .scene .BIMCostProperties
541- while len (self .props .quantity_attributes ) > 0 :
542- self .props .quantity_attributes .remove (0 )
539+ self .props .quantity_attributes .clear ()
543540 self .props .active_cost_item_quantity_id = self .physical_quantity
544541 data = Data .physical_quantities [self .physical_quantity ]
545542 blenderbim .bim .helper .import_attributes (data ["type" ], self .props .quantity_attributes , data )
@@ -635,8 +632,7 @@ class EnableEditingCostItemValue(bpy.types.Operator):
635632
636633 def execute (self , context ):
637634 self .props = context .scene .BIMCostProperties
638- while len (self .props .cost_value_attributes ) > 0 :
639- self .props .cost_value_attributes .remove (0 )
635+ self .props .cost_value_attributes .clear ()
640636 self .props .active_cost_item_value_id = self .cost_value
641637 data = Data .cost_values [self .cost_value ]
642638
@@ -868,12 +864,9 @@ class LoadCostItemQuantities(bpy.types.Operator):
868864 def execute (self , context ):
869865 self .props = context .scene .BIMCostProperties
870866 self .file = IfcStore .get_file ()
871- while len (self .props .cost_item_products ) > 0 :
872- self .props .cost_item_products .remove (0 )
873- while len (self .props .cost_item_processes ) > 0 :
874- self .props .cost_item_processes .remove (0 )
875- while len (self .props .cost_item_resources ) > 0 :
876- self .props .cost_item_resources .remove (0 )
867+ self .props .cost_item_products .clear ()
868+ self .props .cost_item_processes .clear ()
869+ self .props .cost_item_resources .clear ()
877870 ifc_definition_id = self .props .cost_items [self .props .active_cost_item_index ].ifc_definition_id
878871 for control_id , quantity_ids in Data .cost_items [ifc_definition_id ]["Controls" ].items ():
879872 related_object = self .file .by_id (control_id )
@@ -900,13 +893,10 @@ class LoadCostItemTypes(bpy.types.Operator):
900893 def execute (self , context ):
901894 self .props = context .scene .BIMCostProperties
902895 self .file = IfcStore .get_file ()
903- while len (self .props .cost_item_type_products ) > 0 :
904- self .props .cost_item_type_products .remove (0 )
896+ self .props .cost_item_type_products .clear ()
905897 # TODO implement process and resource types
906- # while len(self.props.cost_item_processes) > 0:
907- # self.props.cost_item_processes.remove(0)
908- # while len(self.props.cost_item_resources) > 0:
909- # self.props.cost_item_resources.remove(0)
898+ # self.props.cost_item_processes.clear()
899+ # self.props.cost_item_resources.clear()
910900 ifc_definition_id = self .props .cost_items [self .props .active_cost_item_index ].ifc_definition_id
911901 for control_id , quantity_ids in Data .cost_items [ifc_definition_id ]["Controls" ].items ():
912902 related_object = self .file .by_id (control_id )
0 commit comments