diff --git a/src/bonsai/bonsai/bim/export_ifc.py b/src/bonsai/bonsai/bim/export_ifc.py index 73fbcc3ba2..7bc8de0af5 100644 --- a/src/bonsai/bonsai/bim/export_ifc.py +++ b/src/bonsai/bonsai/bim/export_ifc.py @@ -85,7 +85,7 @@ class IfcExporter: ) self.file.wrapped_data.header.file_name.preprocessor_version = "IfcOpenShell {}".format(ifcopenshell.version) self.file.wrapped_data.header.file_name.originating_system = "{} {}".format( - self.get_application_name(), tool.Blender.get_blenderbim_version() + self.get_application_name(), tool.Blender.get_bonsai_version() ) def sync_all_objects(self) -> list[ifcopenshell.entity_instance]: diff --git a/src/bonsai/bonsai/bim/handler.py b/src/bonsai/bonsai/bim/handler.py index b9c799b4f2..ae06e81e1d 100644 --- a/src/bonsai/bonsai/bim/handler.py +++ b/src/bonsai/bonsai/bim/handler.py @@ -226,7 +226,7 @@ def redo_post(scene): def get_application(ifc: ifcopenshell.file) -> ifcopenshell.entity_instance: # TODO: cache this for even faster application retrieval. It honestly makes a difference on long scripts. - version = tool.Blender.get_blenderbim_version() + version = tool.Blender.get_bonsai_version() for element in ifc.by_type("IfcApplication"): if element.ApplicationIdentifier == "Bonsai" and element.Version == version: return element diff --git a/src/bonsai/bonsai/bim/module/augin/operator.py b/src/bonsai/bonsai/bim/module/augin/operator.py index 88c40504ff..5cbb86c1c0 100644 --- a/src/bonsai/bonsai/bim/module/augin/operator.py +++ b/src/bonsai/bonsai/bim/module/augin/operator.py @@ -76,7 +76,7 @@ class AuginCreateNewModel(bpy.types.Operator): props.project_filename = "BBM{}{}".format( datetime.datetime.now().strftime("%Y%m%d%H%M%S"), "".join(random.choice(chars) for _ in range(6)) ) - addon_version = tool.Blender.get_blenderbim_version() + addon_version = tool.Blender.get_bonsai_version() payload = { "user_token": props.token, diff --git a/src/bonsai/bonsai/bim/module/model/root.py b/src/bonsai/bonsai/bim/module/model/root.py index 315943ec37..a0eedbfb5d 100644 --- a/src/bonsai/bonsai/bim/module/model/root.py +++ b/src/bonsai/bonsai/bim/module/model/root.py @@ -20,7 +20,7 @@ import bpy import ifcopenshell.file import blenderbim.bim.handler import blenderbim.tool as tool -from blenderbim.bim.ifc import IFC_CONNECTED_TYPE +from bonsai.bim.ifc import IFC_CONNECTED_TYPE from typing import Any diff --git a/src/bonsai/bonsai/bim/ui.py b/src/bonsai/bonsai/bim/ui.py index a343a0dec9..d20a919a55 100644 --- a/src/bonsai/bonsai/bim/ui.py +++ b/src/bonsai/bonsai/bim/ui.py @@ -1046,7 +1046,7 @@ class UIData: @classmethod def version(cls): - return tool.Blender.get_blenderbim_version() + return tool.Blender.get_bonsai_version() def draw_statusbar(self, context): diff --git a/src/bonsai/bonsai/tool/__init__.py b/src/bonsai/bonsai/tool/__init__.py index b4164c81f6..08aad970b7 100644 --- a/src/bonsai/bonsai/tool/__init__.py +++ b/src/bonsai/bonsai/tool/__init__.py @@ -16,51 +16,51 @@ # You should have received a copy of the GNU General Public License # along with Bonsai. If not, see . -from blenderbim.tool.aggregate import Aggregate -from blenderbim.tool.blender import Blender -from blenderbim.tool.boundary import Boundary -from blenderbim.tool.brick import Brick -from blenderbim.tool.bsdd import Bsdd -from blenderbim.tool.cad import Cad -from blenderbim.tool.clash import Clash -from blenderbim.tool.classification import Classification -from blenderbim.tool.collector import Collector -from blenderbim.tool.context import Context -from blenderbim.tool.debug import Debug -from blenderbim.tool.demo import Demo -from blenderbim.tool.document import Document -from blenderbim.tool.drawing import Drawing -from blenderbim.tool.geometry import Geometry -from blenderbim.tool.georeference import Georeference -from blenderbim.tool.ifc import Ifc -from blenderbim.tool.ifcgit import IfcGit -from blenderbim.tool.ifcgit import IfcGitRepo -from blenderbim.tool.library import Library -from blenderbim.tool.loader import Loader -from blenderbim.tool.material import Material -from blenderbim.tool.misc import Misc -from blenderbim.tool.model import Model -from blenderbim.tool.nest import Nest -from blenderbim.tool.owner import Owner -from blenderbim.tool.patch import Patch -from blenderbim.tool.project import Project -from blenderbim.tool.profile import Profile -from blenderbim.tool.pset import Pset -from blenderbim.tool.qto import Qto -from blenderbim.tool.raycast import Raycast -from blenderbim.tool.resource import Resource -from blenderbim.tool.root import Root -from blenderbim.tool.sequence import Sequence -from blenderbim.tool.snap import Snap -from blenderbim.tool.spatial import Spatial -from blenderbim.tool.covering import Covering -from blenderbim.tool.structural import Structural -from blenderbim.tool.style import Style -from blenderbim.tool.surveyor import Surveyor -from blenderbim.tool.system import System -from blenderbim.tool.tester import Tester -from blenderbim.tool.type import Type -from blenderbim.tool.unit import Unit -from blenderbim.tool.search import Search -from blenderbim.tool.cost import Cost -from blenderbim.tool.web import Web +from bonsai.tool.aggregate import Aggregate +from bonsai.tool.blender import Blender +from bonsai.tool.boundary import Boundary +from bonsai.tool.brick import Brick +from bonsai.tool.bsdd import Bsdd +from bonsai.tool.cad import Cad +from bonsai.tool.clash import Clash +from bonsai.tool.classification import Classification +from bonsai.tool.collector import Collector +from bonsai.tool.context import Context +from bonsai.tool.debug import Debug +from bonsai.tool.demo import Demo +from bonsai.tool.document import Document +from bonsai.tool.drawing import Drawing +from bonsai.tool.geometry import Geometry +from bonsai.tool.georeference import Georeference +from bonsai.tool.ifc import Ifc +from bonsai.tool.ifcgit import IfcGit +from bonsai.tool.ifcgit import IfcGitRepo +from bonsai.tool.library import Library +from bonsai.tool.loader import Loader +from bonsai.tool.material import Material +from bonsai.tool.misc import Misc +from bonsai.tool.model import Model +from bonsai.tool.nest import Nest +from bonsai.tool.owner import Owner +from bonsai.tool.patch import Patch +from bonsai.tool.project import Project +from bonsai.tool.profile import Profile +from bonsai.tool.pset import Pset +from bonsai.tool.qto import Qto +from bonsai.tool.raycast import Raycast +from bonsai.tool.resource import Resource +from bonsai.tool.root import Root +from bonsai.tool.sequence import Sequence +from bonsai.tool.snap import Snap +from bonsai.tool.spatial import Spatial +from bonsai.tool.covering import Covering +from bonsai.tool.structural import Structural +from bonsai.tool.style import Style +from bonsai.tool.surveyor import Surveyor +from bonsai.tool.system import System +from bonsai.tool.tester import Tester +from bonsai.tool.type import Type +from bonsai.tool.unit import Unit +from bonsai.tool.search import Search +from bonsai.tool.cost import Cost +from bonsai.tool.web import Web diff --git a/src/bonsai/bonsai/tool/aggregate.py b/src/bonsai/bonsai/tool/aggregate.py index 451a0327a8..18d099eb6e 100644 --- a/src/bonsai/bonsai/tool/aggregate.py +++ b/src/bonsai/bonsai/tool/aggregate.py @@ -17,14 +17,14 @@ # along with Bonsai. If not, see . import bpy -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import ifcopenshell.util.element import ifcopenshell.util.representation from typing import Union -class Aggregate(blenderbim.core.tool.Aggregate): +class Aggregate(bonsai.core.tool.Aggregate): @classmethod def can_aggregate(cls, relating_obj: bpy.types.Object, related_obj: bpy.types.Object) -> bool: relating_object = tool.Ifc.get_entity(relating_obj) diff --git a/src/bonsai/bonsai/tool/blender.py b/src/bonsai/bonsai/tool/blender.py index 4c1c3ec11f..cba3e52567 100644 --- a/src/bonsai/bonsai/tool/blender.py +++ b/src/bonsai/bonsai/tool/blender.py @@ -23,14 +23,14 @@ import json import os import ifcopenshell.api import ifcopenshell.util.element -import blenderbim.core.tool -import blenderbim.tool as tool -import blenderbim.bim +import bonsai.core.tool +import bonsai.tool as tool +import bonsai.bim import types import importlib from mathutils import Vector from pathlib import Path -from blenderbim.bim.ifc import IFC_CONNECTED_TYPE +from bonsai.bim.ifc import IFC_CONNECTED_TYPE from typing import Any, Optional, Union, Literal, Iterable, Callable from typing_extensions import assert_never @@ -49,7 +49,7 @@ VIEWPORT_ATTRIBUTES = [ OBJECT_DATA_TYPE = Union[bpy.types.Mesh, bpy.types.Curve, bpy.types.Camera] -class Blender(blenderbim.core.tool.Blender): +class Blender(bonsai.core.tool.Blender): OBJECT_TYPES_THAT_SUPPORT_EDIT_MODE = ("MESH", "CURVE", "SURFACE", "META", "FONT", "LATTICE", "ARMATURE") OBJECT_TYPES_THAT_SUPPORT_EDIT_GPENCIL_MODE = ("GPENCIL",) TYPE_MANAGER_ICON = "LIGHTPROBE_VOLUME" if bpy.app.version >= (4, 1, 0) else "LIGHTPROBE_GRID" @@ -943,7 +943,7 @@ class Blender(blenderbim.core.tool.Blender): return commit_hash[:7] @classmethod - def get_blenderbim_version(cls) -> str: + def get_bonsai_version(cls) -> str: bbim = cls.get_bbim_extension_package() version = bbim.bbim_semver["version"] if commit_hash := cls.get_last_commit_hash(): @@ -952,11 +952,11 @@ class Blender(blenderbim.core.tool.Blender): @classmethod def register_toolbar(cls): - import blenderbim.bim.module.model.workspace as ws_model - import blenderbim.bim.module.drawing.workspace as ws_drawing - import blenderbim.bim.module.spatial.workspace as ws_spatial - import blenderbim.bim.module.structural.workspace as ws_structural - import blenderbim.bim.module.covering.workspace as ws_covering + import bonsai.bim.module.model.workspace as ws_model + import bonsai.bim.module.drawing.workspace as ws_drawing + import bonsai.bim.module.spatial.workspace as ws_spatial + import bonsai.bim.module.structural.workspace as ws_structural + import bonsai.bim.module.covering.workspace as ws_covering if bpy.app.background: return @@ -984,11 +984,11 @@ class Blender(blenderbim.core.tool.Blender): @classmethod def unregister_toolbar(cls): - import blenderbim.bim.module.model.workspace as ws_model - import blenderbim.bim.module.drawing.workspace as ws_drawing - import blenderbim.bim.module.spatial.workspace as ws_spatial - import blenderbim.bim.module.structural.workspace as ws_structural - import blenderbim.bim.module.covering.workspace as ws_covering + import bonsai.bim.module.model.workspace as ws_model + import bonsai.bim.module.drawing.workspace as ws_drawing + import bonsai.bim.module.spatial.workspace as ws_spatial + import bonsai.bim.module.structural.workspace as ws_structural + import bonsai.bim.module.covering.workspace as ws_covering if bpy.app.background: return @@ -1022,7 +1022,7 @@ class Blender(blenderbim.core.tool.Blender): if not hasattr(item, "bl_rna") or not isinstance(item.bl_rna, bpy.types.Panel): continue # ignore bbim panels - if item.__module__.startswith("blenderbim"): + if item.__module__.startswith("bonsai"): continue # filter scene panels if getattr(item, "bl_context", None) != "scene": @@ -1075,7 +1075,7 @@ class Blender(blenderbim.core.tool.Blender): def poll_check_blender_tab(cls, context): return tool.Blender.is_tab(context, "BLENDER") - polls = blenderbim.bim.original_scene_panels_polls + polls = bonsai.bim.original_scene_panels_polls # override poll method if not hasattr(original_panel, "poll"): @@ -1096,7 +1096,7 @@ class Blender(blenderbim.core.tool.Blender): @classmethod def remove_scene_panel_override(cls, panel: bpy.types.Panel) -> None: - polls = blenderbim.bim.original_scene_panels_polls + polls = bonsai.bim.original_scene_panels_polls poll = polls[panel] if poll is None: @@ -1125,7 +1125,7 @@ class Blender(blenderbim.core.tool.Blender): return importlib.import_module(name) @classmethod - def get_addon_preferences(cls) -> blenderbim.bim.ui.BIM_ADDON_preferences: + def get_addon_preferences(cls) -> bonsai.bim.ui.BIM_ADDON_preferences: blender_package_name = cls.get_blender_addon_package_name() return bpy.context.preferences.addons[blender_package_name].preferences diff --git a/src/bonsai/bonsai/tool/boundary.py b/src/bonsai/bonsai/tool/boundary.py index 25f9947673..f00dec4228 100644 --- a/src/bonsai/bonsai/tool/boundary.py +++ b/src/bonsai/bonsai/tool/boundary.py @@ -18,16 +18,16 @@ import bpy import mathutils -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from mathutils import Matrix, Vector from typing import Any, Sequence -class Boundary(blenderbim.core.tool.Boundary): +class Boundary(bonsai.core.tool.Boundary): @classmethod def get_assign_connection_geometry_settings(cls, obj: bpy.types.Object) -> dict[str, Any]: - from blenderbim.bim.module.geometry.helper import Helper + from bonsai.bim.module.geometry.helper import Helper ifc = tool.Ifc.get() helper = Helper(ifc) diff --git a/src/bonsai/bonsai/tool/brick.py b/src/bonsai/bonsai/tool/brick.py index 40faeb69c7..3d3f465caa 100644 --- a/src/bonsai/bonsai/tool/brick.py +++ b/src/bonsai/bonsai/tool/brick.py @@ -23,8 +23,9 @@ import ifcopenshell.guid import ifcopenshell.util.brick import ifcopenshell.util.element import ifcopenshell.util.system -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.brick +import bonsai.core.tool +import bonsai.tool as tool from contextlib import contextmanager import datetime @@ -47,7 +48,7 @@ logger = logging.getLogger("rdflib") logger.setLevel(logging.ERROR) -class Brick(blenderbim.core.tool.Brick): +class Brick(bonsai.core.tool.Brick): @classmethod def add_brick(cls, namespace, brick_class, label): ns = Namespace(namespace) @@ -400,17 +401,17 @@ class Brick(blenderbim.core.tool.Brick): @classmethod def run_assign_brick_reference(cls, element=None, library=None, brick_uri=None): - return blenderbim.core.brick.assign_brick_reference( + return bonsai.core.brick.assign_brick_reference( tool.Ifc, tool.Brick, element=element, library=library, brick_uri=brick_uri ) @classmethod def run_refresh_brick_viewer(cls): - return blenderbim.core.brick.refresh_brick_viewer(tool.Brick) + return bonsai.core.brick.refresh_brick_viewer(tool.Brick) @classmethod def run_view_brick_class(cls, brick_class=None, split_screen=False): - return blenderbim.core.brick.view_brick_class(tool.Brick, brick_class=brick_class, split_screen=split_screen) + return bonsai.core.brick.view_brick_class(tool.Brick, brick_class=brick_class, split_screen=split_screen) @classmethod def select_browser_item(cls, item, split_screen=False): diff --git a/src/bonsai/bonsai/tool/bsdd.py b/src/bonsai/bonsai/tool/bsdd.py index bea52d3b85..12ac7e12f9 100644 --- a/src/bonsai/bonsai/tool/bsdd.py +++ b/src/bonsai/bonsai/tool/bsdd.py @@ -1,12 +1,12 @@ -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import bpy import json import bsdd from typing import Any, Union, Optional -class Bsdd(blenderbim.core.tool.Bsdd): +class Bsdd(bonsai.core.tool.Bsdd): @classmethod def clear_class_psets(cls) -> None: bpy.context.scene.BIMBSDDProperties.classification_psets.clear() diff --git a/src/bonsai/bonsai/tool/clash.py b/src/bonsai/bonsai/tool/clash.py index 4a20b5f5cb..893a282f4b 100644 --- a/src/bonsai/bonsai/tool/clash.py +++ b/src/bonsai/bonsai/tool/clash.py @@ -20,13 +20,13 @@ import os import bpy import json import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from contextlib import contextmanager from mathutils import Vector -class Clash(blenderbim.core.tool.Clash): +class Clash(bonsai.core.tool.Clash): @classmethod def export_clash_sets(cls): diff --git a/src/bonsai/bonsai/tool/classification.py b/src/bonsai/bonsai/tool/classification.py index 07e54f477f..1fc8b6f6f8 100644 --- a/src/bonsai/bonsai/tool/classification.py +++ b/src/bonsai/bonsai/tool/classification.py @@ -20,14 +20,13 @@ from __future__ import annotations import bpy import ifcopenshell.api import ifcopenshell.util.classification -import blenderbim.core.tool -import blenderbim.tool as tool -import blenderbim.bim +import bonsai.core.tool +import bonsai.tool as tool from typing import Any, Optional, Union, Literal, Iterable, Callable from typing_extensions import assert_never -class Classification(blenderbim.core.tool.Classification): +class Classification(bonsai.core.tool.Classification): @classmethod def get_location(cls, classification: ifcopenshell.entity_instance) -> Union[str, None]: schema = classification.file.schema diff --git a/src/bonsai/bonsai/tool/collector.py b/src/bonsai/bonsai/tool/collector.py index d44c161e23..c5e1e8344f 100644 --- a/src/bonsai/bonsai/tool/collector.py +++ b/src/bonsai/bonsai/tool/collector.py @@ -17,13 +17,13 @@ # along with Bonsai. If not, see . import bpy -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import ifcopenshell.util.element from typing import Union -class Collector(blenderbim.core.tool.Collector): +class Collector(bonsai.core.tool.Collector): @classmethod def assign(cls, obj: bpy.types.Object, should_clean_users_collection=True) -> None: """Links an object to an appropriate Blender collection.""" diff --git a/src/bonsai/bonsai/tool/context.py b/src/bonsai/bonsai/tool/context.py index aa777930a0..dfb3590e59 100644 --- a/src/bonsai/bonsai/tool/context.py +++ b/src/bonsai/bonsai/tool/context.py @@ -17,12 +17,12 @@ # along with Bonsai. If not, see . import bpy -import blenderbim.bim.helper -import blenderbim.tool as tool -import blenderbim.core.tool +import bonsai.bim.helper +import bonsai.tool as tool +import bonsai.core.tool -class Context(blenderbim.core.tool.Context): +class Context(bonsai.core.tool.Context): @classmethod def set_context(cls, context): bpy.context.scene.BIMContextProperties.active_context_id = context.id() @@ -42,7 +42,7 @@ class Context(blenderbim.core.tool.Context): props.context_attributes.remove(props.context_attributes.find("CoordinateSpaceDimension")) return True - blenderbim.bim.helper.import_attributes(context.is_a(), props.context_attributes, context.get_info(), callback) + bonsai.bim.helper.import_attributes(context.is_a(), props.context_attributes, context.get_info(), callback) @classmethod def clear_context(cls): @@ -54,4 +54,4 @@ class Context(blenderbim.core.tool.Context): @classmethod def export_attributes(cls): - return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMContextProperties.context_attributes) + return bonsai.bim.helper.export_attributes(bpy.context.scene.BIMContextProperties.context_attributes) diff --git a/src/bonsai/bonsai/tool/cost.py b/src/bonsai/bonsai/tool/cost.py index 56c231e84c..3ca735de29 100644 --- a/src/bonsai/bonsai/tool/cost.py +++ b/src/bonsai/bonsai/tool/cost.py @@ -1,25 +1,25 @@ import os import bpy -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import ifcopenshell.api import ifcopenshell.util.element import ifcopenshell.util.date import ifcopenshell.util.cost import ifcopenshell.util.unit -import blenderbim.bim.helper +import bonsai.bim.helper import json from typing import Optional, Any, Generator, Union, Literal -class Cost(blenderbim.core.tool.Cost): +class Cost(bonsai.core.tool.Cost): RELATED_OBJECT_TYPE = Literal["PRODUCT", "PROCESS", "RESOURCE"] @classmethod def get_cost_schedule_attributes(cls) -> dict[str, Any]: props = bpy.context.scene.BIMCostProperties - return blenderbim.bim.helper.export_attributes(props.cost_schedule_attributes) + return bonsai.bim.helper.export_attributes(props.cost_schedule_attributes) @classmethod def disable_editing_cost_schedule(cls) -> None: @@ -90,7 +90,7 @@ class Cost(blenderbim.core.tool.Cost): props = bpy.context.scene.BIMCostProperties props.cost_schedule_attributes.clear() - blenderbim.bim.helper.import_attributes2(cost_schedule, props.cost_schedule_attributes, callback=special_import) + bonsai.bim.helper.import_attributes2(cost_schedule, props.cost_schedule_attributes, callback=special_import) @classmethod def enable_editing_cost_items(cls, cost_schedule: ifcopenshell.entity_instance) -> None: @@ -191,7 +191,7 @@ class Cost(blenderbim.core.tool.Cost): def load_cost_item_attributes(cls, cost_item: ifcopenshell.entity_instance) -> None: props = bpy.context.scene.BIMCostProperties props.cost_item_attributes.clear() - blenderbim.bim.helper.import_attributes2(cost_item, props.cost_item_attributes) + bonsai.bim.helper.import_attributes2(cost_item, props.cost_item_attributes) @classmethod def disable_editing_cost_item(cls) -> None: @@ -201,7 +201,7 @@ class Cost(blenderbim.core.tool.Cost): @classmethod def get_cost_item_attributes(cls) -> dict[str, Any]: props = bpy.context.scene.BIMCostProperties - return blenderbim.bim.helper.export_attributes(props.cost_item_attributes) + return bonsai.bim.helper.export_attributes(props.cost_item_attributes) @classmethod def get_active_cost_item(cls) -> Union[ifcopenshell.entity_instance, None]: @@ -319,7 +319,7 @@ class Cost(blenderbim.core.tool.Cost): def load_cost_item_quantity_attributes(cls, physical_quantity: ifcopenshell.entity_instance) -> None: props = bpy.context.scene.BIMCostProperties props.quantity_attributes.clear() - blenderbim.bim.helper.import_attributes2(physical_quantity, props.quantity_attributes) + bonsai.bim.helper.import_attributes2(physical_quantity, props.quantity_attributes) @classmethod def enable_editing_cost_item_values(cls, cost_item: ifcopenshell.entity_instance) -> None: @@ -334,7 +334,7 @@ class Cost(blenderbim.core.tool.Cost): @classmethod def get_cost_item_quantity_attributes(cls) -> dict[str, Any]: props = bpy.context.scene.BIMCostProperties - return blenderbim.bim.helper.export_attributes(props.quantity_attributes) + return bonsai.bim.helper.export_attributes(props.quantity_attributes) @classmethod def get_attributes_for_cost_value( @@ -396,7 +396,7 @@ class Cost(blenderbim.core.tool.Cost): callback = lambda name, prop, data: import_attributes( name, prop, data, cost_value, is_rates, props.cost_value_attributes ) - blenderbim.bim.helper.import_attributes2(cost_value, props.cost_value_attributes, callback=callback) + bonsai.bim.helper.import_attributes2(cost_value, props.cost_value_attributes, callback=callback) @classmethod def calculate_applied_value( @@ -456,7 +456,7 @@ class Cost(blenderbim.core.tool.Cost): props = bpy.context.scene.BIMCostProperties callback = lambda attributes, prop: export_attributes(attributes, prop) - return blenderbim.bim.helper.export_attributes(props.cost_value_attributes, callback) + return bonsai.bim.helper.export_attributes(props.cost_value_attributes, callback) @classmethod def get_cost_value_unit_component(cls) -> ifcopenshell.entity_instance: diff --git a/src/bonsai/bonsai/tool/covering.py b/src/bonsai/bonsai/tool/covering.py index 1c0e060baf..3221d33df5 100644 --- a/src/bonsai/bonsai/tool/covering.py +++ b/src/bonsai/bonsai/tool/covering.py @@ -17,22 +17,13 @@ # along with Bonsai. If not, see . import bpy -import bmesh -import shapely import ifcopenshell import ifcopenshell.util.element -import blenderbim.core.tool -import blenderbim.core.root -import blenderbim.core.spatial -import blenderbim.core.geometry -import blenderbim.tool as tool -import json -from math import pi -from mathutils import Vector, Matrix -from shapely import Polygon, MultiPolygon +import bonsai.core.tool +import bonsai.tool as tool -class Covering(blenderbim.core.tool.Covering): +class Covering(bonsai.core.tool.Covering): @classmethod def get_z_from_ceiling_height(cls) -> float: props = bpy.context.scene.BIMCoveringProperties diff --git a/src/bonsai/bonsai/tool/debug.py b/src/bonsai/bonsai/tool/debug.py index 698eb27a51..17125a2113 100644 --- a/src/bonsai/bonsai/tool/debug.py +++ b/src/bonsai/bonsai/tool/debug.py @@ -19,12 +19,12 @@ import os import bpy import ifcopenshell.express -import blenderbim.core.tool -import blenderbim.tool as tool -from blenderbim.bim.ifc import IfcStore +import bonsai.core.tool +import bonsai.tool as tool +from bonsai.bim.ifc import IfcStore -class Debug(blenderbim.core.tool.Debug): +class Debug(bonsai.core.tool.Debug): @classmethod def add_schema_identifier(cls, schema): IfcStore.schema_identifiers.append(schema.schema_name) diff --git a/src/bonsai/bonsai/tool/demo.py b/src/bonsai/bonsai/tool/demo.py index cc7b99c18f..90b79ef8bd 100644 --- a/src/bonsai/bonsai/tool/demo.py +++ b/src/bonsai/bonsai/tool/demo.py @@ -30,13 +30,13 @@ # processing, and more. import bpy -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool # There is always one class in each tool file, which implements the interface # defined by `core/tool.py`. -class Demo(blenderbim.core.tool.Demo): +class Demo(bonsai.core.tool.Demo): @classmethod def clear_name_field(cls): # In this concrete implementation, we see that "clear name field" diff --git a/src/bonsai/bonsai/tool/document.py b/src/bonsai/bonsai/tool/document.py index dfe7c97ba6..62ec525f10 100644 --- a/src/bonsai/bonsai/tool/document.py +++ b/src/bonsai/bonsai/tool/document.py @@ -18,12 +18,12 @@ import bpy import ifcopenshell.util.system -import blenderbim.core.tool -import blenderbim.tool as tool -from blenderbim.bim import import_ifc +import bonsai.core.tool +import bonsai.tool as tool +from bonsai.bim import import_ifc -class Document(blenderbim.core.tool.Document): +class Document(bonsai.core.tool.Document): @classmethod def add_breadcrumb(cls, document): props = bpy.context.scene.BIMDocumentProperties @@ -54,7 +54,7 @@ class Document(blenderbim.core.tool.Document): @classmethod def export_document_attributes(cls): - return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMDocumentProperties.document_attributes) + return bonsai.bim.helper.export_attributes(bpy.context.scene.BIMDocumentProperties.document_attributes) @classmethod def get_active_breadcrumb(cls): @@ -66,7 +66,7 @@ class Document(blenderbim.core.tool.Document): def import_document_attributes(cls, document): props = bpy.context.scene.BIMDocumentProperties props.document_attributes.clear() - blenderbim.bim.helper.import_attributes2(document, props.document_attributes) + bonsai.bim.helper.import_attributes2(document, props.document_attributes) @classmethod def import_project_documents(cls): diff --git a/src/bonsai/bonsai/tool/drawing.py b/src/bonsai/bonsai/tool/drawing.py index 8ffe072d1e..1684abb368 100644 --- a/src/bonsai/bonsai/tool/drawing.py +++ b/src/bonsai/bonsai/tool/drawing.py @@ -32,17 +32,18 @@ import platform import mathutils import subprocess import numpy as np -import blenderbim.core.tool -import blenderbim.core.geometry -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.core.geometry +import bonsai.tool as tool import ifcopenshell.api import ifcopenshell.geom import ifcopenshell.util.representation import ifcopenshell.util.element import ifcopenshell.util.selector import ifcopenshell.util.shape -import blenderbim.bim.import_ifc -import blenderbim.core.root +import bonsai.bim.helper +import bonsai.bim.import_ifc +import bonsai.core.root from shapely.ops import unary_union from lxml import etree from mathutils import Vector, Matrix @@ -51,7 +52,7 @@ from typing import Optional, Union, Iterable, Any, Literal from pathlib import Path -class Drawing(blenderbim.core.tool.Drawing): +class Drawing(bonsai.core.tool.Drawing): ANNOTATION_DATA_TYPE = Literal["empty", "curve", "mesh"] DOCUMENT_TYPE = Literal["SCHEDULE", "REFERENCE"] @@ -96,7 +97,7 @@ class Drawing(blenderbim.core.tool.Drawing): @classmethod def create_annotation_object(cls, drawing: ifcopenshell.entity_instance, object_type: str) -> bpy.types.Object: - import blenderbim.bim.module.drawing.annotation as annotation + import bonsai.bim.module.drawing.annotation as annotation data_type = cls.get_annotation_data_type(object_type) obj = annotation.Annotator.get_annotation_obj(drawing, object_type, data_type) @@ -269,7 +270,7 @@ class Drawing(blenderbim.core.tool.Drawing): @classmethod def create_svg_schedule(cls, schedule: ifcopenshell.entity_instance) -> None: - import blenderbim.bim.module.drawing.scheduler as scheduler + import bonsai.bim.module.drawing.scheduler as scheduler schedule_creator = scheduler.Scheduler() schedule_creator.schedule( @@ -278,7 +279,7 @@ class Drawing(blenderbim.core.tool.Drawing): @classmethod def create_svg_sheet(cls, document: ifcopenshell.entity_instance, titleblock: str) -> str: - import blenderbim.bim.module.drawing.sheeter as sheeter + import bonsai.bim.module.drawing.sheeter as sheeter sheet_builder = sheeter.SheetBuilder() sheet_builder.data_dir = bpy.context.scene.BIMProperties.data_dir @@ -288,7 +289,7 @@ class Drawing(blenderbim.core.tool.Drawing): @classmethod def add_drawings(cls, sheet: ifcopenshell.entity_instance) -> None: - import blenderbim.bim.module.drawing.sheeter as sheeter + import bonsai.bim.module.drawing.sheeter as sheeter sheet_builder = sheeter.SheetBuilder() sheet_builder.data_dir = bpy.context.scene.BIMProperties.data_dir @@ -401,7 +402,7 @@ class Drawing(blenderbim.core.tool.Drawing): def export_text_literal_attributes(cls, obj: bpy.types.Object) -> list[dict[str, Any]]: literals = [] for literal_props in obj.BIMTextProperties.literals: - literal_data = blenderbim.bim.helper.export_attributes(literal_props.attributes) + literal_data = bonsai.bim.helper.export_attributes(literal_props.attributes) literals.append(literal_data) return literals @@ -671,8 +672,8 @@ class Drawing(blenderbim.core.tool.Drawing): [e for e in cls.get_group_elements(group) if e.is_a("IfcAnnotation") and e.ObjectType != "DRAWING"] ) logger = logging.getLogger("ImportIFC") - ifc_import_settings = blenderbim.bim.import_ifc.IfcImportSettings.factory(bpy.context, None, logger) - ifc_importer = blenderbim.bim.import_ifc.IfcImporter(ifc_import_settings) + ifc_import_settings = bonsai.bim.import_ifc.IfcImportSettings.factory(bpy.context, None, logger) + ifc_importer = bonsai.bim.import_ifc.IfcImporter(ifc_import_settings) ifc_importer.file = tool.Ifc.get() ifc_importer.calculate_unit_scale() ifc_importer.process_context_filter() @@ -751,7 +752,7 @@ class Drawing(blenderbim.core.tool.Drawing): @classmethod def import_camera_props(cls, drawing: ifcopenshell.entity_instance, obj: bpy.types.Object) -> None: - from blenderbim.bim.module.drawing.prop import get_diagram_scales + from bonsai.bim.module.drawing.prop import get_diagram_scales # Temporarily clear the definition id to prevent prop update callbacks to IFC. ifc_definition_id = obj.BIMObjectProperties.ifc_definition_id @@ -891,14 +892,14 @@ class Drawing(blenderbim.core.tool.Drawing): @classmethod def import_text_attributes(cls, obj: bpy.types.Object) -> None: - from blenderbim.bim.module.drawing.prop import BOX_ALIGNMENT_POSITIONS + from bonsai.bim.module.drawing.prop import BOX_ALIGNMENT_POSITIONS props = obj.BIMTextProperties props.literals.clear() for ifc_literal in cls.get_text_literal(obj, return_list=True): literal_props = props.literals.add() - blenderbim.bim.helper.import_attributes2(ifc_literal, literal_props.attributes) + bonsai.bim.helper.import_attributes2(ifc_literal, literal_props.attributes) box_alignment_mask = [False] * 9 position_string = literal_props.attributes["BoxAlignment"].string_value @@ -906,7 +907,7 @@ class Drawing(blenderbim.core.tool.Drawing): literal_props.box_alignment = box_alignment_mask literal_props.ifc_definition_id = ifc_literal.id() - from blenderbim.bim.module.drawing.data import DecoratorData + from bonsai.bim.module.drawing.data import DecoratorData text_data = DecoratorData.get_ifc_text_data(obj) props.font_size = str(text_data["FontSize"]) @@ -958,7 +959,7 @@ class Drawing(blenderbim.core.tool.Drawing): context=None, ifc_representation_class=None, ) -> Union[ifcopenshell.entity_instance, None]: - return blenderbim.core.root.assign_class( + return bonsai.core.root.assign_class( tool.Ifc, tool.Collector, tool.Root, @@ -998,7 +999,7 @@ class Drawing(blenderbim.core.tool.Drawing): """updates pset `EPset_Annotation.Classes` value based on current font size from `obj.BIMTextProperties.font_size` """ - from blenderbim.bim.module.drawing.data import FONT_SIZES + from bonsai.bim.module.drawing.data import FONT_SIZES props = obj.BIMTextProperties element = tool.Ifc.get_entity(obj) @@ -1206,7 +1207,7 @@ class Drawing(blenderbim.core.tool.Drawing): reference_element: ifcopenshell.entity_instance, context: ifcopenshell.entity_instance, ) -> ifcopenshell.entity_instance: - import blenderbim.bim.module.drawing.helper as helper + import bonsai.bim.module.drawing.helper as helper camera = tool.Ifc.get_object(drawing) bounds = helper.ortho_view_frame(camera.data) if camera.data.type == "ORTHO" else None @@ -1273,7 +1274,7 @@ class Drawing(blenderbim.core.tool.Drawing): reference_element: ifcopenshell.entity_instance, context: ifcopenshell.entity_instance, ) -> ifcopenshell.entity_instance: - import blenderbim.bim.module.drawing.helper as helper + import bonsai.bim.module.drawing.helper as helper reference_obj = tool.Ifc.get_object(reference_element) reference_obj.matrix_world @@ -1397,7 +1398,7 @@ class Drawing(blenderbim.core.tool.Drawing): reference_element: ifcopenshell.entity_instance, context: ifcopenshell.entity_instance, ) -> ifcopenshell.entity_instance: - import blenderbim.bim.module.drawing.helper as helper + import bonsai.bim.module.drawing.helper as helper target_view = tool.Drawing.get_drawing_target_view(drawing) @@ -1569,7 +1570,7 @@ class Drawing(blenderbim.core.tool.Drawing): return cls.sync_grid_axis_object_placement(obj, element) if not hasattr(element, "ObjectPlacement"): return - blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj) + bonsai.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj) return element @classmethod @@ -1883,7 +1884,7 @@ class Drawing(blenderbim.core.tool.Drawing): break priority_representation = ifcopenshell.util.representation.get_representation(element, *subcontext) if priority_representation: - blenderbim.core.geometry.switch_representation( + bonsai.core.geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, diff --git a/src/bonsai/bonsai/tool/geometry.py b/src/bonsai/bonsai/tool/geometry.py index a9370c34f8..1f99323683 100644 --- a/src/bonsai/bonsai/tool/geometry.py +++ b/src/bonsai/bonsai/tool/geometry.py @@ -29,23 +29,23 @@ import ifcopenshell.guid import ifcopenshell.util.element import ifcopenshell.util.representation import ifcopenshell.util.system -import blenderbim.core.tool -import blenderbim.core.drawing -import blenderbim.core.style -import blenderbim.core.spatial -import blenderbim.core.system -import blenderbim.core.geometry -import blenderbim.tool as tool -import blenderbim.bim.import_ifc +import bonsai.core.tool +import bonsai.core.drawing +import bonsai.core.geometry +import bonsai.core.spatial +import bonsai.core.style +import bonsai.core.system +import bonsai.tool as tool +import bonsai.bim.import_ifc from collections import defaultdict from math import radians, pi from mathutils import Vector, Matrix -from blenderbim.bim.ifc import IfcStore +from bonsai.bim.ifc import IfcStore from typing import Union, Iterable, Optional, Literal from typing import Iterator -class Geometry(blenderbim.core.tool.Geometry): +class Geometry(bonsai.core.tool.Geometry): @classmethod def change_object_data(cls, obj: bpy.types.Object, data: bpy.types.ID, is_global: bool = False) -> None: if is_global: @@ -97,7 +97,7 @@ class Geometry(blenderbim.core.tool.Geometry): if not element: return if element.is_a("IfcAnnotation") and element.ObjectType == "DRAWING": - return blenderbim.core.drawing.remove_drawing(tool.Ifc, tool.Drawing, drawing=element) + return bonsai.core.drawing.remove_drawing(tool.Ifc, tool.Drawing, drawing=element) if element.is_a("IfcRelSpaceBoundary"): ifcopenshell.api.run("boundary.remove_boundary", tool.Ifc.get(), boundary=element) return bpy.data.objects.remove(obj) @@ -143,7 +143,7 @@ class Geometry(blenderbim.core.tool.Geometry): for rel in element.HasOpenings: bpy.ops.bim.remove_opening(opening_id=rel.RelatedOpeningElement.id()) for port in ifcopenshell.util.system.get_ports(element): - blenderbim.core.system.remove_port(tool.Ifc, tool.System, port=port) + bonsai.core.system.remove_port(tool.Ifc, tool.System, port=port) ifcopenshell.api.run("root.remove_product", tool.Ifc.get(), product=element) if isinstance(obj.data, bpy.types.Mesh) and not tool.Ifc.get_entity_by_id( @@ -152,7 +152,7 @@ class Geometry(blenderbim.core.tool.Geometry): tool.Blender.remove_data_block(obj.data) if is_spatial: - blenderbim.core.spatial.import_spatial_decomposition(tool.Spatial) + bonsai.core.spatial.import_spatial_decomposition(tool.Spatial) try: obj.name bpy.data.objects.remove(obj) @@ -576,7 +576,7 @@ class Geometry(blenderbim.core.tool.Geometry): cls, obj: bpy.types.Object, representation: ifcopenshell.entity_instance, apply_openings: bool = True ) -> Union[bpy.types.Mesh, bpy.types.Curve]: logger = logging.getLogger("ImportIFC") - ifc_import_settings = blenderbim.bim.import_ifc.IfcImportSettings.factory(bpy.context, None, logger) + ifc_import_settings = bonsai.bim.import_ifc.IfcImportSettings.factory(bpy.context, None, logger) element = tool.Ifc.get_entity(obj) assert element # Type checker. settings = ifcopenshell.geom.settings() @@ -606,7 +606,7 @@ class Geometry(blenderbim.core.tool.Geometry): settings.set("dimensionality", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS) shape = ifcopenshell.geom.create_shape(settings, element, representation) - ifc_importer = blenderbim.bim.import_ifc.IfcImporter(ifc_import_settings) + ifc_importer = bonsai.bim.import_ifc.IfcImporter(ifc_import_settings) ifc_importer.file = tool.Ifc.get() if element.is_a("IfcAnnotation") and element.ObjectType == "DRAWING": @@ -796,7 +796,7 @@ class Geometry(blenderbim.core.tool.Geometry): @classmethod def run_style_add_style(cls, obj: bpy.types.Material) -> ifcopenshell.entity_instance: - return blenderbim.core.style.add_style(tool.Ifc, tool.Style, obj=obj) + return bonsai.core.style.add_style(tool.Ifc, tool.Style, obj=obj) @classmethod def select_connection(cls, connection: ifcopenshell.entity_instance) -> None: @@ -899,7 +899,7 @@ class Geometry(blenderbim.core.tool.Geometry): as it will handle those complications by itself. """ representation = tool.Ifc.get().by_id(obj.data.BIMMeshProperties.ifc_definition_id) - blenderbim.core.geometry.switch_representation( + bonsai.core.geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, @@ -937,7 +937,7 @@ class Geometry(blenderbim.core.tool.Geometry): cls.recreate_object_with_data(obj, None) return - blenderbim.core.geometry.switch_representation( + bonsai.core.geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, diff --git a/src/bonsai/bonsai/tool/georeference.py b/src/bonsai/bonsai/tool/georeference.py index 885d60cbb1..9cd80ce993 100644 --- a/src/bonsai/bonsai/tool/georeference.py +++ b/src/bonsai/bonsai/tool/georeference.py @@ -24,13 +24,13 @@ import ifcopenshell.api.georeference import ifcopenshell.util.geolocation import ifcopenshell.util.placement import ifcopenshell.util.unit -import blenderbim.core.tool -import blenderbim.tool as tool -import blenderbim.bim.helper +import bonsai.core.tool +import bonsai.tool as tool +import bonsai.bim.helper from typing import Any, Union, Literal -class Georeference(blenderbim.core.tool.Georeference): +class Georeference(bonsai.core.tool.Georeference): COORDINATE_TYPE = Literal["blender", "local", "map"] @classmethod @@ -69,7 +69,7 @@ class Georeference(blenderbim.core.tool.Georeference): for context in tool.Ifc.get().by_type("IfcGeometricRepresentationContext", include_subtypes=False): if context.HasCoordinateOperation: projected_crs = context.HasCoordinateOperation[0].TargetCRS - blenderbim.bim.helper.import_attributes2(projected_crs, props.projected_crs, callback=callback) + bonsai.bim.helper.import_attributes2(projected_crs, props.projected_crs, callback=callback) return @classmethod @@ -125,7 +125,7 @@ class Georeference(blenderbim.core.tool.Georeference): for context in tool.Ifc.get().by_type("IfcGeometricRepresentationContext", include_subtypes=False): if context.HasCoordinateOperation: coordinate_operation = context.HasCoordinateOperation[0] - blenderbim.bim.helper.import_attributes2( + bonsai.bim.helper.import_attributes2( coordinate_operation, props.coordinate_operation, callback=callback ) return @@ -160,7 +160,7 @@ class Georeference(blenderbim.core.tool.Georeference): return True props = bpy.context.scene.BIMGeoreferenceProperties - return blenderbim.bim.helper.export_attributes(props.projected_crs, callback=callback) + return bonsai.bim.helper.export_attributes(props.projected_crs, callback=callback) @classmethod def export_coordinate_operation(cls) -> dict[str, Any]: @@ -191,7 +191,7 @@ class Georeference(blenderbim.core.tool.Georeference): return True props = bpy.context.scene.BIMGeoreferenceProperties - return blenderbim.bim.helper.export_attributes(props.coordinate_operation, callback=callback) + return bonsai.bim.helper.export_attributes(props.coordinate_operation, callback=callback) @classmethod def get_true_north_attributes(cls) -> Union[list[float], None]: diff --git a/src/bonsai/bonsai/tool/ifc.py b/src/bonsai/bonsai/tool/ifc.py index a3a0b90b7b..7e3675a966 100644 --- a/src/bonsai/bonsai/tool/ifc.py +++ b/src/bonsai/bonsai/tool/ifc.py @@ -22,14 +22,14 @@ import numpy as np import ifcopenshell.api import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper import ifcopenshell.util.element -import blenderbim.core.tool -import blenderbim.bim.handler -import blenderbim.tool as tool -from blenderbim.bim.ifc import IfcStore, IFC_CONNECTED_TYPE +import bonsai.core.tool +import bonsai.bim.handler +import bonsai.tool as tool +from bonsai.bim.ifc import IfcStore, IFC_CONNECTED_TYPE from typing import Optional, Union, Any, final, Literal -class Ifc(blenderbim.core.tool.Ifc): +class Ifc(bonsai.core.tool.Ifc): OBJECT_TYPE = Literal[ "Object", "Material", @@ -154,9 +154,9 @@ class Ifc(blenderbim.core.tool.Ifc): if global_id: IfcStore.guid_map[global_id] = obj - blenderbim.bim.handler.subscribe_to(obj, "name", blenderbim.bim.handler.name_callback) - blenderbim.bim.handler.subscribe_to( - obj, "active_material_index", blenderbim.bim.handler.active_material_index_callback + bonsai.bim.handler.subscribe_to(obj, "name", bonsai.bim.handler.name_callback) + bonsai.bim.handler.subscribe_to( + obj, "active_material_index", bonsai.bim.handler.active_material_index_callback ) for obj in bpy.data.materials: @@ -172,7 +172,7 @@ class Ifc(blenderbim.core.tool.Ifc): if style: IfcStore.id_map[style.id()] = obj - blenderbim.bim.handler.subscribe_to(obj, "name", blenderbim.bim.handler.name_callback) + bonsai.bim.handler.subscribe_to(obj, "name", bonsai.bim.handler.name_callback) @classmethod def link(cls, element: ifcopenshell.entity_instance, obj: IFC_CONNECTED_TYPE) -> None: @@ -242,7 +242,7 @@ class Ifc(blenderbim.core.tool.Ifc): @final def execute(self, context): IfcStore.execute_ifc_operator(self, context) - blenderbim.bim.handler.refresh_ui_data() + bonsai.bim.handler.refresh_ui_data() return {"FINISHED"} # NOTE: this class can't inherit from abc.ABC to use abc.abstractmethod diff --git a/src/bonsai/bonsai/tool/ifcgit.py b/src/bonsai/bonsai/tool/ifcgit.py index eb0dae5c96..222239598d 100644 --- a/src/bonsai/bonsai/tool/ifcgit.py +++ b/src/bonsai/bonsai/tool/ifcgit.py @@ -21,9 +21,9 @@ import os import re import bpy import logging -from blenderbim.bim import import_ifc -from blenderbim.bim.ifc import IfcStore -import blenderbim.tool as tool +from bonsai.bim import import_ifc +from bonsai.bim.ifc import IfcStore +import bonsai.tool as tool from typing import TYPE_CHECKING, Union # allows git import even if git executable isn't found diff --git a/src/bonsai/bonsai/tool/library.py b/src/bonsai/bonsai/tool/library.py index cdcb3362d5..a3a49df986 100644 --- a/src/bonsai/bonsai/tool/library.py +++ b/src/bonsai/bonsai/tool/library.py @@ -17,11 +17,11 @@ # along with Bonsai. If not, see . import bpy -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool -class Library(blenderbim.core.tool.Library): +class Library(bonsai.core.tool.Library): @classmethod def clear_editing_mode(cls): bpy.context.scene.BIMLibraryProperties.editing_mode = "" @@ -29,12 +29,12 @@ class Library(blenderbim.core.tool.Library): @classmethod def export_library_attributes(cls): props = bpy.context.scene.BIMLibraryProperties - return blenderbim.bim.helper.export_attributes(props.library_attributes) + return bonsai.bim.helper.export_attributes(props.library_attributes) @classmethod def export_reference_attributes(cls): props = bpy.context.scene.BIMLibraryProperties - return blenderbim.bim.helper.export_attributes(props.reference_attributes) + return bonsai.bim.helper.export_attributes(props.reference_attributes) @classmethod def get_active_library(cls): @@ -48,13 +48,13 @@ class Library(blenderbim.core.tool.Library): def import_library_attributes(cls, library): props = bpy.context.scene.BIMLibraryProperties props.library_attributes.clear() - blenderbim.bim.helper.import_attributes2(library, props.library_attributes) + bonsai.bim.helper.import_attributes2(library, props.library_attributes) @classmethod def import_reference_attributes(cls, reference): props = bpy.context.scene.BIMLibraryProperties props.reference_attributes.clear() - blenderbim.bim.helper.import_attributes2(reference, props.reference_attributes) + bonsai.bim.helper.import_attributes2(reference, props.reference_attributes) @classmethod def import_references(cls, library): diff --git a/src/bonsai/bonsai/tool/loader.py b/src/bonsai/bonsai/tool/loader.py index b4d9eca463..96fef5d8da 100644 --- a/src/bonsai/bonsai/tool/loader.py +++ b/src/bonsai/bonsai/tool/loader.py @@ -27,9 +27,9 @@ import ifcopenshell.util.geolocation import ifcopenshell.util.placement import ifcopenshell.util.shape import ifcopenshell.util.unit -import blenderbim.core.tool -import blenderbim.tool as tool -import blenderbim.bim.import_ifc +import bonsai.core.tool +import bonsai.tool as tool +import bonsai.bim.import_ifc import numpy as np import numpy.typing as npt from mathutils import Vector, Matrix @@ -46,16 +46,16 @@ from typing import Union OBJECT_DATA_TYPE = Union[bpy.types.Mesh, bpy.types.Curve] -class Loader(blenderbim.core.tool.Loader): +class Loader(bonsai.core.tool.Loader): unit_scale: float = 1 - settings: blenderbim.bim.import_ifc.IfcImportSettings = None + settings: bonsai.bim.import_ifc.IfcImportSettings = None @classmethod def set_unit_scale(cls, unit_scale: float) -> None: cls.unit_scale = unit_scale @classmethod - def set_settings(cls, settings: blenderbim.bim.import_ifc.IfcImportSettings) -> None: + def set_settings(cls, settings: bonsai.bim.import_ifc.IfcImportSettings) -> None: cls.settings = settings @classmethod diff --git a/src/bonsai/bonsai/tool/material.py b/src/bonsai/bonsai/tool/material.py index 4fc03c98e1..48359829c8 100644 --- a/src/bonsai/bonsai/tool/material.py +++ b/src/bonsai/bonsai/tool/material.py @@ -20,10 +20,10 @@ from __future__ import annotations import bpy import ifcopenshell import ifcopenshell.api.material -import blenderbim.core.tool -import blenderbim.core.material -import blenderbim.tool as tool -import blenderbim.bim.helper +import bonsai.core.tool +import bonsai.core.material +import bonsai.tool as tool +import bonsai.bim.helper import ifcopenshell.util.unit import ifcopenshell.util.element from collections import defaultdict @@ -31,10 +31,10 @@ from typing import Union, Any, TYPE_CHECKING, Optional if TYPE_CHECKING: # Avoid circular imports. - from blenderbim.bim.module.material.prop import Material as MaterialItem + from bonsai.bim.module.material.prop import Material as MaterialItem -class Material(blenderbim.core.tool.Material): +class Material(bonsai.core.tool.Material): @classmethod def disable_editing_materials(cls) -> None: bpy.context.scene.BIMMaterialProperties.is_editing = False @@ -151,7 +151,7 @@ class Material(blenderbim.core.tool.Material): def load_material_attributes(cls, material: ifcopenshell.entity_instance) -> None: props = bpy.context.scene.BIMMaterialProperties props.material_attributes.clear() - blenderbim.bim.helper.import_attributes2(material, props.material_attributes) + bonsai.bim.helper.import_attributes2(material, props.material_attributes) @classmethod def enable_editing_material(cls, material: ifcopenshell.entity_instance) -> None: @@ -161,7 +161,7 @@ class Material(blenderbim.core.tool.Material): @classmethod def get_material_attributes(cls) -> dict[str, Any]: - return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMMaterialProperties.material_attributes) + return bonsai.bim.helper.export_attributes(bpy.context.scene.BIMMaterialProperties.material_attributes) @classmethod def disable_editing_material(cls) -> None: @@ -275,7 +275,7 @@ class Material(blenderbim.core.tool.Material): if not material: material = tool.Ifc.get().by_type("IfcMaterial")[0] else: - blenderbim.core.material.unassign_material(tool.Ifc, tool.Material, objects=[tool.Ifc.get_object(element)]) + bonsai.core.material.unassign_material(tool.Ifc, tool.Material, objects=[tool.Ifc.get_object(element)]) tool.Ifc.run("material.assign_material", products=[element], type="IfcMaterialProfileSet", material=material) assinged_material = cls.get_material(element) material_profile = tool.Ifc.run("material.add_profile", profile_set=assinged_material, material=material) diff --git a/src/bonsai/bonsai/tool/misc.py b/src/bonsai/bonsai/tool/misc.py index d8dbd7c38d..8a94436954 100644 --- a/src/bonsai/bonsai/tool/misc.py +++ b/src/bonsai/bonsai/tool/misc.py @@ -19,14 +19,14 @@ import bpy import bmesh import ifcopenshell -import blenderbim.core.tool -import blenderbim.core.root -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.core.root +import bonsai.tool as tool from mathutils import Vector, Matrix -from blenderbim.bim.ifc import IfcStore +from bonsai.bim.ifc import IfcStore -class Misc(blenderbim.core.tool.Misc): +class Misc(bonsai.core.tool.Misc): @classmethod def get_object_storey(cls, obj): storey = ifcopenshell.util.element.get_container(tool.Ifc.get_entity(obj)) @@ -78,7 +78,7 @@ class Misc(blenderbim.core.tool.Misc): @classmethod def run_root_copy_class(cls, obj=None): - return blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=obj) + return bonsai.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=obj) @classmethod def scale_object_to_height(cls, obj, height): diff --git a/src/bonsai/bonsai/tool/model.py b/src/bonsai/bonsai/tool/model.py index ce972060e4..4b549364b6 100644 --- a/src/bonsai/bonsai/tool/model.py +++ b/src/bonsai/bonsai/tool/model.py @@ -28,25 +28,25 @@ import ifcopenshell.util.element import ifcopenshell.util.unit import ifcopenshell.util.placement import ifcopenshell.util.representation -import blenderbim.core.geometry -import blenderbim.core.tool -import blenderbim.tool as tool -import blenderbim.core.geometry as geometry +import bonsai.core.geometry +import bonsai.core.tool +import bonsai.tool as tool +import bonsai.core.geometry as geometry from math import atan, degrees from mathutils import Matrix, Vector from copy import deepcopy from functools import partial -from blenderbim.bim import import_ifc -from blenderbim.bim.module.geometry.helper import Helper -from blenderbim.bim.module.model.data import AuthoringData, RailingData, RoofData, WindowData, DoorData -from blenderbim.bim.module.model.opening import FilledOpeningGenerator +from bonsai.bim import import_ifc +from bonsai.bim.module.geometry.helper import Helper +from bonsai.bim.module.model.data import AuthoringData, RailingData, RoofData, WindowData, DoorData +from bonsai.bim.module.model.opening import FilledOpeningGenerator from ifcopenshell.util.shape_builder import V, ShapeBuilder from typing import Optional, Union, TypeVar, Any, Iterable, Literal T = TypeVar("T") -class Model(blenderbim.core.tool.Model): +class Model(bonsai.core.tool.Model): @classmethod def convert_si_to_unit(cls, value: T) -> T: if isinstance(value, (tuple, list)): @@ -897,7 +897,7 @@ class Model(blenderbim.core.tool.Model): def sync_object_ifc_position(cls, obj): """make sure IFC position will be in sync with the Blender object position, if object was moved in Blender""" if tool.Ifc.is_moved(obj): - blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj) + bonsai.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj) @classmethod def get_element_matrix(cls, element, keep_local=False): @@ -930,7 +930,7 @@ class Model(blenderbim.core.tool.Model): continue element = tool.Ifc.get_entity(obj) body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW") - blenderbim.core.geometry.switch_representation( + bonsai.core.geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, diff --git a/src/bonsai/bonsai/tool/nest.py b/src/bonsai/bonsai/tool/nest.py index f8beabed06..f971981a92 100644 --- a/src/bonsai/bonsai/tool/nest.py +++ b/src/bonsai/bonsai/tool/nest.py @@ -16,12 +16,12 @@ # You should have received a copy of the GNU General Public License # along with Bonsai. If not, see . -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import ifcopenshell.util.element -class Nest(blenderbim.core.tool.Nest): +class Nest(bonsai.core.tool.Nest): @classmethod def can_nest(cls, relating_obj, related_obj): relating_object = tool.Ifc.get_entity(relating_obj) diff --git a/src/bonsai/bonsai/tool/owner.py b/src/bonsai/bonsai/tool/owner.py index 9328cc4db4..8686a9b7de 100644 --- a/src/bonsai/bonsai/tool/owner.py +++ b/src/bonsai/bonsai/tool/owner.py @@ -17,14 +17,14 @@ # along with Bonsai. If not, see . import bpy -import blenderbim.core.tool -import blenderbim.tool as tool -import blenderbim.bim.helper +import bonsai.core.tool +import bonsai.tool as tool +import bonsai.bim.helper import ifcopenshell from typing import Union, Any -class Owner(blenderbim.core.tool.Owner): +class Owner(bonsai.core.tool.Owner): @classmethod def set_user(cls, user: ifcopenshell.entity_instance) -> None: bpy.context.scene.BIMOwnerProperties.active_user_id = user.id() @@ -75,7 +75,7 @@ class Owner(blenderbim.core.tool.Owner): for line in data[name] or []: props.messaging_ids.add().name = line - blenderbim.bim.helper.import_attributes(address.is_a(), props.address_attributes, address.get_info(), callback) + bonsai.bim.helper.import_attributes(address.is_a(), props.address_attributes, address.get_info(), callback) @classmethod def clear_address(cls) -> None: @@ -88,7 +88,7 @@ class Owner(blenderbim.core.tool.Owner): @classmethod def export_address_attributes(cls) -> dict[str, Any]: props = bpy.context.scene.BIMOwnerProperties - attributes = blenderbim.bim.helper.export_attributes(props.address_attributes) + attributes = bonsai.bim.helper.export_attributes(props.address_attributes) if cls.get_address().is_a("IfcPostalAddress"): attributes["AddressLines"] = [l.name for l in props.address_lines] or None elif cls.get_address().is_a("IfcTelecomAddress"): @@ -136,9 +136,7 @@ class Owner(blenderbim.core.tool.Owner): props = bpy.context.scene.BIMOwnerProperties props.organisation_attributes.clear() - blenderbim.bim.helper.import_attributes( - "IfcOrganization", props.organisation_attributes, organisation.get_info() - ) + bonsai.bim.helper.import_attributes("IfcOrganization", props.organisation_attributes, organisation.get_info()) @classmethod def clear_organisation(cls) -> None: @@ -147,7 +145,7 @@ class Owner(blenderbim.core.tool.Owner): @classmethod def export_organisation_attributes(cls) -> dict[str, Any]: props = bpy.context.scene.BIMOwnerProperties - attributes = blenderbim.bim.helper.export_attributes(props.organisation_attributes) + attributes = bonsai.bim.helper.export_attributes(props.organisation_attributes) return attributes @classmethod @@ -178,7 +176,7 @@ class Owner(blenderbim.core.tool.Owner): for name in data["SuffixTitles"] or []: props.suffix_titles.add().name = name or "" - blenderbim.bim.helper.import_attributes("IfcPerson", props.person_attributes, person.get_info(), callback) + bonsai.bim.helper.import_attributes("IfcPerson", props.person_attributes, person.get_info(), callback) @classmethod def clear_person(cls) -> None: @@ -187,7 +185,7 @@ class Owner(blenderbim.core.tool.Owner): @classmethod def export_person_attributes(cls) -> dict[str, Any]: props = bpy.context.scene.BIMOwnerProperties - attributes = blenderbim.bim.helper.export_attributes(props.person_attributes) + attributes = bonsai.bim.helper.export_attributes(props.person_attributes) attributes["MiddleNames"] = [v.name for v in props.middle_names] if props.middle_names else None attributes["PrefixTitles"] = [v.name for v in props.prefix_titles] if props.prefix_titles else None attributes["SuffixTitles"] = [v.name for v in props.suffix_titles] if props.suffix_titles else None @@ -224,7 +222,7 @@ class Owner(blenderbim.core.tool.Owner): role = cls.get_role() props = bpy.context.scene.BIMOwnerProperties props.role_attributes.clear() - blenderbim.bim.helper.import_attributes("IfcActorRole", props.role_attributes, role.get_info()) + bonsai.bim.helper.import_attributes("IfcActorRole", props.role_attributes, role.get_info()) @classmethod def clear_role(cls) -> None: @@ -236,7 +234,7 @@ class Owner(blenderbim.core.tool.Owner): @classmethod def export_role_attributes(cls) -> dict[str, Any]: - return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMOwnerProperties.role_attributes) + return bonsai.bim.helper.export_attributes(bpy.context.scene.BIMOwnerProperties.role_attributes) @classmethod def set_actor(cls, actor: ifcopenshell.entity_instance) -> None: @@ -246,7 +244,7 @@ class Owner(blenderbim.core.tool.Owner): def import_actor_attributes(cls, actor: ifcopenshell.entity_instance) -> None: props = bpy.context.scene.BIMOwnerProperties props.actor_attributes.clear() - blenderbim.bim.helper.import_attributes2(actor, props.actor_attributes) + bonsai.bim.helper.import_attributes2(actor, props.actor_attributes) @classmethod def clear_actor(cls) -> None: @@ -255,7 +253,7 @@ class Owner(blenderbim.core.tool.Owner): @classmethod def export_actor_attributes(cls) -> dict[str, Any]: props = bpy.context.scene.BIMOwnerProperties - attributes = blenderbim.bim.helper.export_attributes(props.actor_attributes) + attributes = bonsai.bim.helper.export_attributes(props.actor_attributes) return attributes @classmethod diff --git a/src/bonsai/bonsai/tool/patch.py b/src/bonsai/bonsai/tool/patch.py index b0ec56a8b6..a465021714 100644 --- a/src/bonsai/bonsai/tool/patch.py +++ b/src/bonsai/bonsai/tool/patch.py @@ -18,7 +18,7 @@ import bpy import ifcopenshell -import blenderbim.core.tool +import bonsai.core.tool from typing import TYPE_CHECKING @@ -31,7 +31,7 @@ if TYPE_CHECKING: import ifcpatch -class Patch(blenderbim.core.tool.Patch): +class Patch(bonsai.core.tool.Patch): @classmethod def run_migrate_patch(cls, infile: str, outfile: str, schema: str) -> None: output = ifcpatch.execute( diff --git a/src/bonsai/bonsai/tool/profile.py b/src/bonsai/bonsai/tool/profile.py index b60a273759..637e5f8fef 100644 --- a/src/bonsai/bonsai/tool/profile.py +++ b/src/bonsai/bonsai/tool/profile.py @@ -22,14 +22,14 @@ import ifcopenshell.util.element import ifcopenshell.util.unit import ifcopenshell.util.placement import ifcopenshell.util.representation -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import PIL.ImageDraw -from blenderbim.bim.module.model.decorator import ProfileDecorator +from bonsai.bim.module.model.decorator import ProfileDecorator from typing import Union -class Profile(blenderbim.core.tool.Profile): +class Profile(bonsai.core.tool.Profile): @classmethod def draw_image_for_ifc_profile( cls, draw: PIL.ImageDraw.ImageDraw, profile: ifcopenshell.entity_instance, size: float diff --git a/src/bonsai/bonsai/tool/project.py b/src/bonsai/bonsai/tool/project.py index 848b630209..c2a6c71d0c 100644 --- a/src/bonsai/bonsai/tool/project.py +++ b/src/bonsai/bonsai/tool/project.py @@ -21,20 +21,20 @@ import bpy import ifcopenshell import ifcopenshell.util.representation import ifcopenshell.util.unit -import blenderbim.core.aggregate -import blenderbim.core.context -import blenderbim.core.tool -import blenderbim.core.root -import blenderbim.core.unit -import blenderbim.core.owner -import blenderbim.bim.schema -import blenderbim.tool as tool -from blenderbim.bim.ifc import IfcStore +import bonsai.core.aggregate +import bonsai.core.context +import bonsai.core.tool +import bonsai.core.root +import bonsai.core.unit +import bonsai.core.owner +import bonsai.bim.schema +import bonsai.tool as tool +from bonsai.bim.ifc import IfcStore from pathlib import Path from typing import Optional -class Project(blenderbim.core.tool.Project): +class Project(bonsai.core.tool.Project): @classmethod def append_all_types_from_template(cls, template: str) -> None: # TODO refactor @@ -60,17 +60,17 @@ class Project(blenderbim.core.tool.Project): pset_dir = tool.Ifc.resolve_uri(bpy.context.scene.BIMProperties.pset_dir) if os.path.isdir(pset_dir): for path in Path(pset_dir).glob("*.ifc"): - blenderbim.bim.schema.ifc.psetqto.templates.append(ifcopenshell.open(path)) + bonsai.bim.schema.ifc.psetqto.templates.append(ifcopenshell.open(path)) @classmethod def run_aggregate_assign_object(cls, relating_obj=None, related_obj=None): - return blenderbim.core.aggregate.assign_object( + return bonsai.core.aggregate.assign_object( tool.Ifc, tool.Aggregate, tool.Collector, relating_obj=relating_obj, related_obj=related_obj ) @classmethod def run_context_add_context(cls, context_type=None, context_identifier=None, target_view=None, parent=None): - return blenderbim.core.context.add_context( + return bonsai.core.context.add_context( tool.Ifc, context_type=context_type, context_identifier=context_identifier, @@ -80,19 +80,19 @@ class Project(blenderbim.core.tool.Project): @classmethod def run_owner_add_organisation(cls): - return blenderbim.core.owner.add_organisation(tool.Ifc) + return bonsai.core.owner.add_organisation(tool.Ifc) @classmethod def run_owner_add_person(cls): - return blenderbim.core.owner.add_person(tool.Ifc) + return bonsai.core.owner.add_person(tool.Ifc) @classmethod def run_owner_add_person_and_organisation(cls, person=None, organisation=None): - return blenderbim.core.owner.add_person_and_organisation(tool.Ifc, person=person, organisation=organisation) + return bonsai.core.owner.add_person_and_organisation(tool.Ifc, person=person, organisation=organisation) @classmethod def run_owner_set_user(cls, user=None): - return blenderbim.core.owner.set_user(tool.Owner, user=user) + return bonsai.core.owner.set_user(tool.Owner, user=user) @classmethod def run_root_assign_class( @@ -104,7 +104,7 @@ class Project(blenderbim.core.tool.Project): context: Optional[ifcopenshell.entity_instance] = None, ifc_representation_class: Optional[str] = None, ) -> ifcopenshell.entity_instance: - return blenderbim.core.root.assign_class( + return bonsai.core.root.assign_class( tool.Ifc, tool.Collector, tool.Root, @@ -118,11 +118,11 @@ class Project(blenderbim.core.tool.Project): @classmethod def run_unit_assign_scene_units(cls): - return blenderbim.core.unit.assign_scene_units(tool.Ifc, tool.Unit) + return bonsai.core.unit.assign_scene_units(tool.Ifc, tool.Unit) @classmethod def set_context(cls, context): - blenderbim.bim.handler.refresh_ui_data() + bonsai.bim.handler.refresh_ui_data() bpy.context.scene.BIMRootProperties.contexts = str(context.id()) @classmethod diff --git a/src/bonsai/bonsai/tool/pset.py b/src/bonsai/bonsai/tool/pset.py index 6ceaee4cdf..9cfef32dfb 100644 --- a/src/bonsai/bonsai/tool/pset.py +++ b/src/bonsai/bonsai/tool/pset.py @@ -20,14 +20,14 @@ import bpy import ifcopenshell import ifcopenshell.util.attribute import ifcopenshell.util.element -import blenderbim.core.tool -import blenderbim.tool as tool -import blenderbim.bim.schema +import bonsai.core.tool +import bonsai.tool as tool +import bonsai.bim.schema from typing import Union, Literal, Any from typing_extensions import assert_never -class Pset(blenderbim.core.tool.Pset): +class Pset(bonsai.core.tool.Pset): PSET_TYPE = Literal["PSET", "QTO"] @classmethod @@ -72,7 +72,7 @@ class Pset(blenderbim.core.tool.Pset): def is_pset_applicable(cls, element: ifcopenshell.entity_instance, pset_name: str) -> bool: return bool( pset_name - in blenderbim.bim.schema.ifc.psetqto.get_applicable_names( + in bonsai.bim.schema.ifc.psetqto.get_applicable_names( element.is_a(), ifcopenshell.util.element.get_predefined_type(element), pset_only=True ) ) @@ -219,7 +219,7 @@ class Pset(blenderbim.core.tool.Pset): metadata.bool_value = False if metadata.is_null else bool(data[prop_template.Name]) metadata.ifc_class = pset_template.Name - blenderbim.bim.helper.add_attribute_description(metadata, prop_template) + bonsai.bim.helper.add_attribute_description(metadata, prop_template) @classmethod def import_pset_from_template( @@ -273,7 +273,7 @@ class Pset(blenderbim.core.tool.Pset): @classmethod def get_pset_template(cls, name: str) -> Union[ifcopenshell.entity_instance, None]: - return blenderbim.bim.schema.ifc.psetqto.get_by_name(name) + return bonsai.bim.schema.ifc.psetqto.get_by_name(name) @classmethod def add_proposed_property(cls, name: str, value: Any, props: bpy.types.PropertyGroup) -> None: diff --git a/src/bonsai/bonsai/tool/qto.py b/src/bonsai/bonsai/tool/qto.py index 2e33d15929..803a00e560 100644 --- a/src/bonsai/bonsai/tool/qto.py +++ b/src/bonsai/bonsai/tool/qto.py @@ -17,9 +17,9 @@ # along with Bonsai. If not, see . import bpy -import blenderbim.core.tool -import blenderbim.bim.schema -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.bim.schema +import bonsai.tool as tool import ifcopenshell import ifcopenshell.util.unit import ifcopenshell.util.element @@ -29,7 +29,7 @@ from typing import Optional, Union, Literal QuantityTypes = Literal["Q_LENGTH", "Q_AREA", "Q_VOLUME"] -class Qto(blenderbim.core.tool.Qto): +class Qto(bonsai.core.tool.Qto): @classmethod def get_radius_of_selected_vertices(cls, obj: bpy.types.Object) -> float: selected_verts = [v.co for v in obj.data.vertices if v.select] @@ -65,7 +65,7 @@ class Qto(blenderbim.core.tool.Qto): "Q_VOLUME": ("VOLUMEUNIT", "CUBIC_METRE"), } if not quantity_type: - qt = blenderbim.bim.schema.ifc.psetqto.get_by_name(qto_name) + qt = bonsai.bim.schema.ifc.psetqto.get_by_name(qto_name) quantity_type = next(q.TemplateType for q in qt.HasPropertyTemplates if q.Name == quantity_name) unit_type = quantity_to_unit_types.get(quantity_type, None) @@ -128,7 +128,7 @@ class Qto(blenderbim.core.tool.Qto): Example: .. code::Python - import blenderbim.tool as tool + import bonsai.tool as tool relating_cost_items = tool.Qto.relating_cost_items(my_beautiful_wall) for relating_cost_item in relating_cost_items: diff --git a/src/bonsai/bonsai/tool/raycast.py b/src/bonsai/bonsai/tool/raycast.py index b74e21c3e0..4acdf63dcd 100644 --- a/src/bonsai/bonsai/tool/raycast.py +++ b/src/bonsai/bonsai/tool/raycast.py @@ -18,14 +18,14 @@ import bpy from bpy_extras import view3d_utils -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import math import mathutils from mathutils import Matrix, Vector -class Raycast(blenderbim.core.tool.Raycast): +class Raycast(bonsai.core.tool.Raycast): @classmethod def get_visible_objects(cls, context): depsgraph = context.evaluated_depsgraph_get() diff --git a/src/bonsai/bonsai/tool/resource.py b/src/bonsai/bonsai/tool/resource.py index 954359056d..fd32ede494 100644 --- a/src/bonsai/bonsai/tool/resource.py +++ b/src/bonsai/bonsai/tool/resource.py @@ -19,24 +19,22 @@ # ############################################################################ # import bpy -import blenderbim.core.tool -import blenderbim.tool as tool -import blenderbim.bim.helper -import blenderbim.bim.module.sequence.helper as helper +import bonsai.core.tool +import bonsai.tool as tool +import bonsai.bim.helper +import bonsai.bim.module.sequence.helper as helper import json import time import isodate from datetime import datetime -from dateutil import parser import ifcopenshell.util.date as ifcdateutils import ifcopenshell.util.cost import ifcopenshell.util.resource -import blenderbim.bim.schema import ifcopenshell.util.constraint from typing import Any, Union -class Resource(blenderbim.core.tool.Resource): +class Resource(bonsai.core.tool.Resource): @classmethod def load_resources(cls) -> None: def create_new_resource_li(resource, level_index): @@ -91,7 +89,7 @@ class Resource(blenderbim.core.tool.Resource): @classmethod def load_resource_attributes(cls, resource: ifcopenshell.entity_instance) -> None: - blenderbim.bim.helper.import_attributes2(resource, bpy.context.scene.BIMResourceProperties.resource_attributes) + bonsai.bim.helper.import_attributes2(resource, bpy.context.scene.BIMResourceProperties.resource_attributes) @classmethod def enable_editing_resource(cls, resource: ifcopenshell.entity_instance) -> None: @@ -102,7 +100,7 @@ class Resource(blenderbim.core.tool.Resource): @classmethod def get_resource_attributes(cls) -> dict[str, Any]: - return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMResourceProperties.resource_attributes) + return bonsai.bim.helper.export_attributes(bpy.context.scene.BIMResourceProperties.resource_attributes) @classmethod def enable_editing_resource_time(cls, resource: ifcopenshell.entity_instance) -> None: @@ -127,7 +125,7 @@ class Resource(blenderbim.core.tool.Resource): prop.string_value = "" if prop.is_null else ifcdateutils.datetime2ifc(data[name], "IfcDuration") return True - blenderbim.bim.helper.import_attributes2( + bonsai.bim.helper.import_attributes2( resource_time, bpy.context.scene.BIMResourceProperties.resource_time_attributes, callback ) @@ -148,7 +146,7 @@ class Resource(blenderbim.core.tool.Resource): return True props = bpy.context.scene.BIMResourceProperties - return blenderbim.bim.helper.export_attributes(props.resource_time_attributes, callback) + return bonsai.bim.helper.export_attributes(props.resource_time_attributes, callback) @classmethod def enable_editing_resource_costs(cls, resource: ifcopenshell.entity_instance) -> None: @@ -221,7 +219,7 @@ class Resource(blenderbim.core.tool.Resource): return True props = bpy.context.scene.BIMResourceProperties - blenderbim.bim.helper.import_attributes2(cost_value, props.cost_value_attributes, callback) + bonsai.bim.helper.import_attributes2(cost_value, props.cost_value_attributes, callback) @classmethod def enable_editing_cost_value_attributes(cls, cost_value: ifcopenshell.entity_instance) -> None: @@ -255,7 +253,7 @@ class Resource(blenderbim.core.tool.Resource): if prop.name == "UnitBasisUnit": return True - return blenderbim.bim.helper.export_attributes( + return bonsai.bim.helper.export_attributes( bpy.context.scene.BIMResourceProperties.cost_value_attributes, callback ) @@ -271,7 +269,7 @@ class Resource(blenderbim.core.tool.Resource): props = bpy.context.scene.BIMResourceProperties props.quantity_attributes.clear() props.is_editing_quantity = True - blenderbim.bim.helper.import_attributes2(resource_quantity, props.quantity_attributes) + bonsai.bim.helper.import_attributes2(resource_quantity, props.quantity_attributes) @classmethod def disable_editing_resource_quantity(cls) -> None: @@ -279,7 +277,7 @@ class Resource(blenderbim.core.tool.Resource): @classmethod def get_resource_quantity_attributes(cls) -> dict[str, Any]: - return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMResourceProperties.quantity_attributes) + return bonsai.bim.helper.export_attributes(bpy.context.scene.BIMResourceProperties.quantity_attributes) @classmethod def expand_resource(cls, resource: ifcopenshell.entity_instance) -> None: diff --git a/src/bonsai/bonsai/tool/root.py b/src/bonsai/bonsai/tool/root.py index 3e1f504b07..689dfe7531 100644 --- a/src/bonsai/bonsai/tool/root.py +++ b/src/bonsai/bonsai/tool/root.py @@ -22,17 +22,14 @@ import ifcopenshell.api import ifcopenshell.util.representation import ifcopenshell.util.element import ifcopenshell.util.placement -import blenderbim.core.tool -import blenderbim.core.root -import blenderbim.core.aggregate -import blenderbim.core.geometry -import blenderbim.core.material -import blenderbim.core.style -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.core.aggregate +import bonsai.core.geometry +import bonsai.tool as tool from typing import Union, Optional, Any -class Root(blenderbim.core.tool.Root): +class Root(bonsai.core.tool.Root): @classmethod def add_tracked_opening(cls, obj: bpy.types.Object) -> None: new = bpy.context.scene.BIMModelProperties.openings.add() @@ -244,7 +241,7 @@ class Root(blenderbim.core.tool.Root): for voided_obj in voided_objs: if voided_obj.data: representation = tool.Ifc.get().by_id(voided_obj.data.BIMMeshProperties.ifc_definition_id) - blenderbim.core.geometry.switch_representation( + bonsai.core.geometry.switch_representation( tool.Ifc, tool.Geometry, obj=voided_obj, @@ -285,7 +282,7 @@ class Root(blenderbim.core.tool.Root): try: new_aggregate = old_to_new[old_aggregate] except: - blenderbim.core.aggregate.unassign_object( + bonsai.core.aggregate.unassign_object( tool.Ifc, tool.Aggregate, tool.Collector, @@ -294,7 +291,7 @@ class Root(blenderbim.core.tool.Root): ) continue - blenderbim.core.aggregate.assign_object( + bonsai.core.aggregate.assign_object( tool.Ifc, tool.Aggregate, tool.Collector, @@ -307,7 +304,7 @@ class Root(blenderbim.core.tool.Root): if pset: array_children = tool.Blender.Modifier.Array.get_all_children_objects(new[0]) for obj in array_children: - blenderbim.core.aggregate.assign_object( + bonsai.core.aggregate.assign_object( tool.Ifc, tool.Aggregate, tool.Collector, @@ -323,7 +320,7 @@ class Root(blenderbim.core.tool.Root): ifc_representation_class: Optional[str] = None, profile_set_usage: Optional[ifcopenshell.entity_instance] = None, ) -> ifcopenshell.entity_instance: - return blenderbim.core.geometry.add_representation( + return bonsai.core.geometry.add_representation( tool.Ifc, tool.Geometry, tool.Style, diff --git a/src/bonsai/bonsai/tool/search.py b/src/bonsai/bonsai/tool/search.py index e018d3aa12..a1b8a1f083 100644 --- a/src/bonsai/bonsai/tool/search.py +++ b/src/bonsai/bonsai/tool/search.py @@ -1,14 +1,14 @@ import bpy import json import lark -import blenderbim.core.tool +import bonsai.core.tool import ifcopenshell.guid import ifcopenshell.util.selector -from blenderbim.bim.prop import BIMFacet +from bonsai.bim.prop import BIMFacet from typing import Union, Literal -class Search(blenderbim.core.tool.Search): +class Search(bonsai.core.tool.Search): @classmethod def get_group_query(cls, group: ifcopenshell.entity_instance) -> str: return json.loads(group.Description)["query"] diff --git a/src/bonsai/bonsai/tool/sequence.py b/src/bonsai/bonsai/tool/sequence.py index 070d063437..960abd2f42 100644 --- a/src/bonsai/bonsai/tool/sequence.py +++ b/src/bonsai/bonsai/tool/sequence.py @@ -29,17 +29,16 @@ import ifcopenshell.util.sequence import ifcopenshell.util.date import ifcopenshell.util.element import ifcopenshell.util.unit -import blenderbim.core.tool -import blenderbim.core -import blenderbim.tool as tool -import blenderbim.bim.helper -import blenderbim.bim.module.sequence.helper as helper +import bonsai.core.tool +import bonsai.tool as tool +import bonsai.bim.helper +import bonsai.bim.module.sequence.helper as helper from dateutil import parser from datetime import datetime from typing import Optional, Any, Union -class Sequence(blenderbim.core.tool.Sequence): +class Sequence(bonsai.core.tool.Sequence): @classmethod def get_work_plan_attributes(cls) -> dict[str, Any]: def callback(attributes, prop): @@ -57,7 +56,7 @@ class Sequence(blenderbim.core.tool.Sequence): return True props = bpy.context.scene.BIMWorkPlanProperties - return blenderbim.bim.helper.export_attributes(props.work_plan_attributes, callback) + return bonsai.bim.helper.export_attributes(props.work_plan_attributes, callback) @classmethod def load_work_plan_attributes(cls, work_plan: ifcopenshell.entity_instance) -> None: @@ -68,7 +67,7 @@ class Sequence(blenderbim.core.tool.Sequence): props = bpy.context.scene.BIMWorkPlanProperties props.work_plan_attributes.clear() - blenderbim.bim.helper.import_attributes2(work_plan, props.work_plan_attributes, callback) + bonsai.bim.helper.import_attributes2(work_plan, props.work_plan_attributes, callback) @classmethod def enable_editing_work_plan(cls, work_plan: Union[ifcopenshell.entity_instance, None]) -> None: @@ -103,7 +102,7 @@ class Sequence(blenderbim.core.tool.Sequence): return True props = bpy.context.scene.BIMWorkScheduleProperties - return blenderbim.bim.helper.export_attributes(props.work_schedule_attributes, callback) + return bonsai.bim.helper.export_attributes(props.work_schedule_attributes, callback) @classmethod def load_work_schedule_attributes(cls, work_schedule: ifcopenshell.entity_instance) -> None: @@ -114,7 +113,7 @@ class Sequence(blenderbim.core.tool.Sequence): props = bpy.context.scene.BIMWorkScheduleProperties props.work_schedule_attributes.clear() - blenderbim.bim.helper.import_attributes2(work_schedule, props.work_schedule_attributes, callback) + bonsai.bim.helper.import_attributes2(work_schedule, props.work_schedule_attributes, callback) @classmethod def enable_editing_work_schedule(cls, work_schedule: ifcopenshell.entity_instance) -> None: @@ -323,7 +322,7 @@ class Sequence(blenderbim.core.tool.Sequence): def load_task_attributes(cls, task: ifcopenshell.entity_instance) -> None: props = bpy.context.scene.BIMWorkScheduleProperties props.task_attributes.clear() - blenderbim.bim.helper.import_attributes2(task, props.task_attributes) + bonsai.bim.helper.import_attributes2(task, props.task_attributes) @classmethod def enable_editing_task_attributes(cls, task: ifcopenshell.entity_instance) -> None: @@ -333,7 +332,7 @@ class Sequence(blenderbim.core.tool.Sequence): @classmethod def get_task_attributes(cls) -> dict[str, Any]: - return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMWorkScheduleProperties.task_attributes) + return bonsai.bim.helper.export_attributes(bpy.context.scene.BIMWorkScheduleProperties.task_attributes) @classmethod def load_task_time_attributes(cls, task_time: ifcopenshell.entity_instance) -> None: @@ -357,7 +356,7 @@ class Sequence(blenderbim.core.tool.Sequence): props = bpy.context.scene.BIMWorkScheduleProperties props.task_time_attributes.clear() props.durations_attributes.clear() - blenderbim.bim.helper.import_attributes2(task_time, props.task_time_attributes, callback) + bonsai.bim.helper.import_attributes2(task_time, props.task_time_attributes, callback) @classmethod def enable_editing_task_time(cls, task: ifcopenshell.entity_instance) -> None: @@ -399,7 +398,7 @@ class Sequence(blenderbim.core.tool.Sequence): return True props = bpy.context.scene.BIMWorkScheduleProperties - return blenderbim.bim.helper.export_attributes(props.task_time_attributes, callback) + return bonsai.bim.helper.export_attributes(props.task_time_attributes, callback) @classmethod def load_task_resources(cls, task: ifcopenshell.entity_instance) -> None: @@ -490,7 +489,7 @@ class Sequence(blenderbim.core.tool.Sequence): def load_work_calendar_attributes(cls, work_calendar: ifcopenshell.entity_instance) -> dict[str, Any]: props = bpy.context.scene.BIMWorkCalendarProperties props.work_calendar_attributes.clear() - return blenderbim.bim.helper.import_attributes2(work_calendar, props.work_calendar_attributes) + return bonsai.bim.helper.import_attributes2(work_calendar, props.work_calendar_attributes) @classmethod def enable_editing_work_calendar(cls, work_calendar: ifcopenshell.entity_instance) -> None: @@ -503,9 +502,7 @@ class Sequence(blenderbim.core.tool.Sequence): @classmethod def get_work_calendar_attributes(cls) -> dict[str, Any]: - return blenderbim.bim.helper.export_attributes( - bpy.context.scene.BIMWorkCalendarProperties.work_calendar_attributes - ) + return bonsai.bim.helper.export_attributes(bpy.context.scene.BIMWorkCalendarProperties.work_calendar_attributes) @classmethod def load_work_time_attributes(cls, work_time: ifcopenshell.entity_instance) -> None: @@ -517,7 +514,7 @@ class Sequence(blenderbim.core.tool.Sequence): props = bpy.context.scene.BIMWorkCalendarProperties props.work_time_attributes.clear() - blenderbim.bim.helper.import_attributes2(work_time, props.work_time_attributes, callback) + bonsai.bim.helper.import_attributes2(work_time, props.work_time_attributes, callback) @classmethod def enable_editing_work_time(cls, work_time: ifcopenshell.entity_instance) -> None: @@ -577,7 +574,7 @@ class Sequence(blenderbim.core.tool.Sequence): return True props = bpy.context.scene.BIMWorkCalendarProperties - return blenderbim.bim.helper.export_attributes(props.work_time_attributes, callback) + return bonsai.bim.helper.export_attributes(props.work_time_attributes, callback) @classmethod def get_recurrence_pattern_attributes(cls, recurrence_pattern): @@ -645,7 +642,7 @@ class Sequence(blenderbim.core.tool.Sequence): def load_rel_sequence_attributes(cls, rel_sequence: ifcopenshell.entity_instance) -> None: props = bpy.context.scene.BIMWorkScheduleProperties props.sequence_attributes.clear() - blenderbim.bim.helper.import_attributes2(rel_sequence, props.sequence_attributes) + bonsai.bim.helper.import_attributes2(rel_sequence, props.sequence_attributes) @classmethod def enable_editing_rel_sequence_attributes(cls, rel_sequence: ifcopenshell.entity_instance) -> None: @@ -669,7 +666,7 @@ class Sequence(blenderbim.core.tool.Sequence): props = bpy.context.scene.BIMWorkScheduleProperties props.lag_time_attributes.clear() - blenderbim.bim.helper.import_attributes2(lag_time, props.lag_time_attributes, callback) + bonsai.bim.helper.import_attributes2(lag_time, props.lag_time_attributes, callback) @classmethod def enable_editing_sequence_lag_time(cls, rel_sequence: ifcopenshell.entity_instance) -> None: @@ -679,7 +676,7 @@ class Sequence(blenderbim.core.tool.Sequence): @classmethod def get_rel_sequence_attributes(cls) -> dict[str, Any]: - return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMWorkScheduleProperties.sequence_attributes) + return bonsai.bim.helper.export_attributes(bpy.context.scene.BIMWorkScheduleProperties.sequence_attributes) @classmethod def disable_editing_rel_sequence(cls) -> None: @@ -687,7 +684,7 @@ class Sequence(blenderbim.core.tool.Sequence): @classmethod def get_lag_time_attributes(cls) -> dict[str, Any]: - return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMWorkScheduleProperties.lag_time_attributes) + return bonsai.bim.helper.export_attributes(bpy.context.scene.BIMWorkScheduleProperties.lag_time_attributes) @classmethod def select_products(cls, products): diff --git a/src/bonsai/bonsai/tool/snap.py b/src/bonsai/bonsai/tool/snap.py index d1a80c516e..30d99c5661 100644 --- a/src/bonsai/bonsai/tool/snap.py +++ b/src/bonsai/bonsai/tool/snap.py @@ -17,15 +17,15 @@ # along with Bonsai. If not, see . import bpy -import blenderbim.core.tool -import blenderbim.tool as tool -from blenderbim.bim.module.model.decorator import WallPolylineDecorator +import bonsai.core.tool +import bonsai.tool as tool +from bonsai.bim.module.model.decorator import WallPolylineDecorator import math import mathutils from mathutils import Matrix, Vector -class Snap(blenderbim.core.tool.Snap): +class Snap(bonsai.core.tool.Snap): @classmethod def get_snap_points_on_raycasted_obj(cls, obj, face_index): snap_points = {} diff --git a/src/bonsai/bonsai/tool/spatial.py b/src/bonsai/bonsai/tool/spatial.py index 6e9582bc34..4a455758e7 100644 --- a/src/bonsai/bonsai/tool/spatial.py +++ b/src/bonsai/bonsai/tool/spatial.py @@ -29,12 +29,12 @@ import ifcopenshell.util.representation import ifcopenshell.util.shape_builder import ifcopenshell.util.type import ifcopenshell.util.unit -import blenderbim.core.type -import blenderbim.core.tool -import blenderbim.core.root -import blenderbim.core.spatial -import blenderbim.core.geometry -import blenderbim.tool as tool +import bonsai.core.type +import bonsai.core.tool +import bonsai.core.root +import bonsai.core.spatial +import bonsai.core.geometry +import bonsai.tool as tool import json from math import pi from mathutils import Vector, Matrix @@ -42,7 +42,7 @@ from shapely import Polygon from typing import Generator, Optional, Union, Literal, List -class Spatial(blenderbim.core.tool.Spatial): +class Spatial(bonsai.core.tool.Spatial): @classmethod def can_contain(cls, container: ifcopenshell.entity_instance, element_obj: Union[bpy.types.Object, None]) -> bool: element = tool.Ifc.get_entity(element_obj) @@ -110,19 +110,19 @@ class Spatial(blenderbim.core.tool.Spatial): @classmethod def run_root_copy_class(cls, obj: bpy.types.Object) -> ifcopenshell.entity_instance: - return blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=obj) + return bonsai.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=obj) @classmethod def run_spatial_assign_container( cls, container: ifcopenshell.entity_instance, element_obj: bpy.types.Object ) -> Union[ifcopenshell.entity_instance, None]: - return blenderbim.core.spatial.assign_container( + return bonsai.core.spatial.assign_container( tool.Ifc, tool.Collector, tool.Spatial, container=container, element_obj=element_obj ) @classmethod def run_spatial_import_spatial_decomposition(cls) -> None: - return blenderbim.core.spatial.import_spatial_decomposition(tool.Spatial) + return bonsai.core.spatial.import_spatial_decomposition(tool.Spatial) @classmethod def select_object(cls, obj: bpy.types.Object) -> None: @@ -291,7 +291,7 @@ class Spatial(blenderbim.core.tool.Spatial): def edit_container_attributes(cls, entity: ifcopenshell.entity_instance) -> None: # TODO obj = tool.Ifc.get_object(entity) - blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj) + bonsai.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj) name = bpy.context.scene.BIMSpatialDecompositionProperties.container_name if name != entity.Name: cls.edit_container_name(entity, name) @@ -790,11 +790,11 @@ class Spatial(blenderbim.core.tool.Spatial): element: ifcopenshell.entity_instance, relating_type: ifcopenshell.entity_instance, ) -> None: - blenderbim.core.type.assign_type(ifc, type, element=element, type=relating_type) + bonsai.core.type.assign_type(ifc, type, element=element, type=relating_type) @classmethod def regen_obj_representation(cls, obj: bpy.types.Object, body: ifcopenshell.entity_instance) -> None: - blenderbim.core.geometry.switch_representation( + bonsai.core.geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, diff --git a/src/bonsai/bonsai/tool/structural.py b/src/bonsai/bonsai/tool/structural.py index 94bbe8902f..cb2fabc6e3 100644 --- a/src/bonsai/bonsai/tool/structural.py +++ b/src/bonsai/bonsai/tool/structural.py @@ -19,15 +19,14 @@ import bpy import ifcopenshell import json -import blenderbim.bim.helper -import blenderbim.core.tool -import blenderbim.core.structural -import blenderbim.tool as tool -from blenderbim.bim.ifc import IfcStore +import bonsai.bim.helper +import bonsai.core.tool +import bonsai.tool as tool +from bonsai.bim.ifc import IfcStore from pprint import pprint -class Structural(blenderbim.core.tool.Structural): +class Structural(bonsai.core.tool.Structural): @classmethod def disable_editing_structural_analysis_model(cls): bpy.context.scene.BIMStructuralProperties.active_structural_analysis_model_id = 0 @@ -121,7 +120,7 @@ class Structural(blenderbim.core.tool.Structural): @classmethod def get_structural_analysis_model_attributes(cls): props = bpy.context.scene.BIMStructuralProperties - attributes = blenderbim.bim.helper.export_attributes(props.structural_analysis_model_attributes) + attributes = bonsai.bim.helper.export_attributes(props.structural_analysis_model_attributes) return attributes @classmethod diff --git a/src/bonsai/bonsai/tool/style.py b/src/bonsai/bonsai/tool/style.py index 5a7baa73bd..a4a3c99ea0 100644 --- a/src/bonsai/bonsai/tool/style.py +++ b/src/bonsai/bonsai/tool/style.py @@ -21,9 +21,9 @@ import numpy as np import ifcopenshell import ifcopenshell.util.element import ifcopenshell.util.representation -import blenderbim.core.tool -import blenderbim.tool as tool -import blenderbim.bim.helper +import bonsai.core.tool +import bonsai.tool as tool +import bonsai.bim.helper from mathutils import Color from typing import Union, Any, Optional, Literal @@ -46,7 +46,7 @@ STYLE_PROPS_MAP = { STYLE_TYPES = Literal["Shading", "External"] -class Style(blenderbim.core.tool.Style): +class Style(bonsai.core.tool.Style): @classmethod def can_support_rendering_style(cls, obj: bpy.types.Material) -> bool: return obj.use_nodes and hasattr(obj.node_tree, "nodes") @@ -101,7 +101,7 @@ class Style(blenderbim.core.tool.Style): @classmethod def export_surface_attributes(cls) -> dict[str, Any]: props = bpy.context.scene.BIMStylesProperties - return blenderbim.bim.helper.export_attributes(props.attributes) + return bonsai.bim.helper.export_attributes(props.attributes) @classmethod def get_active_style_type(cls) -> str: @@ -529,7 +529,7 @@ class Style(blenderbim.core.tool.Style): def import_surface_attributes(cls, style: ifcopenshell.entity_instance) -> None: attributes = bpy.context.scene.BIMStylesProperties.attributes attributes.clear() - blenderbim.bim.helper.import_attributes2(style, attributes) + bonsai.bim.helper.import_attributes2(style, attributes) @classmethod def has_blender_external_style(cls, style_elements: dict[str, ifcopenshell.entity_instance]) -> bool: diff --git a/src/bonsai/bonsai/tool/surveyor.py b/src/bonsai/bonsai/tool/surveyor.py index e1f6bf2920..39e781c834 100644 --- a/src/bonsai/bonsai/tool/surveyor.py +++ b/src/bonsai/bonsai/tool/surveyor.py @@ -18,13 +18,13 @@ import bpy import ifcopenshell.api -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import numpy as np from mathutils import Matrix -class Surveyor(blenderbim.core.tool.Surveyor): +class Surveyor(bonsai.core.tool.Surveyor): @classmethod def get_absolute_matrix(cls, obj: bpy.types.Object) -> Matrix: matrix = np.array(obj.matrix_world) diff --git a/src/bonsai/bonsai/tool/system.py b/src/bonsai/bonsai/tool/system.py index 04b4632827..5868b418d5 100644 --- a/src/bonsai/bonsai/tool/system.py +++ b/src/bonsai/bonsai/tool/system.py @@ -19,21 +19,21 @@ import bpy import ifcopenshell.util.element import ifcopenshell.util.system -import blenderbim.bim.helper -import blenderbim.core.geometry -import blenderbim.core.root -import blenderbim.core.tool -import blenderbim.tool as tool -from blenderbim.bim import import_ifc +import bonsai.bim.helper +import bonsai.core.geometry +import bonsai.core.root +import bonsai.core.tool +import bonsai.tool as tool +from bonsai.bim import import_ifc import re from math import pi, cos, sin from mathutils import Matrix, Vector -from blenderbim.bim.module.system.data import ObjectSystemData, SystemDecorationData -from blenderbim.bim.module.drawing.decoration import profile_consequential +from bonsai.bim.module.system.data import ObjectSystemData, SystemDecorationData +from bonsai.bim.module.drawing.decoration import profile_consequential from enum import Enum -class System(blenderbim.core.tool.System): +class System(bonsai.core.tool.System): @classmethod def add_ports(cls, obj, add_start_port=True, add_end_port=True, end_port_pos=None, offset_end_port=None): def add_port(mep_element, matrix): @@ -95,7 +95,7 @@ class System(blenderbim.core.tool.System): @classmethod def export_system_attributes(cls): - return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMSystemProperties.system_attributes) + return bonsai.bim.helper.export_attributes(bpy.context.scene.BIMSystemProperties.system_attributes) @classmethod def get_connected_port(cls, port): @@ -128,7 +128,7 @@ class System(blenderbim.core.tool.System): def import_system_attributes(cls, system): props = bpy.context.scene.BIMSystemProperties props.system_attributes.clear() - blenderbim.bim.helper.import_attributes2(system, props.system_attributes) + bonsai.bim.helper.import_attributes2(system, props.system_attributes) @classmethod def get_systems(cls): @@ -172,7 +172,7 @@ class System(blenderbim.core.tool.System): @classmethod def run_geometry_edit_object_placement(cls, obj=None): - return blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj) + return bonsai.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj) @classmethod def run_root_assign_class( @@ -184,7 +184,7 @@ class System(blenderbim.core.tool.System): context=None, ifc_representation_class=None, ): - return blenderbim.core.root.assign_class( + return bonsai.core.root.assign_class( tool.Ifc, tool.Collector, tool.Root, diff --git a/src/bonsai/bonsai/tool/type.py b/src/bonsai/bonsai/tool/type.py index 6bbe5fbc90..d05e3c6dc7 100644 --- a/src/bonsai/bonsai/tool/type.py +++ b/src/bonsai/bonsai/tool/type.py @@ -20,14 +20,14 @@ import bpy import ifcopenshell import ifcopenshell.util.element import ifcopenshell.util.representation -import blenderbim.core.tool -import blenderbim.core.geometry -import blenderbim.tool as tool -import blenderbim.bim.helper +import bonsai.core.tool +import bonsai.core.geometry +import bonsai.tool as tool +import bonsai.bim.helper from typing import Union -class Type(blenderbim.core.tool.Type): +class Type(bonsai.core.tool.Type): @classmethod def change_object_data(cls, obj: bpy.types.Object, data: bpy.types.ID, is_global: bool = False) -> None: tool.Geometry.change_object_data(obj, data, is_global) @@ -107,7 +107,7 @@ class Type(blenderbim.core.tool.Type): ifc_representation_class: Union[str, None] = None, profile_set_usage: Union[ifcopenshell.entity_instance, None] = None, ) -> ifcopenshell.entity_instance: - return blenderbim.core.geometry.add_representation( + return bonsai.core.geometry.add_representation( tool.Ifc, tool.Geometry, tool.Style, @@ -126,7 +126,7 @@ class Type(blenderbim.core.tool.Type): should_reload: bool = False, is_global: bool = False, ) -> None: - return blenderbim.core.geometry.switch_representation( + return bonsai.core.geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, diff --git a/src/bonsai/bonsai/tool/unit.py b/src/bonsai/bonsai/tool/unit.py index 344032738f..cf51afd6a7 100644 --- a/src/bonsai/bonsai/tool/unit.py +++ b/src/bonsai/bonsai/tool/unit.py @@ -19,11 +19,12 @@ import bpy import json import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.bim.helper +import bonsai.core.tool +import bonsai.tool as tool -class Unit(blenderbim.core.tool.Unit): +class Unit(bonsai.core.tool.Unit): @classmethod def clear_active_unit(cls): bpy.context.scene.BIMUnitProperties.active_unit_id = 0 @@ -47,7 +48,7 @@ class Unit(blenderbim.core.tool.Unit): return True props = bpy.context.scene.BIMUnitProperties - return blenderbim.bim.helper.export_attributes(props.unit_attributes, callback=callback) + return bonsai.bim.helper.export_attributes(props.unit_attributes, callback=callback) @classmethod def get_scene_unit_name(cls, unit_type): @@ -95,7 +96,7 @@ class Unit(blenderbim.core.tool.Unit): props = bpy.context.scene.BIMUnitProperties props.unit_attributes.clear() - blenderbim.bim.helper.import_attributes2(unit, props.unit_attributes, callback=callback) + bonsai.bim.helper.import_attributes2(unit, props.unit_attributes, callback=callback) @classmethod def import_units(cls): diff --git a/src/bonsai/bonsai/tool/web.py b/src/bonsai/bonsai/tool/web.py index fd5d4f7fad..9b5fe14dcc 100644 --- a/src/bonsai/bonsai/tool/web.py +++ b/src/bonsai/bonsai/tool/web.py @@ -17,9 +17,9 @@ # along with Bonsai. If not, see . import bpy -from blenderbim.bim.module.web.data import WebData -import blenderbim.core.tool -import blenderbim.tool as tool +from bonsai.bim.module.web.data import WebData +import bonsai.core.tool +import bonsai.tool as tool import ifcopenshell.api.sequence from typing import Any, Dict, Optional import time @@ -51,7 +51,7 @@ IFC_TASK_ATTRIBUTE_MAP = { } -class Web(blenderbim.core.tool.Web): +class Web(bonsai.core.tool.Web): @classmethod def generate_port_number(cls) -> int: """ @@ -124,7 +124,7 @@ class Web(blenderbim.core.tool.Web): env = os.environ.copy() env["BLENDERBIM_LIB_PATH"] = str(blenderbim_lib_path) - env["BLENDERBIM_VERSION"] = tool.Blender.get_blenderbim_version() + env["BLENDERBIM_VERSION"] = tool.Blender.get_bonsai_version() ws_process = subprocess.Popen( [sys.executable, ws_path, "--p", str(port), "--host", "127.0.0.1"], diff --git a/src/bonsai/test/tool/test_aggregate.py b/src/bonsai/test/tool/test_aggregate.py index 69f06e951c..0f58f617eb 100644 --- a/src/bonsai/test/tool/test_aggregate.py +++ b/src/bonsai/test/tool/test_aggregate.py @@ -23,15 +23,15 @@ import ifcopenshell.api.root import ifcopenshell.api.unit import ifcopenshell.api.context import ifcopenshell.util.shape_builder -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.aggregate import Aggregate as subject +from bonsai.tool.aggregate import Aggregate as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Aggregate) + assert isinstance(subject(), bonsai.core.tool.Aggregate) class TestCanAggregate(NewFile): diff --git a/src/bonsai/test/tool/test_blender.py b/src/bonsai/test/tool/test_blender.py index 5aa4ee163e..74778ea2d4 100644 --- a/src/bonsai/test/tool/test_blender.py +++ b/src/bonsai/test/tool/test_blender.py @@ -18,16 +18,16 @@ import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import pytest from test.bim.bootstrap import NewFile -from blenderbim.tool.blender import Blender as subject +from bonsai.tool.blender import Blender as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Blender) + assert isinstance(subject(), bonsai.core.tool.Blender) class TestCopyNodeGraph(NewFile): diff --git a/src/bonsai/test/tool/test_brick.py b/src/bonsai/test/tool/test_brick.py index 8862ca29cd..c2d10d699f 100644 --- a/src/bonsai/test/tool/test_brick.py +++ b/src/bonsai/test/tool/test_brick.py @@ -24,18 +24,18 @@ from brickschema.namespaces import REF, A import ifcopenshell import ifcopenshell.api import ifcopenshell.guid -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from rdflib.namespace import RDF from rdflib import Literal, URIRef, Namespace from test.bim.bootstrap import NewFile -from blenderbim.tool.brick import Brick as subject -from blenderbim.tool.brick import BrickStore +from bonsai.tool.brick import Brick as subject +from bonsai.tool.brick import BrickStore class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Brick) + assert isinstance(subject(), bonsai.core.tool.Brick) class TestAddBrick(NewFile): diff --git a/src/bonsai/test/tool/test_cad.py b/src/bonsai/test/tool/test_cad.py index 2e97ab9c66..c02aaed8c6 100644 --- a/src/bonsai/test/tool/test_cad.py +++ b/src/bonsai/test/tool/test_cad.py @@ -17,7 +17,7 @@ # along with Bonsai. If not, see . from test.bim.bootstrap import NewFile -from blenderbim.tool.cad import Cad as subject +from bonsai.tool.cad import Cad as subject from mathutils import Vector V = lambda *x: Vector([float(i) for i in x]) diff --git a/src/bonsai/test/tool/test_collector.py b/src/bonsai/test/tool/test_collector.py index 2470292bcb..eceff28198 100644 --- a/src/bonsai/test/tool/test_collector.py +++ b/src/bonsai/test/tool/test_collector.py @@ -20,15 +20,15 @@ import bpy import ifcopenshell import ifcopenshell.api import ifcopenshell.util.element -import blenderbim.core.tool -import blenderbim.tool as tool -from blenderbim.tool.collector import Collector as subject +import bonsai.core.tool +import bonsai.tool as tool +from bonsai.tool.collector import Collector as subject from test.bim.bootstrap import NewFile, NewIfc, NewIfc4X3 class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Collector) + assert isinstance(subject(), bonsai.core.tool.Collector) class TestAssign(NewIfc): diff --git a/src/bonsai/test/tool/test_context.py b/src/bonsai/test/tool/test_context.py index da162c7fa6..70fcb853d8 100644 --- a/src/bonsai/test/tool/test_context.py +++ b/src/bonsai/test/tool/test_context.py @@ -19,14 +19,14 @@ import bpy import ifcopenshell import test.bim.bootstrap -import blenderbim.core.tool -import blenderbim.tool as tool -from blenderbim.tool.context import Context as subject +import bonsai.core.tool +import bonsai.tool as tool +from bonsai.tool.context import Context as subject class TestImplementsTool(test.bim.bootstrap.NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Context) + assert isinstance(subject(), bonsai.core.tool.Context) class TestSetContext(test.bim.bootstrap.NewFile): diff --git a/src/bonsai/test/tool/test_debug.py b/src/bonsai/test/tool/test_debug.py index 13b11a7c58..9fcd8fa9a8 100644 --- a/src/bonsai/test/tool/test_debug.py +++ b/src/bonsai/test/tool/test_debug.py @@ -19,16 +19,16 @@ import os import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.debug import Debug as subject -from blenderbim.bim.ifc import IfcStore +from bonsai.tool.debug import Debug as subject +from bonsai.bim.ifc import IfcStore class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Debug) + assert isinstance(subject(), bonsai.core.tool.Debug) class TestAddSchemaIdentifier(NewFile): diff --git a/src/bonsai/test/tool/test_demo.py b/src/bonsai/test/tool/test_demo.py index 9ed7ab6cc2..0f0f9da6e0 100644 --- a/src/bonsai/test/tool/test_demo.py +++ b/src/bonsai/test/tool/test_demo.py @@ -33,10 +33,10 @@ import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.demo import Demo as subject +from bonsai.tool.demo import Demo as subject # Our first test is that our tool implements all the abstract methods defined by @@ -45,7 +45,7 @@ from blenderbim.tool.demo import Demo as subject # other languages, but not Python, so we test it explicitly. class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Demo) + assert isinstance(subject(), bonsai.core.tool.Demo) # These are fairly boring tests. What it does demonstrate is that no matter how diff --git a/src/bonsai/test/tool/test_document.py b/src/bonsai/test/tool/test_document.py index 16113af6b0..30ce8b5721 100644 --- a/src/bonsai/test/tool/test_document.py +++ b/src/bonsai/test/tool/test_document.py @@ -19,15 +19,15 @@ import bpy import ifcopenshell import ifcopenshell.api -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.document import Document as subject +from bonsai.tool.document import Document as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Document) + assert isinstance(subject(), bonsai.core.tool.Document) class TestAddBreadcrumb(NewFile): diff --git a/src/bonsai/test/tool/test_drawing.py b/src/bonsai/test/tool/test_drawing.py index 81620a7699..4397d3ff24 100644 --- a/src/bonsai/test/tool/test_drawing.py +++ b/src/bonsai/test/tool/test_drawing.py @@ -22,12 +22,12 @@ import bpy import mathutils import ifcopenshell import ifcopenshell.guid -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.drawing import Drawing as subject -from blenderbim.bim.ifc import IfcStore -from blenderbim.bim.module.drawing.data import DecoratorData +from bonsai.tool.drawing import Drawing as subject +from bonsai.bim.ifc import IfcStore +from bonsai.bim.module.drawing.data import DecoratorData from mathutils import Vector import xml.etree.ElementTree as ET @@ -35,7 +35,7 @@ import xml.etree.ElementTree as ET class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Drawing) + assert isinstance(subject(), bonsai.core.tool.Drawing) class TestCopyRepresentation(NewFile): diff --git a/src/bonsai/test/tool/test_geometry.py b/src/bonsai/test/tool/test_geometry.py index ad6e163871..87f221d1e3 100644 --- a/src/bonsai/test/tool/test_geometry.py +++ b/src/bonsai/test/tool/test_geometry.py @@ -21,17 +21,17 @@ import math import numpy as np import ifcopenshell import ifcopenshell.api.type -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from mathutils import Vector from test.bim.bootstrap import NewFile -from blenderbim.tool.geometry import Geometry as subject +from bonsai.tool.geometry import Geometry as subject from typing import Union class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Geometry) + assert isinstance(subject(), bonsai.core.tool.Geometry) class TestChangeObjectData(NewFile): diff --git a/src/bonsai/test/tool/test_georeference.py b/src/bonsai/test/tool/test_georeference.py index 656e21cd1b..4b22a84781 100644 --- a/src/bonsai/test/tool/test_georeference.py +++ b/src/bonsai/test/tool/test_georeference.py @@ -20,16 +20,16 @@ import bpy import math import ifcopenshell import ifcopenshell.api -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from mathutils import Vector from test.bim.bootstrap import NewFile -from blenderbim.tool.georeference import Georeference as subject +from bonsai.tool.georeference import Georeference as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Georeference) + assert isinstance(subject(), bonsai.core.tool.Georeference) class TestImportProjectedCRS(NewFile): diff --git a/src/bonsai/test/tool/test_ifc.py b/src/bonsai/test/tool/test_ifc.py index 0f35770c00..c68695815a 100644 --- a/src/bonsai/test/tool/test_ifc.py +++ b/src/bonsai/test/tool/test_ifc.py @@ -19,15 +19,15 @@ import bpy import ifcopenshell import test.bim.bootstrap -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import pytest -from blenderbim.tool.ifc import Ifc as subject +from bonsai.tool.ifc import Ifc as subject class TestImplementsTool(test.bim.bootstrap.NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Ifc) + assert isinstance(subject(), bonsai.core.tool.Ifc) class TestSet(test.bim.bootstrap.NewFile): diff --git a/src/bonsai/test/tool/test_library.py b/src/bonsai/test/tool/test_library.py index 94b8d012e8..28bd577c94 100644 --- a/src/bonsai/test/tool/test_library.py +++ b/src/bonsai/test/tool/test_library.py @@ -18,15 +18,15 @@ import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.library import Library as subject +from bonsai.tool.library import Library as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Library) + assert isinstance(subject(), bonsai.core.tool.Library) class TestClearEditingMode(NewFile): diff --git a/src/bonsai/test/tool/test_loader.py b/src/bonsai/test/tool/test_loader.py index 43f7e97089..7fa66955d4 100644 --- a/src/bonsai/test/tool/test_loader.py +++ b/src/bonsai/test/tool/test_loader.py @@ -19,10 +19,10 @@ import bpy import bmesh import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.loader import Loader as subject +from bonsai.tool.loader import Loader as subject import numpy as np from ifcopenshell.util.shape_builder import ShapeBuilder, V from mathutils import Vector @@ -31,7 +31,7 @@ from pathlib import Path class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Loader) + assert isinstance(subject(), bonsai.core.tool.Loader) class TestCreatingStyles(NewFile): @@ -58,7 +58,7 @@ class TestCreatingStyles(NewFile): texture_data = [ { "Mode": "DIFFUSE", - "URLReference": "blenderbim/test/files/image.jpg", + "URLReference": "bonsai/test/files/image.jpg", "type": "IfcImageTexture", "uv_mode": "Generated", }, @@ -113,7 +113,7 @@ class TestCreatingStyles(NewFile): textures = [ { - "URLReference": "blenderbim/test/files/image.jpg", + "URLReference": "bonsai/test/files/image.jpg", "Mode": "DIFFUSE", "RepeatS": True, "RepeatT": True, diff --git a/src/bonsai/test/tool/test_material.py b/src/bonsai/test/tool/test_material.py index 5494c4abcf..8c2357c5c7 100644 --- a/src/bonsai/test/tool/test_material.py +++ b/src/bonsai/test/tool/test_material.py @@ -19,15 +19,15 @@ import bpy import ifcopenshell import ifcopenshell.api -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.material import Material as subject +from bonsai.tool.material import Material as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Material) + assert isinstance(subject(), bonsai.core.tool.Material) class TestDisableEditingMaterials(NewFile): diff --git a/src/bonsai/test/tool/test_misc.py b/src/bonsai/test/tool/test_misc.py index 704768d450..3f133f8c04 100644 --- a/src/bonsai/test/tool/test_misc.py +++ b/src/bonsai/test/tool/test_misc.py @@ -21,15 +21,15 @@ import math import numpy import ifcopenshell import test.bim.bootstrap -import blenderbim.core.tool -import blenderbim.tool as tool -from blenderbim.tool.misc import Misc as subject -from blenderbim.bim.ifc import IfcStore +import bonsai.core.tool +import bonsai.tool as tool +from bonsai.tool.misc import Misc as subject +from bonsai.bim.ifc import IfcStore class TestImplementsTool(test.bim.bootstrap.NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Misc) + assert isinstance(subject(), bonsai.core.tool.Misc) class TestGetObjectStorey(test.bim.bootstrap.NewFile): diff --git a/src/bonsai/test/tool/test_model.py b/src/bonsai/test/tool/test_model.py index d277f93791..596d8e9fb2 100644 --- a/src/bonsai/test/tool/test_model.py +++ b/src/bonsai/test/tool/test_model.py @@ -23,18 +23,18 @@ import ifcopenshell.api.style import ifcopenshell.util.element import ifcopenshell.util.representation import ifcopenshell.util.unit -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import numpy as np import json from test.bim.bootstrap import NewFile -from blenderbim.tool.model import Model as subject +from bonsai.tool.model import Model as subject from ifcopenshell.util.shape_builder import V, ShapeBuilder class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Model) + assert isinstance(subject(), bonsai.core.tool.Model) class TestGenerateOccurrenceName(NewFile): diff --git a/src/bonsai/test/tool/test_nest.py b/src/bonsai/test/tool/test_nest.py index 002aa96352..c68f5ae692 100644 --- a/src/bonsai/test/tool/test_nest.py +++ b/src/bonsai/test/tool/test_nest.py @@ -18,15 +18,15 @@ import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.nest import Nest as subject +from bonsai.tool.nest import Nest as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Nest) + assert isinstance(subject(), bonsai.core.tool.Nest) class TestCanNest(NewFile): diff --git a/src/bonsai/test/tool/test_owner.py b/src/bonsai/test/tool/test_owner.py index 846209c8c0..8b2219a1c7 100644 --- a/src/bonsai/test/tool/test_owner.py +++ b/src/bonsai/test/tool/test_owner.py @@ -18,15 +18,15 @@ import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.owner import Owner as subject +from bonsai.tool.owner import Owner as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Owner) + assert isinstance(subject(), bonsai.core.tool.Owner) class TestAddAddressAttribute(NewFile): diff --git a/src/bonsai/test/tool/test_patch.py b/src/bonsai/test/tool/test_patch.py index 32b0915d67..48c0e16af5 100644 --- a/src/bonsai/test/tool/test_patch.py +++ b/src/bonsai/test/tool/test_patch.py @@ -19,15 +19,15 @@ import os import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.patch import Patch as subject +from bonsai.tool.patch import Patch as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Patch) + assert isinstance(subject(), bonsai.core.tool.Patch) class TestRunMigratePatch(NewFile): diff --git a/src/bonsai/test/tool/test_project.py b/src/bonsai/test/tool/test_project.py index c57dca4f09..0fb327ccdf 100644 --- a/src/bonsai/test/tool/test_project.py +++ b/src/bonsai/test/tool/test_project.py @@ -18,17 +18,17 @@ import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import tempfile from test.bim.bootstrap import NewFile -from blenderbim.tool.project import Project as subject +from bonsai.tool.project import Project as subject from pathlib import Path class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Project) + assert isinstance(subject(), bonsai.core.tool.Project) class TestAppendAllTypesFromTemplate(NewFile): diff --git a/src/bonsai/test/tool/test_pset.py b/src/bonsai/test/tool/test_pset.py index 1ad85dab5d..b12c46f0ef 100644 --- a/src/bonsai/test/tool/test_pset.py +++ b/src/bonsai/test/tool/test_pset.py @@ -18,15 +18,15 @@ import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool -from blenderbim.tool.pset import Pset as subject +import bonsai.core.tool +import bonsai.tool as tool +from bonsai.tool.pset import Pset as subject from test.bim.bootstrap import NewFile class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Pset) + assert isinstance(subject(), bonsai.core.tool.Pset) class TestGetElementPset(NewFile): diff --git a/src/bonsai/test/tool/test_qto.py b/src/bonsai/test/tool/test_qto.py index 424ce7a133..5017806e33 100644 --- a/src/bonsai/test/tool/test_qto.py +++ b/src/bonsai/test/tool/test_qto.py @@ -21,12 +21,12 @@ import ifcopenshell import ifcopenshell.api import ifcopenshell.util.pset import test.bim.bootstrap -import blenderbim.core.tool +import bonsai.core.tool import blenderbim.core.root -import blenderbim.tool as tool +import bonsai.tool as tool import blenderbim.bim.import_ifc as import_ifc import blenderbim.bim.module.qto.calculator as calculator -from blenderbim.tool.qto import Qto as subject +from bonsai.tool.qto import Qto as subject class TestImplementsTool(test.bim.bootstrap.NewFile): diff --git a/src/bonsai/test/tool/test_root.py b/src/bonsai/test/tool/test_root.py index 30ff434e27..235ed3b04e 100644 --- a/src/bonsai/test/tool/test_root.py +++ b/src/bonsai/test/tool/test_root.py @@ -19,15 +19,15 @@ import bpy import ifcopenshell import ifcopenshell.api -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.root import Root as subject +from bonsai.tool.root import Root as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Root) + assert isinstance(subject(), bonsai.core.tool.Root) class TestAddTrackedOpening(NewFile): diff --git a/src/bonsai/test/tool/test_spatial.py b/src/bonsai/test/tool/test_spatial.py index 269a0fe1ee..3faae5ff3d 100644 --- a/src/bonsai/test/tool/test_spatial.py +++ b/src/bonsai/test/tool/test_spatial.py @@ -18,16 +18,16 @@ import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool -from blenderbim.tool.spatial import Spatial as subject +import bonsai.core.tool +import bonsai.tool as tool +from bonsai.tool.spatial import Spatial as subject from test.bim.bootstrap import NewFile from mathutils import Matrix class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Spatial) + assert isinstance(subject(), bonsai.core.tool.Spatial) class TestCanContain(NewFile): diff --git a/src/bonsai/test/tool/test_style.py b/src/bonsai/test/tool/test_style.py index 34ae230677..a8f2947872 100644 --- a/src/bonsai/test/tool/test_style.py +++ b/src/bonsai/test/tool/test_style.py @@ -21,16 +21,16 @@ import bpy import ifcopenshell import ifcopenshell.api import ifcopenshell.util.representation -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.style import Style as subject +from bonsai.tool.style import Style as subject from ifcopenshell.util.shape_builder import ShapeBuilder class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Style) + assert isinstance(subject(), bonsai.core.tool.Style) class TestCanSupportRenderingStyle(NewFile): diff --git a/src/bonsai/test/tool/test_surveyor.py b/src/bonsai/test/tool/test_surveyor.py index abd506751f..0a12bd3903 100644 --- a/src/bonsai/test/tool/test_surveyor.py +++ b/src/bonsai/test/tool/test_surveyor.py @@ -22,14 +22,14 @@ import ifcopenshell import ifcopenshell.api import test.bim.bootstrap -import blenderbim.core.tool -import blenderbim.tool as tool -from blenderbim.tool import Surveyor as subject +import bonsai.core.tool +import bonsai.tool as tool +from bonsai.tool import Surveyor as subject class TestImplementsTool(test.bim.bootstrap.NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Surveyor) + assert isinstance(subject(), bonsai.core.tool.Surveyor) class TestGetGlobalMatrix(test.bim.bootstrap.NewFile): diff --git a/src/bonsai/test/tool/test_system.py b/src/bonsai/test/tool/test_system.py index 87219afcdb..4123376fa2 100644 --- a/src/bonsai/test/tool/test_system.py +++ b/src/bonsai/test/tool/test_system.py @@ -19,18 +19,18 @@ import bpy import ifcopenshell import ifcopenshell.api -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool import numpy as np from test.bim.bootstrap import NewFile -from blenderbim.tool.system import System as subject +from bonsai.tool.system import System as subject from mathutils import Euler, Vector, Matrix from math import pi class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.System) + assert isinstance(subject(), bonsai.core.tool.System) class TestAddPorts(NewFile): diff --git a/src/bonsai/test/tool/test_type.py b/src/bonsai/test/tool/test_type.py index 387282b395..4bb9c4b694 100644 --- a/src/bonsai/test/tool/test_type.py +++ b/src/bonsai/test/tool/test_type.py @@ -18,15 +18,15 @@ import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.type import Type as subject +from bonsai.tool.type import Type as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Type) + assert isinstance(subject(), bonsai.core.tool.Type) class TestChangeObjectData(NewFile): diff --git a/src/bonsai/test/tool/test_unit.py b/src/bonsai/test/tool/test_unit.py index 23eb445ca9..bd508ce074 100644 --- a/src/bonsai/test/tool/test_unit.py +++ b/src/bonsai/test/tool/test_unit.py @@ -18,15 +18,15 @@ import bpy import ifcopenshell -import blenderbim.core.tool -import blenderbim.tool as tool +import bonsai.core.tool +import bonsai.tool as tool from test.bim.bootstrap import NewFile -from blenderbim.tool.unit import Unit as subject +from bonsai.tool.unit import Unit as subject class TestImplementsTool(NewFile): def test_run(self): - assert isinstance(subject(), blenderbim.core.tool.Unit) + assert isinstance(subject(), bonsai.core.tool.Unit) class TestClearActiveUnit(NewFile):