diff --git a/src/blenderbim/blenderbim/tool/aggregate.py b/src/blenderbim/blenderbim/tool/aggregate.py index 2fd4644949..ad55653451 100644 --- a/src/blenderbim/blenderbim/tool/aggregate.py +++ b/src/blenderbim/blenderbim/tool/aggregate.py @@ -17,13 +17,13 @@ # along with BlenderBIM Add-on. If not, see . import bpy -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool import ifcopenshell.util.element from typing import Union -class Aggregate(blenderbim.core.tool.Aggregate): +class Aggregate(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/blenderbim/blenderbim/tool/blender.py b/src/blenderbim/blenderbim/tool/blender.py index abebced14b..eaf9431dae 100644 --- a/src/blenderbim/blenderbim/tool/blender.py +++ b/src/blenderbim/blenderbim/tool/blender.py @@ -23,9 +23,9 @@ import json import os import ifcopenshell.api import ifcopenshell.util.element -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool -import blenderbim.bim +from .. import bim as bim import addon_utils import types from mathutils import Vector @@ -48,7 +48,7 @@ VIEWPORT_ATTRIBUTES = [ OBJECT_DATA_TYPE = Union[bpy.types.Mesh, bpy.types.Curve, bpy.types.Camera] -class Blender(blenderbim.core.tool.Blender): +class Blender(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" @@ -920,7 +920,7 @@ class Blender(blenderbim.core.tool.Blender): @classmethod def get_last_commit_hash(cls) -> Union[str, None]: """Get 8 symbols of last commit hash if it's present or return None otherwise.""" - commit_hash = blenderbim.bim.last_commit_hash + commit_hash = bim.last_commit_hash # Commit hash is unset - user is using __init__ from repo # without setting up git repository. @@ -947,11 +947,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 bim.module.model.workspace as ws_model + import bim.module.drawing.workspace as ws_drawing + import bim.module.spatial.workspace as ws_spatial + import bim.module.structural.workspace as ws_structural + import bim.module.covering.workspace as ws_covering if bpy.app.background: return @@ -979,11 +979,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 bim.module.model.workspace as ws_model + import bim.module.drawing.workspace as ws_drawing + import bim.module.spatial.workspace as ws_spatial + import bim.module.structural.workspace as ws_structural + import bim.module.covering.workspace as ws_covering if bpy.app.background: return @@ -1070,7 +1070,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 = bim.original_scene_panels_polls # override poll method if not hasattr(original_panel, "poll"): @@ -1091,7 +1091,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 = bim.original_scene_panels_polls poll = polls[panel] if poll is None: @@ -1114,7 +1114,7 @@ class Blender(blenderbim.core.tool.Blender): return "blenderbim" @classmethod - def get_addon_preferences(cls) -> blenderbim.bim.ui.BIM_ADDON_preferences: + def get_addon_preferences(cls) -> 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/blenderbim/blenderbim/tool/boundary.py b/src/blenderbim/blenderbim/tool/boundary.py index c99f983e88..74523a16c1 100644 --- a/src/blenderbim/blenderbim/tool/boundary.py +++ b/src/blenderbim/blenderbim/tool/boundary.py @@ -18,13 +18,13 @@ import bpy import mathutils -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool from mathutils import Matrix, Vector from typing import Any, Sequence -class Boundary(blenderbim.core.tool.Boundary): +class Boundary(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 diff --git a/src/blenderbim/blenderbim/tool/brick.py b/src/blenderbim/blenderbim/tool/brick.py index 3d3992eb85..001be0ef9f 100644 --- a/src/blenderbim/blenderbim/tool/brick.py +++ b/src/blenderbim/blenderbim/tool/brick.py @@ -21,7 +21,7 @@ import bpy import ifcopenshell import ifcopenshell.guid import ifcopenshell.util.brick -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool from contextlib import contextmanager import datetime @@ -45,7 +45,7 @@ logger = logging.getLogger("rdflib") logger.setLevel(logging.ERROR) -class Brick(blenderbim.core.tool.Brick): +class Brick(core_tool.Brick): @classmethod def add_brick(cls, namespace, brick_class, label): ns = Namespace(namespace) diff --git a/src/blenderbim/blenderbim/tool/bsdd.py b/src/blenderbim/blenderbim/tool/bsdd.py index dd078d8bde..a52798434f 100644 --- a/src/blenderbim/blenderbim/tool/bsdd.py +++ b/src/blenderbim/blenderbim/tool/bsdd.py @@ -1,10 +1,10 @@ -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool import bpy import json -class Bsdd(blenderbim.core.tool.Bsdd): +class Bsdd(core_tool.Bsdd): @classmethod def clear_class_psets(cls) -> None: diff --git a/src/blenderbim/blenderbim/tool/clash.py b/src/blenderbim/blenderbim/tool/clash.py index 49d5fb1494..fcbc80bf0b 100644 --- a/src/blenderbim/blenderbim/tool/clash.py +++ b/src/blenderbim/blenderbim/tool/clash.py @@ -20,13 +20,13 @@ import os import bpy import json import ifcopenshell -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool from contextlib import contextmanager from mathutils import Vector -class Clash(blenderbim.core.tool.Clash): +class Clash(core_tool.Clash): @classmethod def export_clash_sets(cls): diff --git a/src/blenderbim/blenderbim/tool/collector.py b/src/blenderbim/blenderbim/tool/collector.py index b5ba62d464..e4218a5a48 100644 --- a/src/blenderbim/blenderbim/tool/collector.py +++ b/src/blenderbim/blenderbim/tool/collector.py @@ -17,13 +17,13 @@ # along with BlenderBIM Add-on. If not, see . import bpy -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool import ifcopenshell.util.element from typing import Union -class Collector(blenderbim.core.tool.Collector): +class Collector(core_tool.Collector): @classmethod def assign(cls, obj: bpy.types.Object) -> None: """Links an object to an appropriate Blender collection.""" diff --git a/src/blenderbim/blenderbim/tool/context.py b/src/blenderbim/blenderbim/tool/context.py index 13b1e0d2d2..5a1dd7f8c3 100644 --- a/src/blenderbim/blenderbim/tool/context.py +++ b/src/blenderbim/blenderbim/tool/context.py @@ -17,12 +17,12 @@ # along with BlenderBIM Add-on. If not, see . import bpy -import blenderbim.bim.helper +from ..bim import helper as bim_helper from .. import tool -import blenderbim.core.tool +from ..core import tool as core_tool -class Context(blenderbim.core.tool.Context): +class Context(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) + 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 bim_helper.export_attributes(bpy.context.scene.BIMContextProperties.context_attributes) diff --git a/src/blenderbim/blenderbim/tool/cost.py b/src/blenderbim/blenderbim/tool/cost.py index b48477d715..da010c93c3 100644 --- a/src/blenderbim/blenderbim/tool/cost.py +++ b/src/blenderbim/blenderbim/tool/cost.py @@ -1,21 +1,21 @@ import os import bpy -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool import ifcopenshell.util.element import ifcopenshell.util.date import ifcopenshell.util.cost import ifcopenshell.util.unit -import blenderbim.bim.helper +from ..bim import helper as bim_helper import json from typing import Optional, Any, Generator, Union -class Cost(blenderbim.core.tool.Cost): +class Cost(core_tool.Cost): @classmethod def get_cost_schedule_attributes(cls): props = bpy.context.scene.BIMCostProperties - return blenderbim.bim.helper.export_attributes(props.cost_schedule_attributes) + return bim_helper.export_attributes(props.cost_schedule_attributes) @classmethod def disable_editing_cost_schedule(cls): @@ -86,7 +86,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) + 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: @@ -187,7 +187,7 @@ class Cost(blenderbim.core.tool.Cost): def load_cost_item_attributes(cls, cost_item): props = bpy.context.scene.BIMCostProperties props.cost_item_attributes.clear() - blenderbim.bim.helper.import_attributes2(cost_item, props.cost_item_attributes) + bim_helper.import_attributes2(cost_item, props.cost_item_attributes) @classmethod def disable_editing_cost_item(cls): @@ -197,7 +197,7 @@ class Cost(blenderbim.core.tool.Cost): @classmethod def get_cost_item_attributes(cls): props = bpy.context.scene.BIMCostProperties - return blenderbim.bim.helper.export_attributes(props.cost_item_attributes) + return bim_helper.export_attributes(props.cost_item_attributes) @classmethod def get_active_cost_item(cls) -> Union[ifcopenshell.entity_instance, None]: @@ -313,7 +313,7 @@ class Cost(blenderbim.core.tool.Cost): def load_cost_item_quantity_attributes(cls, physical_quantity=None): props = bpy.context.scene.BIMCostProperties props.quantity_attributes.clear() - blenderbim.bim.helper.import_attributes2(physical_quantity, props.quantity_attributes) + bim_helper.import_attributes2(physical_quantity, props.quantity_attributes) @classmethod def enable_editing_cost_item_values(cls, cost_item: ifcopenshell.entity_instance) -> None: @@ -328,7 +328,7 @@ class Cost(blenderbim.core.tool.Cost): @classmethod def get_cost_item_quantity_attributes(cls): props = bpy.context.scene.BIMCostProperties - return blenderbim.bim.helper.export_attributes(props.quantity_attributes) + return bim_helper.export_attributes(props.quantity_attributes) @classmethod def get_attributes_for_cost_value(cls, cost_type, cost_category): @@ -388,7 +388,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) + bim_helper.import_attributes2(cost_value, props.cost_value_attributes, callback=callback) @classmethod def calculate_applied_value( @@ -448,7 +448,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 bim_helper.export_attributes(props.cost_value_attributes, callback) @classmethod def get_cost_value_unit_component(cls) -> ifcopenshell.entity_instance: diff --git a/src/blenderbim/blenderbim/tool/covering.py b/src/blenderbim/blenderbim/tool/covering.py index 0964f4d1d1..c136d05c99 100644 --- a/src/blenderbim/blenderbim/tool/covering.py +++ b/src/blenderbim/blenderbim/tool/covering.py @@ -20,17 +20,17 @@ import bpy import bmesh import shapely import ifcopenshell -import blenderbim.core.tool -import blenderbim.core.root -import blenderbim.core.spatial -import blenderbim.core.geometry +from ..core import tool as core_tool +from ..core import root as core_root +from ..core import spatial as core_spatial +from ..core import geometry as core_geometry from .. import tool import json from math import pi from mathutils import Vector, Matrix from shapely import Polygon, MultiPolygon -class Covering(blenderbim.core.tool.Covering): +class Covering(core_tool.Covering): @classmethod def get_z_from_ceiling_height(cls): props = bpy.context.scene.BIMCoveringProperties diff --git a/src/blenderbim/blenderbim/tool/debug.py b/src/blenderbim/blenderbim/tool/debug.py index 4b43f15d2f..ae1f9f961e 100644 --- a/src/blenderbim/blenderbim/tool/debug.py +++ b/src/blenderbim/blenderbim/tool/debug.py @@ -19,12 +19,12 @@ import os import bpy import ifcopenshell.express -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool from ..bim.ifc import IfcStore -class Debug(blenderbim.core.tool.Debug): +class Debug(core_tool.Debug): @classmethod def add_schema_identifier(cls, schema): IfcStore.schema_identifiers.append(schema.schema_name) diff --git a/src/blenderbim/blenderbim/tool/demo.py b/src/blenderbim/blenderbim/tool/demo.py index 164af3f03f..c658dd9d63 100644 --- a/src/blenderbim/blenderbim/tool/demo.py +++ b/src/blenderbim/blenderbim/tool/demo.py @@ -30,13 +30,13 @@ # processing, and more. import bpy -import blenderbim.core.tool +from ..core import tool as core_tool from .. import 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(core_tool.Demo): @classmethod def clear_name_field(cls): # In this concrete implementation, we see that "clear name field" diff --git a/src/blenderbim/blenderbim/tool/document.py b/src/blenderbim/blenderbim/tool/document.py index 71e7ee8acb..d67541a5ab 100644 --- a/src/blenderbim/blenderbim/tool/document.py +++ b/src/blenderbim/blenderbim/tool/document.py @@ -18,12 +18,12 @@ import bpy import ifcopenshell.util.system -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool from ..bim import import_ifc -class Document(blenderbim.core.tool.Document): +class Document(core_tool.Document): @classmethod def add_breadcrumb(cls, document): props = bpy.context.scene.BIMDocumentProperties diff --git a/src/blenderbim/blenderbim/tool/drawing.py b/src/blenderbim/blenderbim/tool/drawing.py index b94aaf9d2e..f35a267e17 100644 --- a/src/blenderbim/blenderbim/tool/drawing.py +++ b/src/blenderbim/blenderbim/tool/drawing.py @@ -31,8 +31,8 @@ import platform import mathutils import subprocess import numpy as np -import blenderbim.core.tool -import blenderbim.core.geometry +from ..core import tool as core_tool +from ..core import geometry as core_geometry from .. import tool import ifcopenshell.api import ifcopenshell.geom @@ -40,8 +40,8 @@ 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 +from ..bim import import_ifc as bim_import_ifc +from ..core import root as core_root from shapely.ops import unary_union from lxml import etree from mathutils import Vector, Matrix @@ -50,7 +50,7 @@ from typing import Optional, Union, Iterable, Any, Literal from pathlib import Path -class Drawing(blenderbim.core.tool.Drawing): +class Drawing(core_tool.Drawing): ANNOTATION_DATA_TYPE = Literal["empty", "curve", "mesh"] DOCUMENT_TYPE = Literal["SCHEDULE", "REFERENCE"] @@ -654,8 +654,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 = bim_import_ifc.IfcImportSettings.factory(bpy.context, None, logger) + ifc_importer = bim_import_ifc.IfcImporter(ifc_import_settings) ifc_importer.file = tool.Ifc.get() ifc_importer.calculate_unit_scale() ifc_importer.process_context_filter() @@ -941,7 +941,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 core_root.assign_class( tool.Ifc, tool.Collector, tool.Root, @@ -1548,7 +1548,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) + core_geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj) return element @classmethod @@ -1858,7 +1858,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( + core_geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, diff --git a/src/blenderbim/blenderbim/tool/geometry.py b/src/blenderbim/blenderbim/tool/geometry.py index 604caf6b04..3dbd643543 100644 --- a/src/blenderbim/blenderbim/tool/geometry.py +++ b/src/blenderbim/blenderbim/tool/geometry.py @@ -29,14 +29,14 @@ 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 +from ..core import tool as core_tool +from ..core import drawing as core_drawing +from ..core import style as core_style +from ..core import spatial as core_spatial +from ..core import system as core_system +from ..core import geometry as core_geometry from .. import tool -import blenderbim.bim.import_ifc +from ..bim import import_ifc as bim_import_ifc from collections import defaultdict from math import radians, pi from mathutils import Vector, Matrix @@ -45,7 +45,7 @@ from typing import Union, Iterable, Optional, Literal from typing import Iterator -class Geometry(blenderbim.core.tool.Geometry): +class Geometry(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 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) + 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) + 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 = 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 = 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 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( + core_geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, @@ -936,7 +936,7 @@ class Geometry(blenderbim.core.tool.Geometry): cls.recreate_object_with_data(obj, None) return - blenderbim.core.geometry.switch_representation( + core_geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, diff --git a/src/blenderbim/blenderbim/tool/georeference.py b/src/blenderbim/blenderbim/tool/georeference.py index 95021a54c5..9cb454858e 100644 --- a/src/blenderbim/blenderbim/tool/georeference.py +++ b/src/blenderbim/blenderbim/tool/georeference.py @@ -21,13 +21,13 @@ import json import numpy as np import ifcopenshell import ifcopenshell.api.georeference -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool -import blenderbim.bim.helper +from ..bim import helper as bim_helper from math import radians, cos, sin -class Georeference(blenderbim.core.tool.Georeference): +class Georeference(core_tool.Georeference): @classmethod def add_georeferencing(cls): tool.Ifc.run( @@ -64,7 +64,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) + bim_helper.import_attributes2(projected_crs, props.projected_crs, callback=callback) return @classmethod @@ -120,7 +120,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( + bim_helper.import_attributes2( coordinate_operation, props.coordinate_operation, callback=callback ) return @@ -155,7 +155,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 bim_helper.export_attributes(props.projected_crs, callback=callback) @classmethod def get_coordinate_operation_attributes(cls): @@ -186,7 +186,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 bim_helper.export_attributes(props.coordinate_operation, callback=callback) @classmethod def get_true_north_attributes(cls): diff --git a/src/blenderbim/blenderbim/tool/ifc.py b/src/blenderbim/blenderbim/tool/ifc.py index b15a45380d..393ce4776f 100644 --- a/src/blenderbim/blenderbim/tool/ifc.py +++ b/src/blenderbim/blenderbim/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 +from ..core import tool as core_tool +from ..bim import handler as bim_handler from .. import tool from ..bim.ifc import IfcStore, IFC_CONNECTED_TYPE from typing import Optional, Union, Any, final -class Ifc(blenderbim.core.tool.Ifc): +class Ifc(core_tool.Ifc): @classmethod def run(cls, command: str, **kwargs) -> Any: return ifcopenshell.api.run(command, IfcStore.get_file(), **kwargs) @@ -133,9 +133,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 + blenderbim.bim.handler.subscribe_to(obj, "name", bim_handler.name_callback) + bim_handler.subscribe_to( + obj, "active_material_index", bim_handler.active_material_index_callback ) for obj in bpy.data.materials: @@ -151,7 +151,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) + blenderbim.bim.handler.subscribe_to(obj, "name", bim_handler.name_callback) @classmethod def link(cls, element: ifcopenshell.entity_instance, obj: IFC_CONNECTED_TYPE) -> None: @@ -221,7 +221,7 @@ class Ifc(blenderbim.core.tool.Ifc): @final def execute(self, context): IfcStore.execute_ifc_operator(self, context) - blenderbim.bim.handler.refresh_ui_data() + bim_handler.refresh_ui_data() return {"FINISHED"} # NOTE: this class can't inherit from abc.ABC to use abc.abstractmethod diff --git a/src/blenderbim/blenderbim/tool/library.py b/src/blenderbim/blenderbim/tool/library.py index 9a7d3cfad0..18866b26f0 100644 --- a/src/blenderbim/blenderbim/tool/library.py +++ b/src/blenderbim/blenderbim/tool/library.py @@ -17,11 +17,11 @@ # along with BlenderBIM Add-on. If not, see . import bpy -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool -class Library(blenderbim.core.tool.Library): +class Library(core_tool.Library): @classmethod def clear_editing_mode(cls): bpy.context.scene.BIMLibraryProperties.editing_mode = "" diff --git a/src/blenderbim/blenderbim/tool/loader.py b/src/blenderbim/blenderbim/tool/loader.py index 1cf6558788..a33e04b208 100644 --- a/src/blenderbim/blenderbim/tool/loader.py +++ b/src/blenderbim/blenderbim/tool/loader.py @@ -25,9 +25,9 @@ import ifcopenshell.geom import ifcopenshell.util.element import ifcopenshell.util.shape import ifcopenshell.util.unit -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool -import blenderbim.bim.import_ifc +from ..bim import import_ifc as bim_import_ifc import numpy as np import numpy.typing as npt from mathutils import Vector, Matrix @@ -44,16 +44,16 @@ from typing import Union OBJECT_DATA_TYPE = Union[bpy.types.Mesh, bpy.types.Curve] -class Loader(blenderbim.core.tool.Loader): +class Loader(core_tool.Loader): unit_scale: float = 1 - settings: blenderbim.bim.import_ifc.IfcImportSettings = None + settings: 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: bim_import_ifc.IfcImportSettings) -> None: cls.settings = settings @classmethod diff --git a/src/blenderbim/blenderbim/tool/material.py b/src/blenderbim/blenderbim/tool/material.py index d6f47afda5..eb62dd22d5 100644 --- a/src/blenderbim/blenderbim/tool/material.py +++ b/src/blenderbim/blenderbim/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 +from ..core import tool as core_tool +from ..core import material as core_material from .. import tool -import blenderbim.bim.helper +from ..bim import helper as bim_helper import ifcopenshell.util.unit import ifcopenshell.util.element from collections import defaultdict @@ -34,7 +34,7 @@ if TYPE_CHECKING: from blenderbim.bim.module.material.prop import Material as MaterialItem -class Material(blenderbim.core.tool.Material): +class Material(core_tool.Material): @classmethod def disable_editing_materials(cls) -> None: bpy.context.scene.BIMMaterialProperties.is_editing = False @@ -148,7 +148,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) + bim_helper.import_attributes2(material, props.material_attributes) @classmethod def enable_editing_material(cls, material: ifcopenshell.entity_instance) -> None: @@ -158,7 +158,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 bim_helper.export_attributes(bpy.context.scene.BIMMaterialProperties.material_attributes) @classmethod def disable_editing_material(cls) -> None: @@ -272,7 +272,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)]) + 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/blenderbim/blenderbim/tool/misc.py b/src/blenderbim/blenderbim/tool/misc.py index de25f2e7fd..e7a145be4a 100644 --- a/src/blenderbim/blenderbim/tool/misc.py +++ b/src/blenderbim/blenderbim/tool/misc.py @@ -19,14 +19,14 @@ import bpy import bmesh import ifcopenshell -import blenderbim.core.tool -import blenderbim.core.root +from ..core import tool as core_tool +from ..core import root as core_root from .. import tool from mathutils import Vector, Matrix from ..bim.ifc import IfcStore -class Misc(blenderbim.core.tool.Misc): +class Misc(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 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/blenderbim/blenderbim/tool/model.py b/src/blenderbim/blenderbim/tool/model.py index a56f51ba38..b2ba394318 100644 --- a/src/blenderbim/blenderbim/tool/model.py +++ b/src/blenderbim/blenderbim/tool/model.py @@ -28,8 +28,8 @@ import ifcopenshell.util.element import ifcopenshell.util.unit import ifcopenshell.util.placement import ifcopenshell.util.representation -import blenderbim.core.geometry -import blenderbim.core.tool +from ..core import geometry as core_geometry +from ..core import tool as core_tool from .. import tool from ..core. import geometry from math import atan, degrees @@ -46,7 +46,7 @@ from typing import Optional, Union, TypeVar, Any, Iterable, Literal T = TypeVar("T") -class Model(blenderbim.core.tool.Model): +class Model(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) + 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( + core_geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, diff --git a/src/blenderbim/blenderbim/tool/nest.py b/src/blenderbim/blenderbim/tool/nest.py index a909bd04ab..fd00ed1330 100644 --- a/src/blenderbim/blenderbim/tool/nest.py +++ b/src/blenderbim/blenderbim/tool/nest.py @@ -16,12 +16,12 @@ # You should have received a copy of the GNU General Public License # along with BlenderBIM Add-on. If not, see . -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool import ifcopenshell.util.element -class Nest(blenderbim.core.tool.Nest): +class Nest(core_tool.Nest): @classmethod def can_nest(cls, relating_obj, related_obj): relating_object = tool.Ifc.get_entity(relating_obj) diff --git a/src/blenderbim/blenderbim/tool/owner.py b/src/blenderbim/blenderbim/tool/owner.py index c1d98922bb..295f981396 100644 --- a/src/blenderbim/blenderbim/tool/owner.py +++ b/src/blenderbim/blenderbim/tool/owner.py @@ -17,14 +17,14 @@ # along with BlenderBIM Add-on. If not, see . import bpy -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool -import blenderbim.bim.helper +from ..bim import helper as bim_helper import ifcopenshell from typing import Union, Any -class Owner(blenderbim.core.tool.Owner): +class Owner(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) + 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 = 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,7 +136,7 @@ class Owner(blenderbim.core.tool.Owner): props = bpy.context.scene.BIMOwnerProperties props.organisation_attributes.clear() - blenderbim.bim.helper.import_attributes( + bim_helper.import_attributes( "IfcOrganization", props.organisation_attributes, organisation.get_info() ) @@ -147,7 +147,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 = bim_helper.export_attributes(props.organisation_attributes) return attributes @classmethod @@ -178,7 +178,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) + bim_helper.import_attributes("IfcPerson", props.person_attributes, person.get_info(), callback) @classmethod def clear_person(cls) -> None: @@ -187,7 +187,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 = 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 +224,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()) + bim_helper.import_attributes("IfcActorRole", props.role_attributes, role.get_info()) @classmethod def clear_role(cls) -> None: @@ -236,7 +236,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 bim_helper.export_attributes(bpy.context.scene.BIMOwnerProperties.role_attributes) @classmethod def set_actor(cls, actor: ifcopenshell.entity_instance) -> None: @@ -246,7 +246,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) + bim_helper.import_attributes2(actor, props.actor_attributes) @classmethod def clear_actor(cls) -> None: @@ -255,7 +255,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 = bim_helper.export_attributes(props.actor_attributes) return attributes @classmethod diff --git a/src/blenderbim/blenderbim/tool/patch.py b/src/blenderbim/blenderbim/tool/patch.py index f543a98c6a..2678aa5043 100644 --- a/src/blenderbim/blenderbim/tool/patch.py +++ b/src/blenderbim/blenderbim/tool/patch.py @@ -18,7 +18,7 @@ import bpy import ifcopenshell -import blenderbim.core.tool +from ..core import tool as core_tool from typing import TYPE_CHECKING @@ -31,7 +31,7 @@ if TYPE_CHECKING: import ifcpatch -class Patch(blenderbim.core.tool.Patch): +class Patch(core_tool.Patch): @classmethod def run_migrate_patch(cls, infile: str, outfile: str, schema: str) -> None: output = ifcpatch.execute( diff --git a/src/blenderbim/blenderbim/tool/profile.py b/src/blenderbim/blenderbim/tool/profile.py index 3c6761e524..7b82b46e6f 100644 --- a/src/blenderbim/blenderbim/tool/profile.py +++ b/src/blenderbim/blenderbim/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 +from ..core import tool as core_tool from .. import tool import PIL.ImageDraw from ..bim.module.model.decorator import ProfileDecorator from typing import Union -class Profile(blenderbim.core.tool.Profile): +class Profile(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/blenderbim/blenderbim/tool/project.py b/src/blenderbim/blenderbim/tool/project.py index 91ca857cb1..3f46b28120 100644 --- a/src/blenderbim/blenderbim/tool/project.py +++ b/src/blenderbim/blenderbim/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 +from ..core import aggregate as core_aggregate +from ..core import context as core_context +from ..core import tool as core_tool +from ..core import root as core_root +from ..core import unit as core_unit +from ..core import owner as core_owner +from ..bim import schema as bim_schema from .. import tool from ..bim.ifc import IfcStore from pathlib import Path from typing import Optional -class Project(blenderbim.core.tool.Project): +class Project(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)) + 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 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 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 core_owner.add_organisation(tool.Ifc) @classmethod def run_owner_add_person(cls): - return blenderbim.core.owner.add_person(tool.Ifc) + return 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 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 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 core_root.assign_class( tool.Ifc, tool.Collector, tool.Root, @@ -118,7 +118,7 @@ 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 core_unit.assign_scene_units(tool.Ifc, tool.Unit) @classmethod def set_context(cls, context): diff --git a/src/blenderbim/blenderbim/tool/pset.py b/src/blenderbim/blenderbim/tool/pset.py index a27061e23a..d8f23fb057 100644 --- a/src/blenderbim/blenderbim/tool/pset.py +++ b/src/blenderbim/blenderbim/tool/pset.py @@ -19,13 +19,13 @@ import bpy import ifcopenshell import ifcopenshell.util.element -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool -import blenderbim.bim.schema +from ..bim import schema as bim_schema from typing import Union -class Pset(blenderbim.core.tool.Pset): +class Pset(core_tool.Pset): @classmethod def get_element_pset( cls, element: ifcopenshell.entity_instance, pset_name: str @@ -67,7 +67,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 bim_schema.ifc.psetqto.get_applicable_names( element.is_a(), ifcopenshell.util.element.get_predefined_type(element), pset_only=True ) ) @@ -249,7 +249,7 @@ class Pset(blenderbim.core.tool.Pset): @classmethod def get_pset_template(cls, name): - return blenderbim.bim.schema.ifc.psetqto.get_by_name(name) + return bim_schema.ifc.psetqto.get_by_name(name) @classmethod def add_proposed_property(cls, name, value, props): diff --git a/src/blenderbim/blenderbim/tool/qto.py b/src/blenderbim/blenderbim/tool/qto.py index 1929c63b81..e1ae21c26e 100644 --- a/src/blenderbim/blenderbim/tool/qto.py +++ b/src/blenderbim/blenderbim/tool/qto.py @@ -17,8 +17,8 @@ # along with BlenderBIM Add-on. If not, see . import bpy -import blenderbim.core.tool -import blenderbim.bim.schema +from ..core import tool as core_tool +from ..bim import schema as bim_schema from .. import tool import ifcopenshell import ifcopenshell.util.unit @@ -28,7 +28,7 @@ from typing import Optional, Union, Literal QuantityTypes = Literal["Q_LENGTH", "Q_AREA", "Q_VOLUME"] -class Qto(blenderbim.core.tool.Qto): +class Qto(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] @@ -64,7 +64,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 = 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) diff --git a/src/blenderbim/blenderbim/tool/resource.py b/src/blenderbim/blenderbim/tool/resource.py index 50ad7d2dd6..0723aa5815 100644 --- a/src/blenderbim/blenderbim/tool/resource.py +++ b/src/blenderbim/blenderbim/tool/resource.py @@ -19,9 +19,9 @@ # ############################################################################ # import bpy -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool -import blenderbim.bim.helper +from ..bim import helper as bim_helper from ..bim.module.sequence. import helper import json import time @@ -31,12 +31,12 @@ from dateutil import parser import ifcopenshell.util.date as ifcdateutils import ifcopenshell.util.cost import ifcopenshell.util.resource -import blenderbim.bim.schema +from ..bim import schema as bim_schema import ifcopenshell.util.constraint from typing import Any, Union -class Resource(blenderbim.core.tool.Resource): +class Resource(core_tool.Resource): @classmethod def load_resources(cls) -> None: def create_new_resource_li(resource, level_index): @@ -91,7 +91,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) + bim_helper.import_attributes2(resource, bpy.context.scene.BIMResourceProperties.resource_attributes) @classmethod def enable_editing_resource(cls, resource: ifcopenshell.entity_instance) -> None: @@ -102,7 +102,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 bim_helper.export_attributes(bpy.context.scene.BIMResourceProperties.resource_attributes) @classmethod def enable_editing_resource_time(cls, resource: ifcopenshell.entity_instance) -> None: @@ -127,7 +127,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( + bim_helper.import_attributes2( resource_time, bpy.context.scene.BIMResourceProperties.resource_time_attributes, callback ) @@ -148,7 +148,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 bim_helper.export_attributes(props.resource_time_attributes, callback) @classmethod def enable_editing_resource_costs(cls, resource: ifcopenshell.entity_instance) -> None: @@ -221,7 +221,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) + 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 +255,7 @@ class Resource(blenderbim.core.tool.Resource): if prop.name == "UnitBasisUnit": return True - return blenderbim.bim.helper.export_attributes( + return bim_helper.export_attributes( bpy.context.scene.BIMResourceProperties.cost_value_attributes, callback ) @@ -271,7 +271,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) + bim_helper.import_attributes2(resource_quantity, props.quantity_attributes) @classmethod def disable_editing_resource_quantity(cls) -> None: @@ -279,7 +279,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 bim_helper.export_attributes(bpy.context.scene.BIMResourceProperties.quantity_attributes) @classmethod def expand_resource(cls, resource: ifcopenshell.entity_instance) -> None: diff --git a/src/blenderbim/blenderbim/tool/root.py b/src/blenderbim/blenderbim/tool/root.py index 72dc94d9d9..ee0b2d404e 100644 --- a/src/blenderbim/blenderbim/tool/root.py +++ b/src/blenderbim/blenderbim/tool/root.py @@ -22,17 +22,17 @@ 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 +from ..core import tool as core_tool +from ..core import root as core_root +from ..core import aggregate as core_aggregate +from ..core import geometry as core_geometry +from ..core import material as core_material +from ..core import style as core_style from .. import tool from typing import Union, Optional, Any -class Root(blenderbim.core.tool.Root): +class Root(core_tool.Root): @classmethod def add_tracked_opening(cls, obj: bpy.types.Object) -> None: new = bpy.context.scene.BIMModelProperties.openings.add() @@ -244,7 +244,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( + core_geometry.switch_representation( tool.Ifc, tool.Geometry, obj=voided_obj, @@ -285,7 +285,7 @@ class Root(blenderbim.core.tool.Root): try: new_aggregate = old_to_new[old_aggregate] except: - blenderbim.core.aggregate.unassign_object( + core_aggregate.unassign_object( tool.Ifc, tool.Aggregate, tool.Collector, @@ -294,7 +294,7 @@ class Root(blenderbim.core.tool.Root): ) continue - blenderbim.core.aggregate.assign_object( + core_aggregate.assign_object( tool.Ifc, tool.Aggregate, tool.Collector, @@ -307,7 +307,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( + core_aggregate.assign_object( tool.Ifc, tool.Aggregate, tool.Collector, @@ -323,7 +323,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 core_geometry.add_representation( tool.Ifc, tool.Geometry, tool.Style, diff --git a/src/blenderbim/blenderbim/tool/search.py b/src/blenderbim/blenderbim/tool/search.py index 118859c9c6..166908929d 100644 --- a/src/blenderbim/blenderbim/tool/search.py +++ b/src/blenderbim/blenderbim/tool/search.py @@ -1,14 +1,14 @@ import bpy import json import lark -import blenderbim.core.tool +from ..core import tool as core_tool import ifcopenshell.guid import ifcopenshell.util.selector from ..bim.prop import BIMFacet from typing import Union, Literal -class Search(blenderbim.core.tool.Search): +class Search(core_tool.Search): @classmethod def get_group_query(cls, group: ifcopenshell.entity_instance) -> str: return json.loads(group.Description)["query"] diff --git a/src/blenderbim/blenderbim/tool/sequence.py b/src/blenderbim/blenderbim/tool/sequence.py index f28dbd15fc..a904226f4e 100644 --- a/src/blenderbim/blenderbim/tool/sequence.py +++ b/src/blenderbim/blenderbim/tool/sequence.py @@ -29,17 +29,17 @@ import ifcopenshell.util.sequence import ifcopenshell.util.date import ifcopenshell.util.element import ifcopenshell.util.unit -import blenderbim.core.tool -import blenderbim.core +from ..core import tool as core_tool +from .. import core as core from .. import tool -import blenderbim.bim.helper +from ..bim import helper as bim_helper from ..bim.module.sequence. import helper from dateutil import parser from datetime import datetime from typing import Optional, Any, Union -class Sequence(blenderbim.core.tool.Sequence): +class Sequence(core_tool.Sequence): @classmethod def get_work_plan_attributes(cls) -> dict[str, Any]: def callback(attributes, prop): @@ -57,7 +57,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 bim_helper.export_attributes(props.work_plan_attributes, callback) @classmethod def load_work_plan_attributes(cls, work_plan: ifcopenshell.entity_instance) -> None: @@ -68,7 +68,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) + 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 +103,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 bim_helper.export_attributes(props.work_schedule_attributes, callback) @classmethod def load_work_schedule_attributes(cls, work_schedule: ifcopenshell.entity_instance) -> None: @@ -114,7 +114,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) + 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 +323,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) + bim_helper.import_attributes2(task, props.task_attributes) @classmethod def enable_editing_task_attributes(cls, task: ifcopenshell.entity_instance) -> None: @@ -333,7 +333,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 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 +357,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) + 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 +399,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 bim_helper.export_attributes(props.task_time_attributes, callback) @classmethod def load_task_resources(cls, task: ifcopenshell.entity_instance) -> None: @@ -490,7 +490,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 bim_helper.import_attributes2(work_calendar, props.work_calendar_attributes) @classmethod def enable_editing_work_calendar(cls, work_calendar: ifcopenshell.entity_instance) -> None: @@ -503,7 +503,7 @@ class Sequence(blenderbim.core.tool.Sequence): @classmethod def get_work_calendar_attributes(cls) -> dict[str, Any]: - return blenderbim.bim.helper.export_attributes( + return bim_helper.export_attributes( bpy.context.scene.BIMWorkCalendarProperties.work_calendar_attributes ) @@ -517,7 +517,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) + 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 +577,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 bim_helper.export_attributes(props.work_time_attributes, callback) @classmethod def get_recurrence_pattern_attributes(cls, recurrence_pattern): @@ -645,7 +645,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) + 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 +669,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) + 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 +679,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 bim_helper.export_attributes(bpy.context.scene.BIMWorkScheduleProperties.sequence_attributes) @classmethod def disable_editing_rel_sequence(cls) -> None: @@ -687,7 +687,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 bim_helper.export_attributes(bpy.context.scene.BIMWorkScheduleProperties.lag_time_attributes) @classmethod def select_products(cls, products): diff --git a/src/blenderbim/blenderbim/tool/spatial.py b/src/blenderbim/blenderbim/tool/spatial.py index bbd28beed9..1a3c85b528 100644 --- a/src/blenderbim/blenderbim/tool/spatial.py +++ b/src/blenderbim/blenderbim/tool/spatial.py @@ -29,11 +29,11 @@ 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 +from ..core import type as core_type +from ..core import tool as core_tool +from ..core import root as core_root +from ..core import spatial as core_spatial +from ..core import geometry as core_geometry from .. import tool import json from math import pi @@ -42,7 +42,7 @@ from shapely import Polygon from typing import Generator, Optional, Union, Literal, Any -class Spatial(blenderbim.core.tool.Spatial): +class Spatial(core_tool.Spatial): @classmethod def can_contain( cls, structure_obj: Union[bpy.types.Object, None], element_obj: Union[bpy.types.Object, None] @@ -138,19 +138,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 core_root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=obj) @classmethod def run_spatial_assign_container( cls, structure_obj: bpy.types.Object, element_obj: bpy.types.Object ) -> Union[ifcopenshell.entity_instance, None]: - return blenderbim.core.spatial.assign_container( + return core_spatial.assign_container( tool.Ifc, tool.Collector, tool.Spatial, structure_obj=structure_obj, element_obj=element_obj ) @classmethod def run_spatial_import_spatial_decomposition(cls) -> None: - return blenderbim.core.spatial.import_spatial_decomposition(tool.Spatial) + return core_spatial.import_spatial_decomposition(tool.Spatial) @classmethod def select_object(cls, obj: bpy.types.Object) -> None: @@ -301,7 +301,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) + 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) @@ -794,11 +794,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) + 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( + core_geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, diff --git a/src/blenderbim/blenderbim/tool/structural.py b/src/blenderbim/blenderbim/tool/structural.py index 3eed5cc972..44e9372a9b 100644 --- a/src/blenderbim/blenderbim/tool/structural.py +++ b/src/blenderbim/blenderbim/tool/structural.py @@ -19,15 +19,15 @@ import bpy import ifcopenshell import json -import blenderbim.bim.helper -import blenderbim.core.tool -import blenderbim.core.structural +from ..bim import helper as bim_helper +from ..core import tool as core_tool +from ..core import structural as core_structural from .. import tool from ..bim.ifc import IfcStore from pprint import pprint -class Structural(blenderbim.core.tool.Structural): +class Structural(core_tool.Structural): @classmethod def disable_editing_structural_analysis_model(cls): bpy.context.scene.BIMStructuralProperties.active_structural_analysis_model_id = 0 @@ -121,7 +121,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 = bim_helper.export_attributes(props.structural_analysis_model_attributes) return attributes @classmethod diff --git a/src/blenderbim/blenderbim/tool/style.py b/src/blenderbim/blenderbim/tool/style.py index c363061501..ffebf665e7 100644 --- a/src/blenderbim/blenderbim/tool/style.py +++ b/src/blenderbim/blenderbim/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 +from ..core import tool as core_tool from .. import tool -import blenderbim.bim.helper +from ..bim import helper as 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(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") @@ -89,7 +89,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 bim_helper.export_attributes(props.attributes) @classmethod def get_active_style_type(cls) -> str: @@ -517,7 +517,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) + 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/blenderbim/blenderbim/tool/surveyor.py b/src/blenderbim/blenderbim/tool/surveyor.py index 6fc66e427d..81ad979c71 100644 --- a/src/blenderbim/blenderbim/tool/surveyor.py +++ b/src/blenderbim/blenderbim/tool/surveyor.py @@ -18,12 +18,12 @@ import bpy import ifcopenshell.api -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool import numpy as np -class Surveyor(blenderbim.core.tool.Surveyor): +class Surveyor(core_tool.Surveyor): @classmethod def get_absolute_matrix(cls, obj): matrix = np.array(obj.matrix_world) diff --git a/src/blenderbim/blenderbim/tool/system.py b/src/blenderbim/blenderbim/tool/system.py index ce131f5dc8..3efbad8dea 100644 --- a/src/blenderbim/blenderbim/tool/system.py +++ b/src/blenderbim/blenderbim/tool/system.py @@ -19,10 +19,10 @@ 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 +from ..bim import helper as bim_helper +from ..core import geometry as core_geometry +from ..core import root as core_root +from ..core import tool as core_tool from .. import tool from ..bim import import_ifc import re @@ -33,7 +33,7 @@ from ..bim.module.drawing.decoration import profile_consequential from enum import Enum -class System(blenderbim.core.tool.System): +class System(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 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) + 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 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 core_root.assign_class( tool.Ifc, tool.Collector, tool.Root, diff --git a/src/blenderbim/blenderbim/tool/type.py b/src/blenderbim/blenderbim/tool/type.py index a2e838e3f5..48fc49125f 100644 --- a/src/blenderbim/blenderbim/tool/type.py +++ b/src/blenderbim/blenderbim/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 +from ..core import tool as core_tool +from ..core import geometry as core_geometry from .. import tool -import blenderbim.bim.helper +from ..bim import helper as bim_helper from typing import Union -class Type(blenderbim.core.tool.Type): +class Type(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) @@ -111,7 +111,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 core_geometry.add_representation( tool.Ifc, tool.Geometry, tool.Style, @@ -130,7 +130,7 @@ class Type(blenderbim.core.tool.Type): should_reload: bool = False, is_global: bool = False, ) -> None: - return blenderbim.core.geometry.switch_representation( + return core_geometry.switch_representation( tool.Ifc, tool.Geometry, obj=obj, diff --git a/src/blenderbim/blenderbim/tool/unit.py b/src/blenderbim/blenderbim/tool/unit.py index ed59a96998..1673295cf9 100644 --- a/src/blenderbim/blenderbim/tool/unit.py +++ b/src/blenderbim/blenderbim/tool/unit.py @@ -19,11 +19,11 @@ import bpy import json import ifcopenshell -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool -class Unit(blenderbim.core.tool.Unit): +class Unit(core_tool.Unit): @classmethod def clear_active_unit(cls): bpy.context.scene.BIMUnitProperties.active_unit_id = 0 diff --git a/src/blenderbim/blenderbim/tool/web.py b/src/blenderbim/blenderbim/tool/web.py index 6b712cabc5..90608d4942 100644 --- a/src/blenderbim/blenderbim/tool/web.py +++ b/src/blenderbim/blenderbim/tool/web.py @@ -18,7 +18,7 @@ import bpy from ..bim.module.web.data import WebData -import blenderbim.core.tool +from ..core import tool as core_tool from .. import tool import ifcopenshell.api.sequence import socket @@ -44,7 +44,7 @@ IFC_TASK_ATTRIBUTE_MAP = { } -class Web(blenderbim.core.tool.Web): +class Web(core_tool.Web): @classmethod def generate_port_number(cls): print("Generating port number")