Fix Brick core

- Refresh viewer now reloads both screens by default
- Rename "add_namespace" to "add_brick_namespace"
- Fix error where "view_brick_class" was run instead of "brick.run_view_brick_class"
This commit is contained in:
rileywong311
2023-08-23 16:58:27 -07:00
parent 6aa6f91be4
commit 7220dd024e
3 changed files with 19 additions and 26 deletions
@@ -233,7 +233,6 @@ class RefreshBrickViewer(bpy.types.Operator, Operator):
def _execute(self, context):
core.refresh_brick_viewer(tool.Brick)
core.refresh_brick_viewer(tool.Brick, split_screen=True)
class RemoveBrick(bpy.types.Operator, Operator):
@@ -289,7 +288,7 @@ class AddBrickNamespace(bpy.types.Operator, Operator):
props = context.scene.BIMBrickProperties
alias = props.new_brick_namespace_alias
uri = props.new_brick_namespace_uri
core.add_namespace(tool.Brick, alias=alias, uri=uri)
core.add_brick_namespace(tool.Brick, alias=alias, uri=uri)
class RemoveBrickRelation(bpy.types.Operator, Operator):
+16 -22
View File
@@ -25,6 +25,14 @@ def load_brick_project(brick, filepath=None, brick_root=None):
brick.set_active_brick_class(brick_root, split_screen=True)
def new_brick_file(brick, brick_root=None):
brick.new_brick_file()
brick.import_brick_classes(brick_root)
brick.import_brick_classes(brick_root, split_screen=True)
brick.set_active_brick_class(brick_root)
brick.set_active_brick_class(brick_root, split_screen=True)
def view_brick_class(brick, brick_class=None, split_screen=False):
brick.add_brick_breadcrumb(split_screen=split_screen)
brick.clear_brick_browser(split_screen=split_screen)
@@ -35,7 +43,7 @@ def view_brick_class(brick, brick_class=None, split_screen=False):
def view_brick_item(brick, item=None, split_screen=False):
brick_class = brick.get_item_class(item)
view_brick_class(brick, brick_class=brick_class, split_screen=split_screen)
brick.run_view_brick_class(brick_class=brick_class, split_screen=split_screen)
brick.select_browser_item(item, split_screen=split_screen)
@@ -79,15 +87,13 @@ def add_brick(ifc, brick, element=None, namespace=None, brick_class=None, librar
if library:
brick.run_assign_brick_reference(element=element, library=library, brick_uri=brick_uri)
else:
brick_uri = brick.add_brick(namespace, brick_class, label)
brick.add_brick(namespace, brick_class, label)
brick.run_refresh_brick_viewer()
brick.run_refresh_brick_viewer(split_screen=True)
def add_brick_relation(brick, brick_uri=None, predicate=None, object=None):
brick.add_relation(brick_uri, predicate, object)
brick.run_refresh_brick_viewer()
brick.run_refresh_brick_viewer(split_screen=True)
def convert_ifc_to_brick(brick, namespace=None, library=None):
@@ -129,23 +135,13 @@ def convert_ifc_to_brick(brick, namespace=None, library=None):
for downstream_equipment in feeds:
brick.add_relation(equipment_uris[element], "https://brickschema.org/schema/Brick#feeds", equipment_uris[downstream_equipment])
brick.run_refresh_brick_viewer()
brick.run_refresh_brick_viewer(split_screen=True)
def new_brick_file(brick, brick_root=None):
brick.new_brick_file()
brick.import_brick_classes(brick_root)
brick.import_brick_classes(brick_root, split_screen=True)
brick.set_active_brick_class(brick_root)
brick.set_active_brick_class(brick_root, split_screen=True)
def refresh_brick_viewer(brick, split_screen=False):
if split_screen:
brick.run_view_brick_class(brick_class=brick.get_active_brick_class(split_screen=split_screen), split_screen=split_screen)
else:
brick.run_view_brick_class(brick_class=brick.get_active_brick_class(), split_screen=split_screen)
brick.pop_brick_breadcrumb(split_screen=split_screen)
def refresh_brick_viewer(brick):
brick.run_view_brick_class(brick_class=brick.get_active_brick_class())
brick.pop_brick_breadcrumb()
brick.run_view_brick_class(brick_class=brick.get_active_brick_class(split_screen=True), split_screen=True)
brick.pop_brick_breadcrumb(split_screen=True)
def remove_brick(ifc, brick, library=None, brick_uri=None):
@@ -155,14 +151,13 @@ def remove_brick(ifc, brick, library=None, brick_uri=None):
ifc.run("library.remove_reference", reference=reference)
brick.remove_brick(brick_uri)
brick.run_refresh_brick_viewer()
brick.run_refresh_brick_viewer(split_screen=True)
def serialize_brick(brick):
brick.serialize_brick()
def add_namespace(brick, alias=None, uri=None):
def add_brick_namespace(brick, alias=None, uri=None):
brick.add_namespace(alias, uri)
@@ -173,4 +168,3 @@ def set_brick_list_root(brick, brick_root=None, split_screen=False):
def remove_brick_relation(brick, brick_uri=None, predicate=None, object=None):
brick.remove_relation(brick_uri, predicate, object)
brick.run_refresh_brick_viewer()
+2 -2
View File
@@ -398,8 +398,8 @@ class Brick(blenderbim.core.tool.Brick):
)
@classmethod
def run_refresh_brick_viewer(cls, split_screen=False):
return blenderbim.core.brick.refresh_brick_viewer(tool.Brick, split_screen)
def run_refresh_brick_viewer(cls):
return blenderbim.core.brick.refresh_brick_viewer(tool.Brick)
@classmethod
def run_view_brick_class(cls, brick_class=None, split_screen=False):