mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
black .
This commit is contained in:
@@ -556,6 +556,7 @@ class ImportCostScheduleCsv(bpy.types.Operator, ImportHelper, tool.Ifc.Operator)
|
|||||||
core.add_csv_filepath(tool.Cost, self.filepath, self.is_schedule_of_rates, cost_schedule)
|
core.add_csv_filepath(tool.Cost, self.filepath, self.is_schedule_of_rates, cost_schedule)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class RefreshCostScheduleCsv(bpy.types.Operator, tool.Ifc.Operator):
|
class RefreshCostScheduleCsv(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
bl_idname = "bim.refresh_cost_schedule_csv"
|
bl_idname = "bim.refresh_cost_schedule_csv"
|
||||||
bl_label = "Refresh Cost Schedule CSV"
|
bl_label = "Refresh Cost Schedule CSV"
|
||||||
@@ -566,6 +567,7 @@ class RefreshCostScheduleCsv(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
core.refresh_cost_schedule_csv(tool.Ifc, tool.Cost)
|
core.refresh_cost_schedule_csv(tool.Ifc, tool.Cost)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class AddCostColumn(bpy.types.Operator):
|
class AddCostColumn(bpy.types.Operator):
|
||||||
bl_idname = "bim.add_cost_column"
|
bl_idname = "bim.add_cost_column"
|
||||||
bl_label = "Add Cost Column"
|
bl_label = "Add Cost Column"
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ class CostItemQuantity(PropertyGroup):
|
|||||||
unit_symbol: str
|
unit_symbol: str
|
||||||
total_cost_quantity: float
|
total_cost_quantity: float
|
||||||
|
|
||||||
|
|
||||||
class CostItemsMapping(PropertyGroup):
|
class CostItemsMapping(PropertyGroup):
|
||||||
cost_item_id: IntProperty(name="cost_item_id")
|
cost_item_id: IntProperty(name="cost_item_id")
|
||||||
csv_filepath: StringProperty(name="filepath")
|
csv_filepath: StringProperty(name="filepath")
|
||||||
@@ -174,6 +175,7 @@ class CostItemsMapping(PropertyGroup):
|
|||||||
cost_item_id: int
|
cost_item_id: int
|
||||||
csv_filepath: str
|
csv_filepath: str
|
||||||
|
|
||||||
|
|
||||||
class CostItemType(PropertyGroup):
|
class CostItemType(PropertyGroup):
|
||||||
name: StringProperty(name="Name")
|
name: StringProperty(name="Name")
|
||||||
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
||||||
|
|||||||
@@ -77,7 +77,14 @@ class BIM_PT_cost_schedules(Panel):
|
|||||||
col.label(text="Linked CSV:")
|
col.label(text="Linked CSV:")
|
||||||
row_1 = col.row(align=True)
|
row_1 = col.row(align=True)
|
||||||
if self.props.active_cost_schedule_id in [item.cost_item_id for item in self.props.cost_schedule_files]:
|
if self.props.active_cost_schedule_id in [item.cost_item_id for item in self.props.cost_schedule_files]:
|
||||||
file = next((item.csv_filepath for item in self.props.cost_schedule_files if item.cost_item_id == self.props.active_cost_schedule_id), None)
|
file = next(
|
||||||
|
(
|
||||||
|
item.csv_filepath
|
||||||
|
for item in self.props.cost_schedule_files
|
||||||
|
if item.cost_item_id == self.props.active_cost_schedule_id
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
)
|
||||||
row_1.label(text=file)
|
row_1.label(text=file)
|
||||||
row_1.operator("bim.refresh_cost_schedule_csv", icon="FILE_REFRESH", text="")
|
row_1.operator("bim.refresh_cost_schedule_csv", icon="FILE_REFRESH", text="")
|
||||||
else:
|
else:
|
||||||
@@ -380,7 +387,7 @@ class BIM_PT_cost_item_types(Panel):
|
|||||||
has_quantity_names = CostProp.get_resource_quantity_names(self, context)
|
has_quantity_names = CostProp.get_resource_quantity_names(self, context)
|
||||||
|
|
||||||
row2 = col.row(align=True)
|
row2 = col.row(align=True)
|
||||||
#row2.label(text="Resources")
|
# row2.label(text="Resources")
|
||||||
total_cost_item_resources = len(self.props.cost_item_resources)
|
total_cost_item_resources = len(self.props.cost_item_resources)
|
||||||
row2.label(text="Resources({})".format(total_cost_item_resources))
|
row2.label(text="Resources({})".format(total_cost_item_resources))
|
||||||
|
|
||||||
|
|||||||
@@ -1502,9 +1502,8 @@ class CreateDrawing(bpy.types.Operator):
|
|||||||
|
|
||||||
def move_elements_to_top(self, root):
|
def move_elements_to_top(self, root):
|
||||||
group = root.find("{http://www.w3.org/2000/svg}g")
|
group = root.find("{http://www.w3.org/2000/svg}g")
|
||||||
bringtofront = ifcopenshell.util.element.get_pset(self.camera_element, "EPset_Drawing", "BringToFront") or ''
|
bringtofront = ifcopenshell.util.element.get_pset(self.camera_element, "EPset_Drawing", "BringToFront") or ""
|
||||||
bringtofront = [item.strip() for item in bringtofront.split(',') if item.strip()]
|
bringtofront = [item.strip() for item in bringtofront.split(",") if item.strip()]
|
||||||
|
|
||||||
|
|
||||||
# Iterate through classes in order of preference
|
# Iterate through classes in order of preference
|
||||||
for class_name in bringtofront:
|
for class_name in bringtofront:
|
||||||
|
|||||||
@@ -312,21 +312,28 @@ def select_cost_schedule_products(
|
|||||||
products = cost.get_cost_schedule_products(cost_schedule)
|
products = cost.get_cost_schedule_products(cost_schedule)
|
||||||
spatial.select_products(products)
|
spatial.select_products(products)
|
||||||
|
|
||||||
def import_cost_schedule_csv(cost: tool.Cost, file_path: str, is_schedule_of_rates: bool) -> ifcopenshell.entity_instance:
|
|
||||||
|
def import_cost_schedule_csv(
|
||||||
|
cost: tool.Cost, file_path: str, is_schedule_of_rates: bool
|
||||||
|
) -> ifcopenshell.entity_instance:
|
||||||
cost_schedule = cost.import_cost_schedule_csv(file_path, is_schedule_of_rates)
|
cost_schedule = cost.import_cost_schedule_csv(file_path, is_schedule_of_rates)
|
||||||
return cost_schedule
|
return cost_schedule
|
||||||
|
|
||||||
|
|
||||||
def add_csv_filepath(cost: tool.Cost, file_path: str, is_schedule_of_rates: bool, cost_schedule) -> None:
|
def add_csv_filepath(cost: tool.Cost, file_path: str, is_schedule_of_rates: bool, cost_schedule) -> None:
|
||||||
cost.add_csv_filepath(file_path, is_schedule_of_rates, cost_schedule)
|
cost.add_csv_filepath(file_path, is_schedule_of_rates, cost_schedule)
|
||||||
|
|
||||||
|
|
||||||
def remove_csv_filepath(cost: tool.Cost, cost_schedule) -> None:
|
def remove_csv_filepath(cost: tool.Cost, cost_schedule) -> None:
|
||||||
cost.remove_csv_filepath(cost_schedule)
|
cost.remove_csv_filepath(cost_schedule)
|
||||||
|
|
||||||
def refresh_cost_schedule_csv(ifc: tool.Ifc, cost:tool.Cost) -> None:
|
|
||||||
|
def refresh_cost_schedule_csv(ifc: tool.Ifc, cost: tool.Cost) -> None:
|
||||||
cost.delete_all_cost_items()
|
cost.delete_all_cost_items()
|
||||||
cost.refresh_cost_schedule_csv()
|
cost.refresh_cost_schedule_csv()
|
||||||
cost.load_cost_schedule_tree()
|
cost.load_cost_schedule_tree()
|
||||||
|
|
||||||
|
|
||||||
def add_cost_column(cost: tool.Cost, name: str) -> None:
|
def add_cost_column(cost: tool.Cost, name: str) -> None:
|
||||||
cost.add_cost_column(name)
|
cost.add_cost_column(name)
|
||||||
|
|
||||||
|
|||||||
@@ -318,8 +318,8 @@ def duplicate_drawing(
|
|||||||
for new_elements in old_to_new.values():
|
for new_elements in old_to_new.values():
|
||||||
# Remove the Blender object, since we haven't actually activated the duplicated drawing
|
# Remove the Blender object, since we haven't actually activated the duplicated drawing
|
||||||
for new_element in new_elements:
|
for new_element in new_elements:
|
||||||
print('new element', new_element)
|
print("new element", new_element)
|
||||||
print('gonna remove', ifc.get_object(new_element))
|
print("gonna remove", ifc.get_object(new_element))
|
||||||
blender.remove_object(ifc.get_object(new_element))
|
blender.remove_object(ifc.get_object(new_element))
|
||||||
new_annotations.extend(new_elements)
|
new_annotations.extend(new_elements)
|
||||||
new_annotation = set(new_annotations)
|
new_annotation = set(new_annotations)
|
||||||
|
|||||||
@@ -561,7 +561,9 @@ class Cost(bonsai.core.tool.Cost):
|
|||||||
return products
|
return products
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_cost_schedule_csv(cls, file_path: Optional[str] = None, is_schedule_of_rates: bool = False) -> ifcopenshell.entity_instance:
|
def import_cost_schedule_csv(
|
||||||
|
cls, file_path: Optional[str] = None, is_schedule_of_rates: bool = False
|
||||||
|
) -> ifcopenshell.entity_instance:
|
||||||
if not file_path:
|
if not file_path:
|
||||||
return
|
return
|
||||||
from ifc5d.csv2ifc import Csv2Ifc
|
from ifc5d.csv2ifc import Csv2Ifc
|
||||||
@@ -574,7 +576,12 @@ class Cost(bonsai.core.tool.Cost):
|
|||||||
return csv2ifc.cost_schedule
|
return csv2ifc.cost_schedule
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def add_csv_filepath(cls, file_path: Optional[str] = None, is_schedule_of_rates: bool = False, cost_schedule: ifcopenshell.entity_instance = None) -> None:
|
def add_csv_filepath(
|
||||||
|
cls,
|
||||||
|
file_path: Optional[str] = None,
|
||||||
|
is_schedule_of_rates: bool = False,
|
||||||
|
cost_schedule: ifcopenshell.entity_instance = None,
|
||||||
|
) -> None:
|
||||||
if not file_path:
|
if not file_path:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -608,7 +615,7 @@ class Cost(bonsai.core.tool.Cost):
|
|||||||
items = ifcopenshell.util.cost.get_root_cost_items(cost_schedule)
|
items = ifcopenshell.util.cost.get_root_cost_items(cost_schedule)
|
||||||
for item in items:
|
for item in items:
|
||||||
cost_item_id = item.id()
|
cost_item_id = item.id()
|
||||||
ifcopenshell.api.run("cost.remove_cost_item", tool.Ifc.get(), cost_item = item)
|
ifcopenshell.api.run("cost.remove_cost_item", tool.Ifc.get(), cost_item=item)
|
||||||
tool.Cost.clean_up_cost_item_tree(cost_item_id)
|
tool.Cost.clean_up_cost_item_tree(cost_item_id)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -617,7 +624,9 @@ class Cost(bonsai.core.tool.Cost):
|
|||||||
|
|
||||||
props = cls.get_cost_props()
|
props = cls.get_cost_props()
|
||||||
cost_schedule_id = props.active_cost_schedule_id
|
cost_schedule_id = props.active_cost_schedule_id
|
||||||
file_path = next((item.csv_filepath for item in props.cost_schedule_files if item.cost_item_id == cost_schedule_id), None)
|
file_path = next(
|
||||||
|
(item.csv_filepath for item in props.cost_schedule_files if item.cost_item_id == cost_schedule_id), None
|
||||||
|
)
|
||||||
if not file_path:
|
if not file_path:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,9 @@ class Drawer:
|
|||||||
# self.svg_settings.set_deflection_tolerance(0.0001)
|
# self.svg_settings.set_deflection_tolerance(0.0001)
|
||||||
self.svg_buffer = ifcopenshell.geom.serializers.buffer()
|
self.svg_buffer = ifcopenshell.geom.serializers.buffer()
|
||||||
self.serialiser_settings = ifcopenshell.geom.serializer_settings()
|
self.serialiser_settings = ifcopenshell.geom.serializer_settings()
|
||||||
self.serialiser = ifcopenshell.geom.serializers.svg(self.svg_buffer, self.svg_settings, self.serialiser_settings)
|
self.serialiser = ifcopenshell.geom.serializers.svg(
|
||||||
|
self.svg_buffer, self.svg_settings, self.serialiser_settings
|
||||||
|
)
|
||||||
self.serialiser.setFile(ifc)
|
self.serialiser.setFile(ifc)
|
||||||
self.serialiser.setWithoutStoreys(True)
|
self.serialiser.setWithoutStoreys(True)
|
||||||
self.serialiser.setPolygonal(True)
|
self.serialiser.setPolygonal(True)
|
||||||
|
|||||||
Reference in New Issue
Block a user