mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Remove add grid in add menu, and run black
This commit is contained in:
@@ -280,8 +280,7 @@ class CostSchedulesData:
|
||||
@classmethod
|
||||
def get_cost_schedule_types(cls):
|
||||
types = ifcopenshell.util.cost.get_cost_schedule_types(tool.Ifc.get())
|
||||
return [(t['name'], t['name'], t['description']) for t in types]
|
||||
|
||||
return [(t["name"], t["name"], t["description"]) for t in types]
|
||||
|
||||
|
||||
class CostItemRatesData:
|
||||
|
||||
@@ -652,7 +652,6 @@ def add_menu(self, context):
|
||||
def add_mesh_object_menu(self, context):
|
||||
if context.mode == "OBJECT":
|
||||
self.layout.separator()
|
||||
self.layout.operator("mesh.add_grid", icon_value=bonsai.bim.icons["IFC"].icon_id)
|
||||
self.layout.operator("mesh.add_stair", icon_value=bonsai.bim.icons["IFC"].icon_id, text="Stair (Untyped)")
|
||||
self.layout.operator("mesh.add_window", icon_value=bonsai.bim.icons["IFC"].icon_id, text="Window (Untyped)")
|
||||
self.layout.operator("mesh.add_door", icon_value=bonsai.bim.icons["IFC"].icon_id, text="Door (Untyped)")
|
||||
|
||||
@@ -89,7 +89,6 @@ class GridDecorator:
|
||||
blf.position(font_id, coords_2d[0], coords_2d[1], 0)
|
||||
blf.draw(font_id, tag)
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
self.addon_prefs = tool.Blender.get_addon_preferences()
|
||||
selected_elements_color = self.addon_prefs.decorator_color_selected
|
||||
|
||||
@@ -115,6 +115,7 @@ def update_spatial_is_locked(self, context):
|
||||
else:
|
||||
tool.Geometry.unlock_object(obj)
|
||||
|
||||
|
||||
def poll_container_obj(self, obj):
|
||||
return obj is None or tool.Ifc.get_entity(obj)
|
||||
|
||||
|
||||
@@ -108,7 +108,6 @@ class BIM_PT_spatial_decomposition(Panel):
|
||||
icon = "VIEW_LOCKED" if context.scene.BIMSpatialDecompositionProperties.is_locked else "VIEW_UNLOCKED"
|
||||
row.prop(context.scene.BIMSpatialDecompositionProperties, "is_locked", text="", icon=icon)
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
if not SpatialDecompositionData.is_loaded:
|
||||
SpatialDecompositionData.load()
|
||||
|
||||
@@ -344,24 +344,23 @@ class Web(bonsai.core.tool.Web):
|
||||
"""
|
||||
ifc_file = tool.Ifc.get()
|
||||
if operator_data["type"] == "getPredefinedTypes":
|
||||
print('getting predefined types')
|
||||
print("getting predefined types")
|
||||
predefined_types = ifcopenshell.util.cost.get_cost_schedule_types(ifc_file)
|
||||
cls.send_webui_data(data=predefined_types, data_key="predefined_types", event="predefined_types")
|
||||
if operator_data["type"] == "addCostSchedule":
|
||||
bonsai.core.cost.add_cost_schedule(
|
||||
tool.Ifc,
|
||||
name=operator_data["name"],
|
||||
predefined_type=operator_data["type"]
|
||||
)
|
||||
tool.Ifc, name=operator_data["name"], predefined_type=operator_data["type"]
|
||||
)
|
||||
cost_schedules = ifc_file.by_type("IfcCostSchedule")
|
||||
cost_schedules_json = [cs.get_info(recursive=True) for cs in cost_schedules]
|
||||
currency = tool.Cost.currency()
|
||||
cls.send_webui_data(data={
|
||||
"cost_schedules": cost_schedules_json,
|
||||
"currency": currency
|
||||
}, data_key="cost_schedules", event="cost_schedules")
|
||||
cls.send_webui_data(
|
||||
data={"cost_schedules": cost_schedules_json, "currency": currency},
|
||||
data_key="cost_schedules",
|
||||
event="cost_schedules",
|
||||
)
|
||||
if operator_data["type"] == "getCostSchedules":
|
||||
print('getting cost schedules')
|
||||
print("getting cost schedules")
|
||||
cost_schedules = ifc_file.by_type("IfcCostSchedule")
|
||||
cost_schedules_json = [cs.get_info(recursive=True) for cs in cost_schedules]
|
||||
currency = tool.Cost.currency()
|
||||
@@ -371,22 +370,18 @@ class Web(bonsai.core.tool.Web):
|
||||
event="cost_schedules",
|
||||
)
|
||||
if operator_data["type"] == "loadCostSchedule":
|
||||
print('loading cost schedule')
|
||||
print("loading cost schedule")
|
||||
cost_schedule = ifc_file.by_id(operator_data["costScheduleId"])
|
||||
bonsai.core.cost.enable_editing_cost_items(tool.Cost, cost_schedule=cost_schedule)
|
||||
cls.load_cost_schedule_web_ui(cost_schedule)
|
||||
if operator_data["type"] == "selectAssignedElements":
|
||||
print('selecting assigned elements')
|
||||
print("selecting assigned elements")
|
||||
cost_item = tool.Ifc.get().by_id(operator_data["costItemId"])
|
||||
products = tool.Cost.get_cost_item_products(cost_item, is_deep=True)
|
||||
tool.Spatial.select_products(products, unhide=True)
|
||||
if operator_data["type"] == "addSummaryCostItem":
|
||||
cost_schedule=ifc_file.by_id(operator_data["costScheduleId"])
|
||||
bonsai.core.cost.add_summary_cost_item(
|
||||
tool.Ifc,
|
||||
tool.Cost,
|
||||
cost_schedule=cost_schedule
|
||||
)
|
||||
cost_schedule = ifc_file.by_id(operator_data["costScheduleId"])
|
||||
bonsai.core.cost.add_summary_cost_item(tool.Ifc, tool.Cost, cost_schedule=cost_schedule)
|
||||
cls.load_cost_schedule_web_ui(cost_schedule)
|
||||
if operator_data["type"] == "addCostItem":
|
||||
bpy.ops.bim.add_cost_item(cost_item=operator_data["costItemId"])
|
||||
@@ -452,10 +447,11 @@ class Web(bonsai.core.tool.Web):
|
||||
@classmethod
|
||||
def load_cost_schedule_web_ui(cls, cost_schedule):
|
||||
json_data = tool.Cost.create_cost_schedule_json(cost_schedule)
|
||||
cls.send_webui_data(data={
|
||||
"cost_items": json_data,
|
||||
"cost_schedule_id": cost_schedule.id()
|
||||
}, data_key="cost_items", event="cost_items")
|
||||
cls.send_webui_data(
|
||||
data={"cost_items": json_data, "cost_schedule_id": cost_schedule.id()},
|
||||
data_key="cost_items",
|
||||
event="cost_items",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def handle_gantt_operator(cls, operator_data: dict) -> None:
|
||||
|
||||
@@ -266,6 +266,7 @@ def get_cost_values(cost_item: ifcopenshell.entity_instance) -> list[dict[str, s
|
||||
print(results)
|
||||
return results
|
||||
|
||||
|
||||
def get_cost_schedule_types(file):
|
||||
schema: ifcopenshell_wrapper.schema_definition = ifcopenshell_wrapper.schema_by_name(file.schema)
|
||||
results = []
|
||||
@@ -274,13 +275,16 @@ def get_cost_schedule_types(file):
|
||||
for attribute in declaration.attributes():
|
||||
if attribute.name() == "PredefinedType":
|
||||
for enumeration in attribute.type_of_attribute().declared_type().enumeration_items():
|
||||
results.append({
|
||||
"name": enumeration,
|
||||
'description': get_predefined_type_doc(version, "IfcCostSchedule",enumeration),
|
||||
})
|
||||
results.append(
|
||||
{
|
||||
"name": enumeration,
|
||||
"description": get_predefined_type_doc(version, "IfcCostSchedule", enumeration),
|
||||
}
|
||||
)
|
||||
break
|
||||
return results
|
||||
|
||||
|
||||
class CostValueUnserialiser:
|
||||
def parse(self, formula: str):
|
||||
l = lark.Lark(
|
||||
|
||||
Reference in New Issue
Block a user