mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
black .
This commit is contained in:
@@ -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,
|
||||||
|
)
|
||||||
|
|||||||
@@ -155,9 +155,9 @@ class CostSchedulesData:
|
|||||||
else:
|
else:
|
||||||
data["TotalCost"] = data["TotalAppliedValue"] * cost_quantity
|
data["TotalCost"] = data["TotalAppliedValue"] * cost_quantity
|
||||||
if is_sum:
|
if is_sum:
|
||||||
pass #If it is None it doesn't allow me to assign a cost rate composed by sum
|
pass # If it is None it doesn't allow me to assign a cost rate composed by sum
|
||||||
#data["TotalAppliedValue"] = None
|
# data["TotalAppliedValue"] = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _load_assigned_cost_rate(cls, cost_item: ifcopenshell.entity_instance, data: CostItem) -> None:
|
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)
|
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")
|
for s in tool.Ifc.get().by_type("IfcCostSchedule")
|
||||||
if s.PredefinedType == "SCHEDULEOFRATES"
|
if s.PredefinedType == "SCHEDULEOFRATES"
|
||||||
]
|
]
|
||||||
|
|
||||||
@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"
|
||||||
@@ -622,9 +623,9 @@ class ShowAssignedCostRate(bpy.types.Operator):
|
|||||||
return wm.invoke_props_dialog(self, width=450)
|
return wm.invoke_props_dialog(self, width=450)
|
||||||
|
|
||||||
def execute(self, context):
|
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"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
wrapper = textwrap.TextWrapper(width=80)
|
wrapper = textwrap.TextWrapper(width=80)
|
||||||
@@ -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),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,13 +39,14 @@ from typing import TYPE_CHECKING, Literal
|
|||||||
def get_schedule_of_rates(self, context):
|
def get_schedule_of_rates(self, context):
|
||||||
if not CostItemRatesData.is_loaded:
|
if not CostItemRatesData.is_loaded:
|
||||||
CostItemRatesData.load()
|
CostItemRatesData.load()
|
||||||
#return CostItemRatesData.data["schedule_of_rates"]
|
# return CostItemRatesData.data["schedule_of_rates"]
|
||||||
return CostItemRatesData.data["cost_schedules"]
|
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()
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ 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
|
||||||
@@ -686,7 +686,7 @@ class BIM_UL_cost_items_trait:
|
|||||||
|
|
||||||
if self.props.change_cost_item_parent:
|
if self.props.change_cost_item_parent:
|
||||||
self.draw_parent_operator(row, item.ifc_definition_id)
|
self.draw_parent_operator(row, item.ifc_definition_id)
|
||||||
|
|
||||||
self.draw_assigned_rate_column(split2, cost_item)
|
self.draw_assigned_rate_column(split2, cost_item)
|
||||||
|
|
||||||
# TODO: reimplement "bim.copy_cost_item_values" somewhere with better UX
|
# 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)
|
layout.label(text=label)
|
||||||
else:
|
else:
|
||||||
layout.label(text="-")
|
layout.label(text="-")
|
||||||
|
|
||||||
def draw_assigned_rate_column(self, layout, cost_item):
|
def draw_assigned_rate_column(self, layout, cost_item):
|
||||||
row=layout.row()
|
row = layout.row()
|
||||||
row.alignment= "LEFT"
|
row.alignment = "LEFT"
|
||||||
if cost_item["AssignedCostRate"] is not None:
|
if cost_item["AssignedCostRate"] is not None:
|
||||||
op = row.operator("bim.show_assigned_cost_rate", text="", emboss=False, icon="ZOOM_IN")
|
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_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="-")
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class MaterialsData:
|
|||||||
cls.data["material_types"] = sorted(cls.material_types(), key=lambda x: x[1].lower())
|
cls.data["material_types"] = sorted(cls.material_types(), key=lambda x: x[1].lower())
|
||||||
cls.data["total_materials"] = cls.total_materials()
|
cls.data["total_materials"] = cls.total_materials()
|
||||||
cls.data["profiles"] = sorted(cls.profiles(), key=lambda x: x[1].lower())
|
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["contexts"] = sorted(cls.contexts(), key=lambda x: x[1].lower())
|
||||||
cls.data["material_styles_data"] = cls.material_styles_data()
|
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(
|
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)
|
||||||
|
|||||||
@@ -441,8 +441,8 @@ class Cost(bonsai.core.tool.Cost):
|
|||||||
|
|
||||||
props = cls.get_cost_props()
|
props = cls.get_cost_props()
|
||||||
props.cost_value_attributes.clear()
|
props.cost_value_attributes.clear()
|
||||||
#is_rates = cls.is_active_schedule_of_rates()
|
# 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 = 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(
|
callback = lambda name, prop, data: import_attributes(
|
||||||
name, prop, data, cost_value, is_rates, props.cost_value_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)
|
converted_tolerance = cls.get_converted_tolerance(tolerance_si=0.03)
|
||||||
poly = poly.buffer(
|
poly = poly.buffer(
|
||||||
converted_tolerance,
|
converted_tolerance,
|
||||||
# single_sided=True,
|
# single_sided=True,
|
||||||
cap_style=shapely.BufferCapStyle.flat,
|
cap_style=shapely.BufferCapStyle.flat,
|
||||||
join_style=shapely.BufferJoinStyle.mitre,
|
join_style=shapely.BufferJoinStyle.mitre,
|
||||||
)
|
)
|
||||||
@@ -977,8 +977,9 @@ class Spatial(bonsai.core.tool.Spatial):
|
|||||||
mat_invert = mat.inverted()
|
mat_invert = mat.inverted()
|
||||||
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]))
|
||||||
|
|||||||
Reference in New Issue
Block a user