mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
black .
This commit is contained in:
@@ -110,4 +110,10 @@ class BIM_UL_bsdd_properties(UIList):
|
||||
if item.pset:
|
||||
row.label(text=item.pset)
|
||||
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,
|
||||
)
|
||||
|
||||
@@ -155,9 +155,9 @@ class CostSchedulesData:
|
||||
else:
|
||||
data["TotalCost"] = data["TotalAppliedValue"] * cost_quantity
|
||||
if is_sum:
|
||||
pass #If it is None it doesn't allow me to assign a cost rate composed by sum
|
||||
#data["TotalAppliedValue"] = None
|
||||
|
||||
pass # If it is None it doesn't allow me to assign a cost rate composed by sum
|
||||
# data["TotalAppliedValue"] = None
|
||||
|
||||
@classmethod
|
||||
def _load_assigned_cost_rate(cls, cost_item: ifcopenshell.entity_instance, data: CostItem) -> None:
|
||||
data["AssignedCostRate"] = tool.Cost.get_assigned_rate_cost_item(cost_item)
|
||||
@@ -330,13 +330,10 @@ 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")
|
||||
]
|
||||
return [(str(s.id()), s.Name or "Unnamed", "") for s in tool.Ifc.get().by_type("IfcCostSchedule")]
|
||||
|
||||
|
||||
class CostItemQuantitiesData:
|
||||
|
||||
@@ -608,6 +608,7 @@ class LoadCostItemQuantities(bpy.types.Operator):
|
||||
core.load_cost_item_quantities(tool.Cost)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class ShowAssignedCostRate(bpy.types.Operator):
|
||||
bl_idname = "bim.show_assigned_cost_rate"
|
||||
bl_label = "Info about the assigned cost item rate"
|
||||
@@ -622,9 +623,9 @@ class ShowAssignedCostRate(bpy.types.Operator):
|
||||
return wm.invoke_props_dialog(self, width=450)
|
||||
|
||||
def execute(self, context):
|
||||
#core.load_cost_item_quantities(tool.Cost) IS IT NECESSARY?
|
||||
# core.load_cost_item_quantities(tool.Cost) IS IT NECESSARY?
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
wrapper = textwrap.TextWrapper(width=80)
|
||||
@@ -689,7 +690,7 @@ class AssignCostValue(bpy.types.Operator, tool.Ifc.Operator):
|
||||
tool.Ifc,
|
||||
tool.Cost,
|
||||
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),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -39,13 +39,14 @@ from typing import TYPE_CHECKING, Literal
|
||||
def get_schedule_of_rates(self, context):
|
||||
if not CostItemRatesData.is_loaded:
|
||||
CostItemRatesData.load()
|
||||
#return CostItemRatesData.data["schedule_of_rates"]
|
||||
# return CostItemRatesData.data["schedule_of_rates"]
|
||||
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()
|
||||
|
||||
@@ -608,7 +608,7 @@ class BIM_PT_cost_item_rates(Panel):
|
||||
return False
|
||||
if not CostSchedulesData.is_loaded:
|
||||
return False
|
||||
#if CostSchedulesData.data["is_editing_rates"]:
|
||||
# if CostSchedulesData.data["is_editing_rates"]:
|
||||
# return False
|
||||
if total_cost_items > 0 and props.active_cost_item_index < total_cost_items:
|
||||
return True
|
||||
@@ -686,7 +686,7 @@ class BIM_UL_cost_items_trait:
|
||||
|
||||
if self.props.change_cost_item_parent:
|
||||
self.draw_parent_operator(row, item.ifc_definition_id)
|
||||
|
||||
|
||||
self.draw_assigned_rate_column(split2, cost_item)
|
||||
|
||||
# TODO: reimplement "bim.copy_cost_item_values" somewhere with better UX
|
||||
@@ -727,16 +727,18 @@ class BIM_UL_cost_items_trait:
|
||||
layout.label(text=label)
|
||||
else:
|
||||
layout.label(text="-")
|
||||
|
||||
|
||||
def draw_assigned_rate_column(self, layout, cost_item):
|
||||
row=layout.row()
|
||||
row.alignment= "LEFT"
|
||||
row = layout.row()
|
||||
row.alignment = "LEFT"
|
||||
if cost_item["AssignedCostRate"] is not None:
|
||||
op = row.operator("bim.show_assigned_cost_rate", text="", emboss=False, icon="ZOOM_IN")
|
||||
op.assigned_rate_id = cost_item["AssignedCostRate"].id()
|
||||
op.assigned_rate_name = cost_item["AssignedCostRate"].Name 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:
|
||||
row.label(text="-")
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class MaterialsData:
|
||||
cls.data["material_types"] = sorted(cls.material_types(), key=lambda x: x[1].lower())
|
||||
cls.data["total_materials"] = cls.total_materials()
|
||||
cls.data["profiles"] = sorted(cls.profiles(), key=lambda x: x[1].lower())
|
||||
cls.data["styles"] = sorted(cls.styles(), key=lambda x: x[1].lower() )
|
||||
cls.data["styles"] = sorted(cls.styles(), key=lambda x: x[1].lower())
|
||||
cls.data["contexts"] = sorted(cls.contexts(), key=lambda x: x[1].lower())
|
||||
cls.data["material_styles_data"] = cls.material_styles_data()
|
||||
|
||||
|
||||
@@ -193,10 +193,7 @@ def load_cost_item_resource_quantities(cost: tool.Cost) -> None:
|
||||
|
||||
|
||||
def assign_cost_value(
|
||||
ifc: tool.Ifc,
|
||||
cost: tool.Cost,
|
||||
cost_item: ifcopenshell.entity_instance,
|
||||
cost_rate: ifcopenshell.entity_instance
|
||||
ifc: tool.Ifc, cost: tool.Cost, cost_item: ifcopenshell.entity_instance, cost_rate: ifcopenshell.entity_instance
|
||||
) -> None:
|
||||
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)
|
||||
|
||||
@@ -441,8 +441,8 @@ class Cost(bonsai.core.tool.Cost):
|
||||
|
||||
props = cls.get_cost_props()
|
||||
props.cost_value_attributes.clear()
|
||||
#is_rates = cls.is_active_schedule_of_rates()
|
||||
is_rates = True #so it is possible to assign a cost item rate that it not only from a Schedule of Rate
|
||||
# is_rates = cls.is_active_schedule_of_rates()
|
||||
is_rates = True # so it is possible to assign a cost item rate that it not only from a Schedule of Rate
|
||||
callback = lambda name, prop, data: import_attributes(
|
||||
name, prop, data, cost_value, is_rates, props.cost_value_attributes
|
||||
)
|
||||
|
||||
@@ -957,7 +957,7 @@ class Spatial(bonsai.core.tool.Spatial):
|
||||
converted_tolerance = cls.get_converted_tolerance(tolerance_si=0.03)
|
||||
poly = poly.buffer(
|
||||
converted_tolerance,
|
||||
# single_sided=True,
|
||||
# single_sided=True,
|
||||
cap_style=shapely.BufferCapStyle.flat,
|
||||
join_style=shapely.BufferJoinStyle.mitre,
|
||||
)
|
||||
@@ -977,8 +977,9 @@ class Spatial(bonsai.core.tool.Spatial):
|
||||
mat_invert = mat.inverted()
|
||||
si_conversion = 1.0 if polygon_is_si else ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
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 shapely.get_exterior_ring(poly).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.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]))
|
||||
|
||||
Reference in New Issue
Block a user