This commit is contained in:
Andrej
2025-05-27 12:55:09 +05:00
parent 6b77147d45
commit ceeb7ca355
9 changed files with 34 additions and 29 deletions
+7 -1
View File
@@ -110,4 +110,10 @@ class BIM_UL_bsdd_properties(UIList):
if item.pset: if item.pset:
row.label(text=item.pset) row.label(text=item.pset)
row.operator("bim.open_uri", text="", icon="URL").uri = item.uri row.operator("bim.open_uri", text="", icon="URL").uri = item.uri
row.prop(item, "is_selected", icon="CHECKBOX_HLT" if item.is_selected else "CHECKBOX_DEHLT", text="", emboss=False) row.prop(
item,
"is_selected",
icon="CHECKBOX_HLT" if item.is_selected else "CHECKBOX_DEHLT",
text="",
emboss=False,
)
+1 -4
View File
@@ -333,10 +333,7 @@ class CostItemRatesData:
@classmethod @classmethod
def cost_schedules(cls) -> list[tuple[str, str, str]]: def cost_schedules(cls) -> list[tuple[str, str, str]]:
return [ return [(str(s.id()), s.Name or "Unnamed", "") for s in tool.Ifc.get().by_type("IfcCostSchedule")]
(str(s.id()), s.Name or "Unnamed", "")
for s in tool.Ifc.get().by_type("IfcCostSchedule")
]
class CostItemQuantitiesData: class CostItemQuantitiesData:
@@ -608,6 +608,7 @@ class LoadCostItemQuantities(bpy.types.Operator):
core.load_cost_item_quantities(tool.Cost) core.load_cost_item_quantities(tool.Cost)
return {"FINISHED"} return {"FINISHED"}
class ShowAssignedCostRate(bpy.types.Operator): class ShowAssignedCostRate(bpy.types.Operator):
bl_idname = "bim.show_assigned_cost_rate" bl_idname = "bim.show_assigned_cost_rate"
bl_label = "Info about the assigned cost item rate" bl_label = "Info about the assigned cost item rate"
@@ -689,7 +690,7 @@ class AssignCostValue(bpy.types.Operator, tool.Ifc.Operator):
tool.Ifc, tool.Ifc,
tool.Cost, tool.Cost,
cost_item=tool.Ifc.get().by_id(self.cost_item), cost_item=tool.Ifc.get().by_id(self.cost_item),
cost_rate=tool.Ifc.get().by_id(self.cost_rate) cost_rate=tool.Ifc.get().by_id(self.cost_rate),
) )
@@ -46,6 +46,7 @@ def get_schedule_of_rates(self, context):
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()
+3 -1
View File
@@ -736,7 +736,9 @@ class BIM_UL_cost_items_trait:
op.assigned_rate_id = cost_item["AssignedCostRate"].id() op.assigned_rate_id = cost_item["AssignedCostRate"].id()
op.assigned_rate_name = cost_item["AssignedCostRate"].Name or "" op.assigned_rate_name = cost_item["AssignedCostRate"].Name or ""
op.assigned_rate_description = cost_item["AssignedCostRate"].Description or "" op.assigned_rate_description = cost_item["AssignedCostRate"].Description or ""
op.assigned_rate_total_value = CostSchedulesData.data["cost_items"][cost_item["AssignedCostRate"].id()]["TotalAppliedValue"] op.assigned_rate_total_value = CostSchedulesData.data["cost_items"][cost_item["AssignedCostRate"].id()][
"TotalAppliedValue"
]
else: else:
row.label(text="-") row.label(text="-")
+1 -4
View File
@@ -193,10 +193,7 @@ def load_cost_item_resource_quantities(cost: tool.Cost) -> None:
def assign_cost_value( def assign_cost_value(
ifc: tool.Ifc, ifc: tool.Ifc, cost: tool.Cost, cost_item: ifcopenshell.entity_instance, cost_rate: ifcopenshell.entity_instance
cost: tool.Cost,
cost_item: ifcopenshell.entity_instance,
cost_rate: ifcopenshell.entity_instance
) -> None: ) -> None:
ifc.run("cost.assign_cost_value", cost_item=cost_item, cost_rate=cost_rate) ifc.run("cost.assign_cost_value", cost_item=cost_item, cost_rate=cost_rate)
existing_cost_rate = cost.get_assigned_rate_cost_item(cost_item) existing_cost_rate = cost.get_assigned_rate_cost_item(cost_item)
+2 -1
View File
@@ -978,7 +978,8 @@ class Spatial(bonsai.core.tool.Spatial):
si_conversion = 1.0 if polygon_is_si else ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) si_conversion = 1.0 if polygon_is_si else ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
new_verts = [ new_verts = [
# bm.verts.new(mat_invert @ (Vector([v[0], v[1], 0]) * si_conversion)) for v in poly.exterior.coords[0:-1] # bm.verts.new(mat_invert @ (Vector([v[0], v[1], 0]) * si_conversion)) for v in poly.exterior.coords[0:-1]
bm.verts.new(mat_invert @ (Vector([v[0], v[1], 0]) * si_conversion)) for v in shapely.get_exterior_ring(poly).coords[0:-1] bm.verts.new(mat_invert @ (Vector([v[0], v[1], 0]) * si_conversion))
for v in shapely.get_exterior_ring(poly).coords[0:-1]
] ]
[bm.edges.new((new_verts[i], new_verts[i + 1])) for i in range(len(new_verts) - 1)] [bm.edges.new((new_verts[i], new_verts[i + 1])) for i in range(len(new_verts) - 1)]
bm.edges.new((new_verts[len(new_verts) - 1], new_verts[0])) bm.edges.new((new_verts[len(new_verts) - 1], new_verts[0]))