mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 21:39:59 +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):
|
def load(cls):
|
||||||
cls.data = {
|
cls.data = {
|
||||||
"schedule_of_rates": cls.schedule_of_rates(),
|
"schedule_of_rates": cls.schedule_of_rates(),
|
||||||
|
"cost_schedules": cls.cost_schedules(),
|
||||||
}
|
}
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
|
|
||||||
@@ -330,6 +331,13 @@ class CostItemRatesData:
|
|||||||
if s.PredefinedType == "SCHEDULEOFRATES"
|
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:
|
class CostItemQuantitiesData:
|
||||||
data = {}
|
data = {}
|
||||||
|
|||||||
@@ -41,11 +41,15 @@ def get_schedule_of_rates(self, context):
|
|||||||
CostItemRatesData.load()
|
CostItemRatesData.load()
|
||||||
return CostItemRatesData.data["schedule_of_rates"]
|
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):
|
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)))
|
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):
|
def get_quantity_types(self, context):
|
||||||
if not CostSchedulesData.is_loaded:
|
if not CostSchedulesData.is_loaded:
|
||||||
CostSchedulesData.load()
|
CostSchedulesData.load()
|
||||||
@@ -264,6 +268,9 @@ class BIMCostProperties(PropertyGroup):
|
|||||||
schedule_of_rates: EnumProperty(
|
schedule_of_rates: EnumProperty(
|
||||||
items=get_schedule_of_rates, name="Schedule Of Rates", update=update_schedule_of_rates
|
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)
|
cost_item_rates: CollectionProperty(name="Cost Item Rates", type=CostItem)
|
||||||
active_cost_item_rate_index: IntProperty(name="Active Cost Rate Index")
|
active_cost_item_rate_index: IntProperty(name="Active Cost Rate Index")
|
||||||
contracted_cost_item_rates: StringProperty(name="Contracted Cost Item Rates", default="[]")
|
contracted_cost_item_rates: StringProperty(name="Contracted Cost Item Rates", default="[]")
|
||||||
|
|||||||
@@ -608,8 +608,8 @@ class BIM_PT_cost_item_rates(Panel):
|
|||||||
return False
|
return False
|
||||||
if not CostSchedulesData.is_loaded:
|
if not CostSchedulesData.is_loaded:
|
||||||
return False
|
return False
|
||||||
if CostSchedulesData.data["is_editing_rates"]:
|
#if CostSchedulesData.data["is_editing_rates"]:
|
||||||
return False
|
# return False
|
||||||
if total_cost_items > 0 and props.active_cost_item_index < total_cost_items:
|
if total_cost_items > 0 and props.active_cost_item_index < total_cost_items:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@@ -617,7 +617,8 @@ class BIM_PT_cost_item_rates(Panel):
|
|||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
self.props = tool.Cost.get_cost_props()
|
self.props = tool.Cost.get_cost_props()
|
||||||
row = self.layout.row(align=True)
|
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):
|
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 = 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]
|
cost_item_rate = self.props.cost_item_rates[self.props.active_cost_item_rate_index]
|
||||||
|
|||||||
Reference in New Issue
Block a user