black format

This commit is contained in:
Andrej730
2024-07-05 17:54:47 +05:00
parent 1d59edcbe8
commit 24d1a2ee64
4 changed files with 24 additions and 34 deletions
@@ -92,13 +92,13 @@ class BIM_OT_aggregate_unassign_object(bpy.types.Operator, tool.Ifc.Operator):
)
# Removes Pset related to Linked Aggregates
if not element.is_a('IfcElementAssembly'):
pset = ifcopenshell.util.element.get_pset(element, 'BBIM_Linked_Aggregate')
if not element.is_a("IfcElementAssembly"):
pset = ifcopenshell.util.element.get_pset(element, "BBIM_Linked_Aggregate")
if pset:
pset = tool.Ifc.get().by_id(pset["id"])
ifcopenshell.api.run("pset.remove_pset", tool.Ifc.get(), product=element, pset=pset)
class BIM_OT_enable_editing_aggregate(bpy.types.Operator, tool.Ifc.Operator):
"""Enable editing aggregation relationship"""
@@ -225,7 +225,7 @@ class BIM_OT_select_aggregate(bpy.types.Operator):
# obj = bpy.data.objects.get(self.obj) or context.active_object
# aggregate = ifcopenshell.util.element.get_aggregate(tool.Ifc.get_entity(obj))
# aggregate_obj = tool.Ifc.get_object(aggregate)
all_parts = []
for obj in context.selected_objects:
element = tool.Ifc.get_entity(obj)
@@ -238,7 +238,7 @@ class BIM_OT_select_aggregate(bpy.types.Operator):
pass
if not element:
obj.select_set(False)
if self.select_parts:
all_objs = []
for part in all_parts:
@@ -256,7 +256,7 @@ class BIM_OT_select_aggregate(bpy.types.Operator):
for aggregate_element in all_parts:
aggregate_obj = tool.Ifc.get_object(aggregate_element)
aggregate_obj.select_set(True)
bpy.context.view_layer.objects.active = aggregate_obj
bpy.context.view_layer.objects.active = aggregate_obj
return {"FINISHED"}
@@ -331,7 +331,7 @@ class BIM_OT_select_linked_aggregates(bpy.types.Operator, tool.Ifc.Operator):
return "Select all aggregates"
def _execute(self, context):
for obj in context.selected_objects:
obj.select_set(False)
element = tool.Ifc.get_entity(obj)
@@ -39,7 +39,7 @@ class LoadBrickProject(bpy.types.Operator, tool.Ifc.Operator):
root = context.scene.BIMBrickProperties.brick_list_root
core.load_brick_project(tool.Brick, filepath=self.filepath, brick_root=root)
else:
self.report({'ERROR'}, f'Failed to load {self.filepath}')
self.report({"ERROR"}, f"Failed to load {self.filepath}")
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
@@ -70,7 +70,7 @@ class ViewBrickItem(bpy.types.Operator, tool.Ifc.Operator):
try:
core.view_brick_item(tool.Brick, item=self.item, split_screen=self.split_screen)
except:
self.report({'ERROR'}, f'Could not find {self.item}')
self.report({"ERROR"}, f"Could not find {self.item}")
class RewindBrickClass(bpy.types.Operator, tool.Ifc.Operator):
@@ -112,13 +112,13 @@ class AssignBrickReference(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
if not context.active_object:
self.report({'ERROR'}, f'No Ifc selected')
self.report({"ERROR"}, f"No Ifc selected")
return
props = context.scene.BIMBrickProperties
try:
props.bricks[props.active_brick_index]
except:
self.report({'ERROR'}, f'No Brick selected')
self.report({"ERROR"}, f"No Brick selected")
return
core.assign_brick_reference(
tool.Ifc,
@@ -163,12 +163,7 @@ class AddBrickRelation(bpy.types.Operator, tool.Ifc.Operator):
object = props.split_screen_bricks[props.split_screen_active_brick_index].uri
else:
object = props.namespace + props.new_brick_relation_object
core.add_brick_relation(
tool.Brick,
brick_uri=brick.uri,
predicate=props.new_brick_relation_type,
object=object
)
core.add_brick_relation(tool.Brick, brick_uri=brick.uri, predicate=props.new_brick_relation_type, object=object)
class ConvertIfcToBrick(bpy.types.Operator, tool.Ifc.Operator):
@@ -271,9 +271,7 @@ class CreateDrawing(bpy.types.Operator):
with profile("Combine SVG layers"):
svg_path = self.combine_svgs(context, underlay_svg, linework_svg, annotation_svg)
tool.Drawing.open_with_user_command(
tool.Blender.get_addon_preferences().svg_command, svg_path
)
tool.Drawing.open_with_user_command(tool.Blender.get_addon_preferences().svg_command, svg_path)
if self.print_all:
bpy.ops.bim.activate_drawing(drawing=original_drawing_id, camera_view_point=False)
@@ -1455,9 +1453,7 @@ class OpenDrawing(bpy.types.Operator):
return {"CANCELLED"}
for drawing_uri in drawing_uris:
tool.Drawing.open_with_user_command(
tool.Blender.get_addon_preferences().svg_command, drawing_uri
)
tool.Drawing.open_with_user_command(tool.Blender.get_addon_preferences().svg_command, drawing_uri)
return {"FINISHED"}
@@ -1557,7 +1553,6 @@ class ActivateDrawing(bpy.types.Operator):
if camera_props.update_representation(camera):
bpy.ops.bim.update_representation(obj=camera.name, ifc_representation_class="")
return {"FINISHED"}
@@ -141,15 +141,15 @@ class SelectType(bpy.types.Operator):
def execute(self, context):
if self.relating_type: #if operator button sends a relating_type, the iterator only selects this one type
if self.relating_type: # if operator button sends a relating_type, the iterator only selects this one type
element = tool.Ifc.get().by_id(self.relating_type)
obj = tool.Ifc.get_object(element)
selected_objs = [obj]
else: #else, the iterator selects all the types of all the selected objects
else: # else, the iterator selects all the types of all the selected objects
selected_objs = context.selected_objects
active_obj = context.active_object
selected_objs.append(active_obj) #update selected_objs so the active_obj is at the end of the list
selected_objs.append(active_obj) # update selected_objs so the active_obj is at the end of the list
last_relating_type_obj = None
for obj in selected_objs:
element = tool.Ifc.get_entity(obj)
@@ -157,14 +157,14 @@ class SelectType(bpy.types.Operator):
if relating_type:
relating_type_obj = tool.Ifc.get_object(relating_type)
if relating_type_obj:
if relating_type_obj.hide_get():
relating_type_obj.hide_set(False)
relating_type_obj.select_set(True)
if relating_type_obj.hide_get():
relating_type_obj.hide_set(False)
relating_type_obj.select_set(True)
last_relating_type_obj = relating_type_obj
if not element.is_a("IfcTypeObject"):
if not element.is_a("IfcTypeObject"):
obj.select_set(False)
context.view_layer.objects.active = last_relating_type_obj #makes the active_obj's type the active object
context.view_layer.objects.active = last_relating_type_obj # makes the active_obj's type the active object
return {"FINISHED"}
@@ -175,7 +175,7 @@ class SelectType(bpy.types.Operator):
if "IfcProject" in child.name:
ifc_project_collection = child
break
if ifc_project_collection:
collection_in_view_layer = ifc_project_collection.children.get(collection_name)
return collection_in_view_layer