mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
See #6570. Now it is possible to assign a cost rate from a non schedule of rate cost schedule
This commit is contained in:
committed by
Massimo Fabbro
parent
242d0ffb3f
commit
12774607f3
@@ -319,6 +319,7 @@ class CostItemRatesData:
|
||||
def load(cls):
|
||||
cls.data = {
|
||||
"schedule_of_rates": cls.schedule_of_rates(),
|
||||
"cost_schedules": cls.cost_schedules(),
|
||||
}
|
||||
cls.is_loaded = True
|
||||
|
||||
@@ -329,6 +330,13 @@ class CostItemRatesData:
|
||||
for s in tool.Ifc.get().by_type("IfcCostSchedule")
|
||||
if s.PredefinedType == "SCHEDULEOFRATES"
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def cost_schedules(cls) -> list[tuple[str, str, str]]:
|
||||
return [
|
||||
(str(s.id()), s.Name or "Unnamed", "")
|
||||
for s in tool.Ifc.get().by_type("IfcCostSchedule")
|
||||
]
|
||||
|
||||
|
||||
class CostItemQuantitiesData:
|
||||
|
||||
@@ -41,11 +41,15 @@ def get_schedule_of_rates(self, context):
|
||||
CostItemRatesData.load()
|
||||
return CostItemRatesData.data["schedule_of_rates"]
|
||||
|
||||
def get_cost_schedules(self, context):
|
||||
if not CostItemRatesData.is_loaded:
|
||||
CostItemRatesData.load()
|
||||
return CostItemRatesData.data["cost_schedules"]
|
||||
|
||||
|
||||
def update_schedule_of_rates(self, context):
|
||||
tool.Cost.load_schedule_of_rates_tree(schedule_of_rates=tool.Ifc.get().by_id(int(self.schedule_of_rates)))
|
||||
|
||||
|
||||
def get_quantity_types(self, context):
|
||||
if not CostSchedulesData.is_loaded:
|
||||
CostSchedulesData.load()
|
||||
@@ -264,6 +268,9 @@ class BIMCostProperties(PropertyGroup):
|
||||
schedule_of_rates: EnumProperty(
|
||||
items=get_schedule_of_rates, name="Schedule Of Rates", update=update_schedule_of_rates
|
||||
)
|
||||
cost_schedules: EnumProperty(
|
||||
items=get_cost_schedules, name="Cost Schedules", update=update_schedule_of_rates
|
||||
)
|
||||
cost_item_rates: CollectionProperty(name="Cost Item Rates", type=CostItem)
|
||||
active_cost_item_rate_index: IntProperty(name="Active Cost Rate Index")
|
||||
contracted_cost_item_rates: StringProperty(name="Contracted Cost Item Rates", default="[]")
|
||||
|
||||
@@ -608,8 +608,8 @@ class BIM_PT_cost_item_rates(Panel):
|
||||
return False
|
||||
if not CostSchedulesData.is_loaded:
|
||||
return False
|
||||
if CostSchedulesData.data["is_editing_rates"]:
|
||||
return False
|
||||
#if CostSchedulesData.data["is_editing_rates"]:
|
||||
# return False
|
||||
if total_cost_items > 0 and props.active_cost_item_index < total_cost_items:
|
||||
return True
|
||||
return False
|
||||
@@ -617,7 +617,8 @@ class BIM_PT_cost_item_rates(Panel):
|
||||
def draw(self, context):
|
||||
self.props = tool.Cost.get_cost_props()
|
||||
row = self.layout.row(align=True)
|
||||
row.prop(self.props, "schedule_of_rates", text="")
|
||||
#row.prop(self.props, "schedule_of_rates", text="")
|
||||
row.prop(self.props, "cost_schedules", text="")
|
||||
if self.props.active_cost_item_rate_index < len(self.props.cost_item_rates):
|
||||
cost_item = self.props.cost_items[self.props.active_cost_item_index]
|
||||
cost_item_rate = self.props.cost_item_rates[self.props.active_cost_item_rate_index]
|
||||
|
||||
Reference in New Issue
Block a user