Make all "import" imports relative

This commit is contained in:
Dion Moult
2024-07-18 16:15:16 +10:00
parent a0feae8717
commit e4193c59ac
88 changed files with 444 additions and 446 deletions
+5 -5
View File
@@ -30,10 +30,10 @@ import ifcopenshell.api
import ifcopenshell.util.placement
import ifcopenshell.util.unit
from .. import tool
import blenderbim.core.geometry
import blenderbim.core.aggregate
import blenderbim.core.spatial
import blenderbim.core.style
from ..core import geometry as core_geometry
from ..core import aggregate as core_aggregate
from ..core import spatial as core_spatial
from ..core import style as core_style
from .ifc import IfcStore
from mathutils import Vector
from typing import Union
@@ -152,7 +152,7 @@ class IfcExporter:
return self.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
def sync_grid_axis_object_placement(self, obj: bpy.types.Object, element: ifcopenshell.entity_instance) -> None:
+3 -3
View File
@@ -23,7 +23,7 @@ import addon_utils
import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.api.owner.settings
import blenderbim.bim
from .. import bim
from .. import tool
from ..core import owner as core_owner
from bpy.app.handlers import persistent
@@ -170,7 +170,7 @@ def subscribe_to(obj, data_path, callback):
def refresh_ui_data():
from blenderbim.bim import modules
from . import modules
for name, value in modules.items():
try:
@@ -308,7 +308,7 @@ def load_post(scene):
# tab. We override default scene properties panels with our own poll
# to hide them unless the user has chosen to view Blender properties.
for panel in tool.Blender.get_scene_panels_list():
if panel in blenderbim.bim.original_scene_panels_polls:
if panel in bim.original_scene_panels_polls:
continue
tool.Blender.override_scene_panel(panel)
tool.Blender.setup_tabs()
+8 -8
View File
@@ -28,7 +28,7 @@ import importlib
import ifcopenshell
import ifcopenshell.geom
import ifcopenshell.ifcopenshell_wrapper
import blenderbim.bim.handler
from . import handler as bim_handler
from .. import tool
from pathlib import Path
from ..tool.brick import BrickStore
@@ -253,11 +253,11 @@ class IfcStore:
else:
obj.BIMObjectProperties.ifc_definition_id = element.id()
blenderbim.bim.handler.subscribe_to(obj, "name", blenderbim.bim.handler.name_callback)
bim_handler.subscribe_to(obj, "name", bim_handler.name_callback)
if isinstance(obj, bpy.types.Object):
blenderbim.bim.handler.subscribe_to(
obj, "active_material_index", blenderbim.bim.handler.active_material_index_callback
bim_handler.subscribe_to(
obj, "active_material_index", bim_handler.active_material_index_callback
)
if IfcStore.history:
@@ -280,10 +280,10 @@ class IfcStore:
IfcStore.id_map[data["id"]] = obj
if "guid" in data:
IfcStore.guid_map[data["guid"]] = obj
blenderbim.bim.handler.subscribe_to(obj, "name", blenderbim.bim.handler.name_callback)
bim_handler.subscribe_to(obj, "name", bim_handler.name_callback)
if isinstance(obj, bpy.types.Object):
blenderbim.bim.handler.subscribe_to(
obj, "active_material_index", blenderbim.bim.handler.active_material_index_callback
bim_handler.subscribe_to(
obj, "active_material_index", bim_handler.active_material_index_callback
)
# TODO Listeners are not re-registered. Does this cause nasty problems to debug later on?
# TODO We're handling id_map and guid_map, but what about edited_objs? This might cause big problems.
@@ -398,7 +398,7 @@ class IfcStore:
if BrickStore.graph is not None: # `if BrickStore.graph` by itself takes ages.
BrickStore.end_transaction()
IfcStore.end_transaction(operator)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return result
@@ -21,8 +21,8 @@ import ifcopenshell
import ifcopenshell.util.element
from .... import tool
from ....core import aggregate as core
import blenderbim.core.spatial
import blenderbim.bim.handler
from ....core import spatial as core_spatial
from ... import handler as bim_handler
from ...ifc import IfcStore
@@ -163,7 +163,7 @@ class BIM_OT_add_aggregate(bpy.types.Operator, tool.Ifc.Operator):
related_obj=aggregate,
)
elif current_container:
blenderbim.core.spatial.assign_container(
core_spatial.assign_container(
tool.Ifc,
tool.Collector,
tool.Spatial,
@@ -283,7 +283,7 @@ class BIM_OT_add_part_to_object(bpy.types.Operator, tool.Ifc.Operator):
part_class=self.part_class,
part_name=self.part_name,
)
blenderbim.core.spatial.import_spatial_decomposition(tool.Spatial)
core_spatial.import_spatial_decomposition(tool.Spatial)
class BIM_OT_break_link_to_other_aggregates(bpy.types.Operator, tool.Ifc.Operator):
@@ -21,8 +21,8 @@ import json
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.guid
import blenderbim.bim.helper
import blenderbim.bim.handler
from ... import helper as bim_helper
from ... import handler as bim_handler
from .... import tool
from ....core import attribute as core
from ...ifc import IfcStore
@@ -58,13 +58,13 @@ class EnableEditingAttributes(bpy.types.Operator):
new.data_type = "string"
new.ifc_class = data["type"]
new.string_value = "" if new.is_null else json.dumps(data[name])
blenderbim.bim.helper.add_attribute_description(new)
bim_helper.add_attribute_description(new)
new.description += " The degrees, minutes and seconds should follow this format : [12,34,56]"
if name in ("PredefinedType", "ObjectType") and has_inherited_predefined_type:
props.attributes.remove(len(props.attributes) - 1)
return True
blenderbim.bim.helper.import_attributes2(element, props.attributes, callback=callback)
bim_helper.import_attributes2(element, props.attributes, callback=callback)
props.is_editing_attributes = True
return {"FINISHED"}
@@ -105,7 +105,7 @@ class EditAttributes(bpy.types.Operator, tool.Ifc.Operator):
attributes[prop.name] = None
return True
attributes = blenderbim.bim.helper.export_attributes(props.attributes, callback=callback)
attributes = bim_helper.export_attributes(props.attributes, callback=callback)
ifcopenshell.api.run("attribute.edit_attributes", self.file, product=product, attributes=attributes)
bpy.ops.bim.disable_editing_attributes(obj=obj.name)
return {"FINISHED"}
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel
from ...ifc import IfcStore
from .data import AttributesData
@@ -34,7 +34,7 @@ def draw_ui(context, layout, attributes):
op = row.operator("bim.disable_editing_attributes", icon="CANCEL", text="")
op.obj = obj.name
blenderbim.bim.helper.draw_attributes(props.attributes, layout, copy_operator="bim.copy_attribute_to_selection")
bim_helper.draw_attributes(props.attributes, layout, copy_operator="bim.copy_attribute_to_selection")
else:
row = layout.row()
op = row.operator("bim.enable_editing_attributes", icon="GREASEPENCIL", text="Edit")
@@ -38,8 +38,8 @@ from mathutils import Vector, Matrix
from ...ifc import IfcStore
from ..model.decorator import ProfileDecorator
from .decorator import BoundaryDecorator
import blenderbim.core
import blenderbim.core.geometry
from .... import core as core
from ....core import geometry as core_geometry
def get_boundaries_collection(blender_space):
@@ -521,7 +521,7 @@ class ShowBoundaries(bpy.types.Operator, tool.Ifc.Operator):
if not element or not getattr(element, "BoundedBy", None):
continue
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)
element = tool.Ifc.get_entity(obj)
for rel in element.BoundedBy or []:
boundary_obj = loader.load_boundary(rel, obj)
@@ -1014,7 +1014,7 @@ class AddBoundary(bpy.types.Operator, tool.Ifc.Operator):
def get_flattened_polygon(self, element, relating_space_obj, target_face_matrix_i):
obj = tool.Ifc.get_object(element)
if obj and 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)
space_matrix_i = relating_space_obj.matrix_world.inverted()
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel, UIList
from ...ifc import IfcStore
from .... import tool
@@ -21,7 +21,7 @@ import bpy
import ifcopenshell.api
from .... import tool
from ....core import brick as core
import blenderbim.bim.handler
from ... import handler as bim_handler
from ...ifc import IfcStore
from ....tool.brick import BrickStore
@@ -197,7 +197,7 @@ class NewBrickFile(bpy.types.Operator):
}
IfcStore.add_transaction_operation(self, rollback=lambda data: True, commit=self.commit)
IfcStore.end_transaction(self)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
def _execute(self, context):
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel
from .data import ClashData
@@ -92,7 +92,7 @@ class BIM_PT_ifcclash(Panel):
op.group = "a"
if source.mode != "a":
blenderbim.bim.helper.draw_filter(
bim_helper.draw_filter(
layout, source.filter_groups, ClashData, f"clash_{props.active_clash_set_index}_a_{index}"
)
@@ -112,7 +112,7 @@ class BIM_PT_ifcclash(Panel):
op.group = "b"
if source.mode != "a":
blenderbim.bim.helper.draw_filter(
bim_helper.draw_filter(
layout, source.filter_groups, ClashData, f"clash_{props.active_clash_set_index}_b_{index}"
)
@@ -23,7 +23,7 @@ import ifcopenshell.api
import ifcopenshell.util.classification
import ifcopenshell.util.element
from .... import tool
import blenderbim.bim.helper
from ... import helper as bim_helper
from ...ifc import IfcStore
@@ -63,7 +63,7 @@ class AddManualClassification(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
props = context.scene.BIMClassificationProperties
attributes = blenderbim.bim.helper.export_attributes(props.classification_attributes)
attributes = bim_helper.export_attributes(props.classification_attributes)
classification = ifcopenshell.api.run(
"classification.add_classification", tool.Ifc.get(), classification="Unnamed"
)
@@ -89,7 +89,7 @@ class AddManualClassificationReference(bpy.types.Operator, tool.Ifc.Operator):
else:
objects = [self.obj]
props = context.scene.BIMClassificationReferenceProperties
attributes = blenderbim.bim.helper.export_attributes(props.reference_attributes)
attributes = bim_helper.export_attributes(props.reference_attributes)
products = [
tool.Ifc.get().by_id(ifc_definition_id)
for obj in objects
@@ -140,7 +140,7 @@ class EnableAddingManualClassification(bpy.types.Operator):
props.is_adding = True
props.active_classification_id = 0
props.classification_attributes.clear()
blenderbim.bim.helper.import_attributes2("IfcClassification", props.classification_attributes)
bim_helper.import_attributes2("IfcClassification", props.classification_attributes)
return {"FINISHED"}
@@ -164,7 +164,7 @@ class EnableAddingManualClassificationReference(bpy.types.Operator):
props = context.scene.BIMClassificationReferenceProperties
props.is_adding = True
props.reference_attributes.clear()
blenderbim.bim.helper.import_attributes2("IfcClassificationReference", props.reference_attributes)
bim_helper.import_attributes2("IfcClassificationReference", props.reference_attributes)
return {"FINISHED"}
@@ -198,7 +198,7 @@ class EnableEditingClassification(bpy.types.Operator):
props = context.scene.BIMClassificationProperties
props.classification_attributes.clear()
blenderbim.bim.helper.import_attributes2(
bim_helper.import_attributes2(
tool.Ifc.get().by_id(self.classification), props.classification_attributes, callback
)
props.active_classification_id = self.classification
@@ -268,7 +268,7 @@ class EnableEditingClassificationReference(bpy.types.Operator):
def execute(self, context):
props = context.scene.BIMClassificationReferenceProperties
props.reference_attributes.clear()
blenderbim.bim.helper.import_attributes2(tool.Ifc.get().by_id(self.reference), props.reference_attributes)
bim_helper.import_attributes2(tool.Ifc.get().by_id(self.reference), props.reference_attributes)
props.active_reference_id = self.reference
return {"FINISHED"}
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from ...ifc import IfcStore
from ...prop import StrProperty, Attribute
from .data import ClassificationsData, ClassificationReferencesData
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from . import prop as classification_prop
from bpy.types import Panel, UIList
@@ -67,7 +67,7 @@ class BIM_PT_classifications(Panel):
def draw_add_manual_ui(self, context):
if self.props.is_adding:
blenderbim.bim.helper.draw_attributes(self.props.classification_attributes, self.layout)
bim_helper.draw_attributes(self.props.classification_attributes, self.layout)
row = self.layout.row(align=True)
row.operator("bim.add_manual_classification", text="Save", icon="CHECKMARK")
row.operator("bim.disable_adding_manual_classification", text="", icon="CANCEL")
@@ -104,7 +104,7 @@ class BIM_PT_classifications(Panel):
row = self.layout.row(align=True)
row.operator("bim.edit_classification", text="Save changes", icon="CHECKMARK")
row.operator("bim.disable_editing_classification", text="", icon="CANCEL")
blenderbim.bim.helper.draw_attributes(self.props.classification_attributes, self.layout)
bim_helper.draw_attributes(self.props.classification_attributes, self.layout)
def draw_ui(self, classification):
row = self.layout.row(align=True)
@@ -151,7 +151,7 @@ class ReferenceUI:
row = self.layout.row()
row.prop(self.props, "classifications", text="")
if self.props.is_adding:
blenderbim.bim.helper.draw_attributes(self.props.reference_attributes, self.layout)
bim_helper.draw_attributes(self.props.reference_attributes, self.layout)
row = self.layout.row(align=True)
op = row.operator("bim.add_manual_classification_reference", text="Save", icon="CHECKMARK")
op.obj_type = self.data.data["object_type"]
@@ -203,7 +203,7 @@ class ReferenceUI:
box = self.layout.box()
row = box.row()
row.label(text=pset.name, icon="COPY_ID")
blenderbim.bim.helper.draw_attributes(pset.properties, box)
bim_helper.draw_attributes(pset.properties, box)
def draw_add_file_ui(self, context):
if not self.data.data["active_classification_library"]:
@@ -243,7 +243,7 @@ class ReferenceUI:
row = self.layout.row(align=True)
row.operator("bim.edit_classification_reference", text="Save changes", icon="CHECKMARK")
row.operator("bim.disable_editing_classification_reference", text="", icon="CANCEL")
blenderbim.bim.helper.draw_attributes(self.props.reference_attributes, self.layout)
bim_helper.draw_attributes(self.props.reference_attributes, self.layout)
def draw_reference_ui(self, reference):
row = self.layout.row(align=True)
@@ -20,7 +20,7 @@ import bpy
import json
import ifcopenshell.api
import ifcopenshell.util.attribute
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from ...ifc import IfcStore
@@ -62,7 +62,7 @@ class EnableEditingConstraint(bpy.types.Operator):
def execute(self, context):
props = context.scene.BIMConstraintProperties
props.constraint_attributes.clear()
blenderbim.bim.helper.import_attributes2(tool.Ifc.get().by_id(self.constraint), props.constraint_attributes)
bim_helper.import_attributes2(tool.Ifc.get().by_id(self.constraint), props.constraint_attributes)
props.active_constraint_id = self.constraint
return {"FINISHED"}
@@ -19,8 +19,8 @@
import bpy
from .... import tool
from ....core import context as core
import blenderbim.bim.module.context.data
import blenderbim.bim.handler
from . import data as bim_module_context_data
from ... import handler as bim_handler
from ...ifc import IfcStore
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from .data import ContextData
@@ -56,7 +56,7 @@ class BIM_PT_context(bpy.types.Panel):
row = box.row(align=True)
row.operator("bim.edit_context", icon="CHECKMARK")
row.operator("bim.disable_editing_context", icon="CANCEL", text="")
blenderbim.bim.helper.draw_attributes(ifc_context["props"], box)
bim_helper.draw_attributes(ifc_context["props"], box)
else:
row = box.row(align=True)
row.label(text=ifc_context["context_type"])
@@ -64,8 +64,8 @@ class BIM_PT_context(bpy.types.Panel):
row.operator("bim.remove_context", icon="X", text="").context = ifc_context["id"]
row = box.row(align=True)
blenderbim.bim.helper.prop_with_search(row, props, "subcontexts", text="")
blenderbim.bim.helper.prop_with_search(row, props, "target_views", text="")
bim_helper.prop_with_search(row, props, "subcontexts", text="")
bim_helper.prop_with_search(row, props, "target_views", text="")
op = row.operator("bim.add_context", icon="ADD", text="")
op.context_type = ifc_context["context_type"]
op.context_identifier = props.subcontexts
@@ -77,7 +77,7 @@ class BIM_PT_context(bpy.types.Panel):
row = box.row(align=True)
row.operator("bim.edit_context", icon="CHECKMARK")
row.operator("bim.disable_editing_context", icon="CANCEL", text="")
blenderbim.bim.helper.draw_attributes(subcontext["props"], box)
bim_helper.draw_attributes(subcontext["props"], box)
else:
row = box.row(align=True)
row.label(text=subcontext["context_type"])
@@ -23,7 +23,7 @@ import ifcopenshell.util.date
import ifcopenshell.util.element
import ifcopenshell.util.unit
from .... import tool
import blenderbim.bim.schema
from ... import schema as bim_schema
from ifcopenshell.util.doc import get_entity_doc, get_predefined_type_doc
from typing import Any
@@ -21,7 +21,7 @@ import bpy
import json
import time
import ifcopenshell.api
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from bpy_extras.io_utils import ImportHelper
from .... import tool
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
from ... import helper as bim_helper
from . import prop as CostProp
from bpy.types import Panel, UIList
from ...ifc import IfcStore
@@ -131,7 +131,7 @@ class BIM_PT_cost_schedules(Panel):
row.operator("bim.add_currency", text="", icon="ADD")
def draw_editable_cost_schedule_ui(self):
blenderbim.bim.helper.draw_attributes(self.props.cost_schedule_attributes, self.layout)
bim_helper.draw_attributes(self.props.cost_schedule_attributes, self.layout)
def draw_editable_cost_item_ui(self):
row = self.layout.row(align=True)
@@ -188,7 +188,7 @@ class BIM_PT_cost_schedules(Panel):
self.draw_editable_cost_item_values_ui()
def draw_editable_cost_item_attributes_ui(self):
blenderbim.bim.helper.draw_attributes(self.props.cost_item_attributes, self.layout)
bim_helper.draw_attributes(self.props.cost_item_attributes, self.layout)
def draw_editable_cost_item_quantities_ui(self, cost_item: dict[str, Any]):
quantities = CostSchedulesData.data["cost_quantities"]
@@ -225,7 +225,7 @@ class BIM_PT_cost_schedules(Panel):
op.physical_quantity = quantity["id"]
if self.props.active_cost_item_quantity_id and self.props.active_cost_item_quantity_id == quantity["id"]:
blenderbim.bim.helper.draw_attributes(self.props.quantity_attributes, self.layout.box())
bim_helper.draw_attributes(self.props.quantity_attributes, self.layout.box())
def draw_editable_cost_item_values_ui(self):
row = self.layout.row(align=True)
@@ -245,7 +245,7 @@ class BIM_PT_cost_schedules(Panel):
self.draw_readonly_cost_value_ui(row, cost_value)
if self.props.cost_value_editing_type == "ATTRIBUTES":
blenderbim.bim.helper.draw_attributes(self.props.cost_value_attributes, self.layout.box())
bim_helper.draw_attributes(self.props.cost_value_attributes, self.layout.box())
def draw_readonly_cost_value_ui(self, layout, cost_value):
if cost_value["name"]:
@@ -18,7 +18,6 @@
import bpy
from ...prop import StrProperty, Attribute
#from blenderbim.bim.module.spatial.data import SpatialData
from bpy.types import PropertyGroup
from bpy.props import (
PointerProperty,
@@ -30,9 +29,6 @@ from bpy.props import (
FloatVectorProperty,
CollectionProperty,
)
#import blenderbim.tool as tool
#import blenderbim.core.geometry
#import ifcopenshell
class BIMCoveringProperties(PropertyGroup):
@@ -25,7 +25,7 @@ from ...helper import prop_with_search
from ..model.data import AuthoringData
from bpy.types import WorkSpaceTool
from ...ifc import IfcStore
import blenderbim.bim.handler
from ... import handler as bim_handler
class CoveringTool(WorkSpaceTool):
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel
from ...ifc import IfcStore
from ..search.data import SearchData
@@ -85,7 +85,7 @@ class BIM_PT_ifccsv(Panel):
row.prop(props, "concat_value")
layout.use_property_split = False
blenderbim.bim.helper.draw_filter(self.layout, props.filter_groups, SearchData, "csv")
bim_helper.draw_filter(self.layout, props.filter_groups, SearchData, "csv")
row = layout.row(align=True)
op = row.operator("bim.search", text="Select", icon="VIEWZOOM")
@@ -33,7 +33,7 @@ import ifcopenshell.util.placement
import ifcopenshell.util.representation
from .... import tool
from ....core import debug as core
import blenderbim.bim.handler
from ... import handler as bim_handler
from ... import import_ifc
from pathlib import Path
from ...ifc import IfcStore
@@ -102,7 +102,7 @@ class ConvertToBlender(bpy.types.Operator):
context.scene.BIMProperties.ifc_file = ""
context.scene.BIMDebugProperties.attributes.clear()
IfcStore.purge()
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
@@ -409,7 +409,7 @@ class ParseExpress(bpy.types.Operator):
def execute(self, context):
core.parse_express(tool.Debug, context.scene.BIMDebugProperties.express_file)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
@@ -610,8 +610,6 @@ class PipInstall(bpy.types.Operator):
name: bpy.props.StringProperty()
def execute(self, context):
import blenderbim.bim
target = [p for p in sys.path if p.endswith("packages") and "addons" in p][0]
py_exec = str(sys.executable)
@@ -30,7 +30,7 @@
import bpy
from .... import tool
from ....core import demo as core
import blenderbim.bim.handler
from ... import handler as bim_handler
# Each button correlates to a class like the one below. In this case, we're
@@ -20,7 +20,8 @@ import bpy
import json
import logging
import ifcopenshell
import blenderbim.bim.handler
from ... import import_ifc
from ... import handler as bim_handler
from .... import tool
from ...ifc import IfcStore
@@ -172,7 +173,7 @@ class ExecuteIfcDiff(bpy.types.Operator):
self.load_changed_elements(ifc_diff)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
def load_changed_elements(self, ifc_diff):
@@ -181,8 +182,8 @@ class ExecuteIfcDiff(bpy.types.Operator):
active_ifc = tool.Ifc.get()
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 = import_ifc.IfcImportSettings.factory(bpy.context, None, logger)
ifc_importer = import_ifc.IfcImporter(ifc_import_settings)
if self.props.active_file == "NEW":
tool.Ifc.set(ifc_diff.old)
@@ -19,7 +19,7 @@
from bpy.types import Panel
from ...ifc import IfcStore
from .data import DiffData
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
@@ -93,7 +93,7 @@ class BIM_PT_diff(Panel):
remove.collection = "diff_relationships"
remove.index = index
blenderbim.bim.helper.draw_filter(self.layout, props.filter_groups, DiffData, "diff")
bim_helper.draw_filter(self.layout, props.filter_groups, DiffData, "diff")
row = layout.row()
row.operator("bim.execute_ifc_diff")
@@ -35,18 +35,18 @@ import ifcopenshell.geom
import ifcopenshell.util.selector
import ifcopenshell.util.representation
import ifcopenshell.util.element
import blenderbim.bim.schema
import blenderbim.bim.helper
import blenderbim.bim.handler
from ... import schema as bim_schema
from ... import helper as bim_helper
from ... import handler as bim_handler
from .... import tool
import blenderbim.core.geometry
from ....core import geometry as core_geometry
from ....core import drawing as core
from . import svgwriter
from . import annotation
from . import sheeter
from . import scheduler
from . import helper
import blenderbim.bim.export_ifc
from ... import export_ifc as bim_export_ifc
from .decoration import CutDecorator
from .data import DecoratorData, DrawingsData
from typing import NamedTuple, List, Union, Optional, Literal
@@ -499,7 +499,7 @@ class CreateDrawing(bpy.types.Operator):
if self.sync and self.drawing_index == 0:
with profile("sync"):
# All very hackish whilst prototyping
exporter = blenderbim.bim.export_ifc.IfcExporter(None)
exporter = bim_export_ifc.IfcExporter(None)
exporter.file = tool.Ifc.get()
invalidated_elements = exporter.sync_all_objects()
invalidated_elements += exporter.sync_edited_objects()
@@ -1493,7 +1493,7 @@ class ActivateModel(bpy.types.Operator):
if model:
current_representation = tool.Geometry.get_active_representation(obj)
if current_representation != model:
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -1832,7 +1832,7 @@ class SaveDrawingStylesData(bpy.types.Operator, tool.Ifc.Operator):
ifcopenshell.api.run(
"pset.edit_pset", ifc_file, pset=pset, properties={"CurrentShadingStyle": new_style_name}
)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
@@ -1861,7 +1861,7 @@ class ActivateDrawingStyle(bpy.types.Operator, tool.Ifc.Operator):
ifcopenshell.api.run(
"pset.edit_pset", ifc_file, pset=pset, properties={"CurrentShadingStyle": self.drawing_style.name}
)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
def set_raster_style(self, context):
@@ -2227,7 +2227,7 @@ class EditTextPopup(bpy.types.Operator):
# skip BoxAlignment since we're going to format it ourselves
attributes = [a for a in literal_props.attributes if a.name != "BoxAlignment"]
blenderbim.bim.helper.draw_attributes(attributes, box, popup_active_attribute=attributes[0])
bim_helper.draw_attributes(attributes, box, popup_active_attribute=attributes[0])
row = box.row(align=True)
cols = [row.column(align=True) for i in range(3)]
@@ -2311,7 +2311,7 @@ class AddTextLiteral(bpy.types.Operator):
"Path": "RIGHT",
"BoxAlignment": "bottom_left",
}
# emulates `blenderbim.bim.helper.import_attributes2(ifc_literal, literal_props.attributes)`
# emulates `bim_helper.import_attributes2(ifc_literal, literal_props.attributes)`
for attr_name in literal_attr_values:
attr = literal_attributes.add()
attr.name = attr_name
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from bpy.types import Panel
from .data import (
@@ -119,7 +119,7 @@ class BIM_PT_element_filters(Panel):
props = context.scene.camera.data.BIMCameraProperties
if props.filter_mode == "INCLUDE":
blenderbim.bim.helper.draw_filter(
bim_helper.draw_filter(
self.layout, props.include_filter_groups, ElementFiltersData, "drawing_include"
)
row = self.layout.row(align=True)
@@ -128,7 +128,7 @@ class BIM_PT_element_filters(Panel):
).filter_mode = "INCLUDE"
row.operator("bim.enable_editing_element_filter", icon="CANCEL", text="").filter_mode = "NONE"
elif props.filter_mode == "EXCLUDE":
blenderbim.bim.helper.draw_filter(
bim_helper.draw_filter(
self.layout, props.exclude_filter_groups, ElementFiltersData, "drawing_exclude"
)
row = self.layout.row(align=True)
@@ -532,7 +532,7 @@ class BIM_PT_text(Panel):
# skip BoxAlignment since we're going to format it ourselves
attributes = [a for a in literal_props.attributes if a.name != "BoxAlignment"]
blenderbim.bim.helper.draw_attributes(attributes, box)
bim_helper.draw_attributes(attributes, box)
row = box.row(align=True)
cols = [row.column(align=True) for i in range(3)]
@@ -19,14 +19,14 @@
import os
import bpy
import blenderbim.core.type
from ....core import type as core_type
from .... import tool
from ...helper import prop_with_search
from bpy.types import WorkSpaceTool
from .data import DecoratorData, AnnotationData
from ...ifc import IfcStore
import blenderbim.bim.handler
from ... import handler as bim_handler
class LaunchAnnotationTypeManager(bpy.types.Operator):
@@ -171,7 +171,7 @@ def create_annotation_occurrence(context):
ifc_representation_class=tool.Drawing.get_ifc_representation_class(object_type),
)
blenderbim.core.type.assign_type(tool.Ifc, tool.Type, element=element, type=relating_type)
core_type.assign_type(tool.Ifc, tool.Type, element=element, type=relating_type)
tool.Ifc.run("group.assign_group", group=tool.Drawing.get_drawing_group(drawing), products=[element])
tool.Collector.assign(obj)
@@ -28,14 +28,14 @@ import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.util.placement
import ifcopenshell.api
import blenderbim.core.geometry
from ....core import geometry as core_geometry
from ....core import geometry as core
import blenderbim.core.aggregate
import blenderbim.core.style
import blenderbim.core.root
import blenderbim.core.drawing
from ....core import aggregate as core_aggregate
from ....core import style as core_style
from ....core import root as core_root
from ....core import drawing as core_drawing
from .... import tool
import blenderbim.bim.handler
from ... import handler as bim_handler
from mathutils import Vector, Matrix
from time import time
from ...ifc import IfcStore
@@ -89,7 +89,7 @@ class OverrideMeshSeparate(bpy.types.Operator, tool.Ifc.Operator):
if new_obj == obj:
continue
# This is not very efficient, it needlessly copies the representations first.
blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj)
core_root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj)
new_objs.append(new_obj)
for new_obj in new_objs:
bpy.ops.bim.update_representation(obj=new_obj.name)
@@ -874,7 +874,7 @@ class OverrideDuplicateMove(bpy.types.Operator):
# Prior to duplicating, sync the object placement to make decomposition recreation more stable.
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)
new_obj = obj.copy()
temp_data = None
@@ -897,7 +897,7 @@ class OverrideDuplicateMove(bpy.types.Operator):
# clear object's collection so it will be able to have it's own
new_obj.BIMObjectProperties.collection = None
# copy the actual class
new = blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj)
new = core_root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj)
# clean up the orphaned mesh with ifc id of the original object to avoid confusion
# IfcGridAxis keeps the same mesh data (it's pointing to ifc id 0, so it's not a problem)
@@ -934,7 +934,7 @@ class OverrideDuplicateMove(bpy.types.Operator):
# Recreate decompositions
tool.Root.recreate_decompositions(decomposition_relationships, old_to_new)
OverrideDuplicateMove.remove_linked_aggregate_data(old_to_new)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return old_to_new
@staticmethod
@@ -1200,7 +1200,7 @@ class DuplicateMoveLinkedAggregate(bpy.types.Operator):
if location_from_3d_cursor:
get_location_from_3d_cursor(old_to_new, selected_element)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return old_to_new
@@ -1430,7 +1430,7 @@ class RefreshLinkedAggregate(bpy.types.Operator):
new_aggregate = ifcopenshell.util.element.get_aggregate(new[0])
if not new_aggregate:
blenderbim.core.aggregate.assign_object(
core_aggregate.assign_object(
tool.Ifc,
tool.Aggregate,
tool.Collector,
@@ -1442,7 +1442,7 @@ class RefreshLinkedAggregate(bpy.types.Operator):
new_obj = tool.Ifc.get_object(new[0])
set_original_name(new_obj, original_names)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
operator_time = time() - refresh_start_time
if operator_time > 10:
@@ -1919,7 +1919,7 @@ def poll_editing_representaiton_item_style(cls, context):
if shape_aspect == "":
return True
from blenderbim.bim.module.material.data import ObjectMaterialData
from ..material.data import ObjectMaterialData
if not ObjectMaterialData.is_loaded:
ObjectMaterialData.load()
@@ -56,7 +56,7 @@ def get_mode(self, context):
def get_styles(self, context):
# postponed import to avoid circular import
from blenderbim.bim.module.material.data import MaterialsData
from ..material.data import MaterialsData
if not MaterialsData.is_loaded:
MaterialsData.load()
@@ -70,7 +70,7 @@ def get_shape_aspects(self, context):
def get_material_constituents(self, context, edit_text):
from blenderbim.bim.module.material.data import ObjectMaterialData
from ..material.data import ObjectMaterialData
if not ObjectMaterialData.is_loaded:
ObjectMaterialData.load()
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim
from .... import bim
from .... import tool
from bpy.types import Panel, Menu, UIList
from ...ifc import IfcStore
@@ -38,7 +38,7 @@ def mode_menu(self, context):
row = self.layout.row(align=True)
if context.scene.BIMGeometryProperties.mode == "EDIT":
row.operator("bim.override_mode_set_object", icon="CANCEL", text="Discard Changes").should_save = False
row.prop(context.scene.BIMGeometryProperties, "mode", text="", icon_value=blenderbim.bim.icons["IFC"].icon_id)
row.prop(context.scene.BIMGeometryProperties, "mode", text="", icon_value=bim.icons["IFC"].icon_id)
def object_menu(self, context):
@@ -69,7 +69,7 @@ class BIM_MT_hotkey_separate(Menu):
bl_label = "Separate"
def draw(self, context):
self.layout.label(text="IFC Separate", icon_value=blenderbim.bim.icons["IFC"].icon_id)
self.layout.label(text="IFC Separate", icon_value=bim.icons["IFC"].icon_id)
self.layout.operator("bim.override_mesh_separate", text="Selection").type = "SELECTED"
self.layout.operator("bim.override_mesh_separate", text="By Material").type = "MATERIAL"
self.layout.operator("bim.override_mesh_separate", text="By Loose Parts").type = "LOOSE"
@@ -19,7 +19,7 @@
import bpy
import ifcopenshell.util.attribute
import ifcopenshell.api
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from ...ifc import IfcStore
import json
@@ -152,7 +152,7 @@ class EnableEditingGroup(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
props = context.scene.BIMGroupProperties
props.group_attributes.clear()
blenderbim.bim.helper.import_attributes2(tool.Ifc.get().by_id(self.group), props.group_attributes)
bim_helper.import_attributes2(tool.Ifc.get().by_id(self.group), props.group_attributes)
props.active_group_id = self.group
return {"FINISHED"}
@@ -21,7 +21,7 @@ import json
import ifcopenshell.api
import ifcopenshell.util.element
import ifcopenshell.util.attribute
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from ...ifc import IfcStore
@@ -63,7 +63,7 @@ class EnableEditingLayer(bpy.types.Operator):
def execute(self, context):
props = context.scene.BIMLayerProperties
props.layer_attributes.clear()
blenderbim.bim.helper.import_attributes2(tool.Ifc.get().by_id(self.layer), props.layer_attributes)
bim_helper.import_attributes2(tool.Ifc.get().by_id(self.layer), props.layer_attributes)
props.active_layer_id = self.layer
return {"FINISHED"}
@@ -20,7 +20,7 @@ import bpy
import ifcopenshell.api
from .... import tool
from ....core import library as core
import blenderbim.bim.handler
from ... import handler as bim_handler
from ...ifc import IfcStore
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from bpy.types import Panel, UIList
from .data import LibrariesData, LibraryReferencesData
@@ -53,7 +53,7 @@ class BIM_PT_libraries(Panel):
row = self.layout.row(align=True)
row.operator("bim.edit_library", icon="CHECKMARK")
row.operator("bim.disable_editing_library", text="", icon="CANCEL")
blenderbim.bim.helper.draw_attributes(self.props.library_attributes, self.layout)
bim_helper.draw_attributes(self.props.library_attributes, self.layout)
def draw_editable_references_ui(self):
row = self.layout.row(align=True)
@@ -81,7 +81,7 @@ class BIM_PT_libraries(Panel):
row = self.layout.row(align=True)
row.operator("bim.edit_library_reference", icon="CHECKMARK")
row.operator("bim.disable_editing_library_reference", text="", icon="CANCEL")
blenderbim.bim.helper.draw_attributes(self.props.reference_attributes, self.layout)
bim_helper.draw_attributes(self.props.reference_attributes, self.layout)
def draw_readonly_library_ui(self):
row = self.layout.row()
@@ -22,9 +22,9 @@ import ifcopenshell.api
import ifcopenshell.util.element
import ifcopenshell.util.attribute
import ifcopenshell.util.representation
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
import blenderbim.core.style
from ....core import style as core_style
from ....core import material as core
from ..model import profile as model_profile
from .prop import purge as material_prop_purge
@@ -459,12 +459,12 @@ class EnableEditingAssignedMaterial(bpy.types.Operator):
props.material_set_attributes.clear()
if "Usage" in material.is_a():
blenderbim.bim.helper.import_attributes2(
bim_helper.import_attributes2(
material, props.material_set_usage_attributes, callback=self.import_attributes
)
blenderbim.bim.helper.import_attributes2(material[0], props.material_set_attributes)
bim_helper.import_attributes2(material[0], props.material_set_attributes)
else:
blenderbim.bim.helper.import_attributes2(material, props.material_set_attributes)
bim_helper.import_attributes2(material, props.material_set_attributes)
return {"FINISHED"}
def import_attributes(self, name, prop, data):
@@ -540,7 +540,7 @@ class EditAssignedMaterial(bpy.types.Operator, tool.Ifc.Operator):
return {"FINISHED"}
material_set = self.file.by_id(self.material_set)
attributes = blenderbim.bim.helper.export_attributes(props.material_set_attributes)
attributes = bim_helper.export_attributes(props.material_set_attributes)
ifcopenshell.api.run(
"material.edit_assigned_material",
self.file,
@@ -549,7 +549,7 @@ class EditAssignedMaterial(bpy.types.Operator, tool.Ifc.Operator):
if self.material_set_usage:
material_set_usage = self.file.by_id(self.material_set_usage)
attributes = blenderbim.bim.helper.export_attributes(props.material_set_usage_attributes)
attributes = bim_helper.export_attributes(props.material_set_usage_attributes)
if material_set_usage.is_a("IfcMaterialLayerSetUsage"):
ifcopenshell.api.run(
"material.edit_layer_usage",
@@ -581,7 +581,7 @@ class EnableEditingMaterialSetItemProfile(bpy.types.Operator):
self.props.active_material_set_item_id = self.material_set_item
self.props.material_set_item_profile_attributes.clear()
profile = tool.Ifc.get().by_id(self.material_set_item).Profile
blenderbim.bim.helper.import_attributes2(profile, self.props.material_set_item_profile_attributes)
bim_helper.import_attributes2(profile, self.props.material_set_item_profile_attributes)
return {"FINISHED"}
@@ -609,7 +609,7 @@ class EditMaterialSetItemProfile(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
obj = bpy.data.objects.get(self.obj) if self.obj else context.active_object
self.props = obj.BIMObjectMaterialProperties
attributes = blenderbim.bim.helper.export_attributes(self.props.material_set_item_profile_attributes)
attributes = bim_helper.export_attributes(self.props.material_set_item_profile_attributes)
profile = tool.Ifc.get().by_id(self.material_set_item).Profile
ifcopenshell.api.run("profile.edit_profile", tool.Ifc.get(), profile=profile, attributes=attributes)
self.props.active_material_set_item_id = 0
@@ -638,7 +638,7 @@ class EnableEditingMaterialSetItem(bpy.types.Operator):
self.props.material_set_item_material = str(material_set_item.Material.id())
self.props.material_set_item_attributes.clear()
blenderbim.bim.helper.import_attributes2(material_set_item, self.props.material_set_item_attributes)
bim_helper.import_attributes2(material_set_item, self.props.material_set_item_attributes)
if material_set_item.is_a("IfcMaterialProfile"):
if material_set_item.Profile and material_set_item.Profile.ProfileName:
@@ -675,7 +675,7 @@ class EditMaterialSetItem(bpy.types.Operator, tool.Ifc.Operator):
element = tool.Ifc.get_entity(obj)
material = ifcopenshell.util.element.get_material(element, should_skip_usage=True)
attributes = blenderbim.bim.helper.export_attributes(props.material_set_item_attributes)
attributes = bim_helper.export_attributes(props.material_set_item_attributes)
if material.is_a("IfcMaterialConstituentSet"):
ifcopenshell.api.run(
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
import bpy
from bpy.types import Panel, UIList
@@ -108,7 +108,7 @@ class BIM_PT_materials(Panel):
return
ifc_definition_id = self.props.active_material_id
if self.props.editing_material_type == "ATTRIBUTES":
blenderbim.bim.helper.draw_attributes(self.props.material_attributes, self.layout)
bim_helper.draw_attributes(self.props.material_attributes, self.layout)
row = self.layout.row(align=True)
row.operator("bim.edit_material", text="Save Material", icon="CHECKMARK").material = ifc_definition_id
row.operator("bim.disable_editing_material", text="", icon="CANCEL")
@@ -216,8 +216,8 @@ class BIM_PT_object_material(Panel):
self.draw_read_only_set_ui()
def draw_editable_set_ui(self):
blenderbim.bim.helper.draw_attributes(self.props.material_set_attributes, self.layout)
blenderbim.bim.helper.draw_attributes(self.props.material_set_usage_attributes, self.layout)
bim_helper.draw_attributes(self.props.material_set_attributes, self.layout)
bim_helper.draw_attributes(self.props.material_set_usage_attributes, self.layout)
if ObjectMaterialData.data["set_item_name"] == "profile" and not self.mprops.profiles:
row = self.layout.row(align=True)
@@ -19,11 +19,11 @@
import bpy
import numpy as np
import ifcopenshell
import blenderbim.bim.handler
from ... import handler as bim_handler
from .... import tool
from ....core import misc as core
from ....core import geometry as core_geometry
import blenderbim.core.root
from ....core import root as core_root
from ...ifc import IfcStore
from mathutils import Vector, Matrix, Euler
@@ -160,7 +160,7 @@ class SplitAlongEdge(bpy.types.Operator, tool.Ifc.Operator):
new_objs = tool.Misc.split_objects_with_cutter(objs_to_cut, cutter)
for obj in new_objs:
blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=obj)
core_root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=obj)
bpy.ops.bim.update_representation(obj=obj.name)
for obj in objs_to_cut:
bpy.ops.bim.update_representation(obj=obj.name)
@@ -27,9 +27,9 @@ import ifcopenshell.util.element
import ifcopenshell.util.representation
from ifcopenshell.util.shape_builder import V
from .... import tool
import blenderbim.core.geometry
from ....core import geometry as core_geometry
from ....core import geometry as core
import blenderbim.core.root
from ....core import root as core_root
from .window import create_bm_window, create_bm_box
from mathutils import Vector, Matrix
@@ -142,7 +142,7 @@ def update_door_modifier_representation(context: bpy.types.Context, obj: bpy.typ
previously_active_context.TargetView,
)
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -508,10 +508,10 @@ class BIM_OT_add_door(bpy.types.Operator, tool.Ifc.Operator):
obj = bpy.data.objects.new("IfcDoor", mesh)
obj.location = spawn_location
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc, tool.Collector, tool.Root, obj=obj, ifc_class="IfcDoor", should_add_representation=False
)
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)
if tool.Ifc.get_schema() != "IFC2X3":
element.PredefinedType = "DOOR"
@@ -573,7 +573,7 @@ class CancelEditingDoor(bpy.types.Operator, tool.Ifc.Operator):
props.set_props_kwargs_from_ifc_data(data)
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,
@@ -30,10 +30,10 @@ import ifcopenshell.util.element
import ifcopenshell.util.representation
import mathutils.geometry
import numpy as np
import blenderbim.bim.handler
import blenderbim.core.type
import blenderbim.core.root
import blenderbim.core.geometry
from ... import handler as bim_handler
from ....core import type as core_type
from ....core import root as core_root
from ....core import geometry as core_geometry
from .... import tool
from math import pi, degrees, radians, sin, cos, asin, tan
from copy import copy
@@ -529,7 +529,7 @@ class MEPGenerator:
obj = bpy.data.objects.new("Obstruction", None)
# TODO: OBSTRUCTION predefined type is available only for IfcDuctFitting and IfcPipeFitting
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -838,7 +838,7 @@ class MEPAddTransition(bpy.types.Operator, tool.Ifc.Operator):
else: # create new fitting type if nothing is compatible
mesh = bpy.data.meshes.new("Transition")
obj = bpy.data.objects.new("Transition", mesh)
transition_type = blenderbim.core.root.assign_class(
transition_type = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -1189,7 +1189,7 @@ class MEPAddBend(bpy.types.Operator, tool.Ifc.Operator):
else: # create new fitting type if nothing is compatible
mesh = bpy.data.meshes.new("Bend")
obj = bpy.data.objects.new("Bend", mesh)
bend_type = blenderbim.core.root.assign_class(
bend_type = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -33,9 +33,9 @@ import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.unit
from .... import tool
import blenderbim.core.geometry
from ....core import geometry as core_geometry
from ... import import_ifc
import blenderbim.bim.handler
from ... import handler as bim_handler
from ...ifc import IfcStore
from math import pi, radians
from mathutils import Vector, Matrix
@@ -126,7 +126,7 @@ class FilledOpeningGenerator:
bpy.context.view_layer.update()
if tool.Ifc.is_moved(voided_obj):
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=voided_obj)
core_geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=voided_obj)
existing_opening_occurrence = self.get_existing_opening_occurrence_if_any(filling)
@@ -178,7 +178,7 @@ class FilledOpeningGenerator:
context = tool.Geometry.get_active_representation_context(voided_obj)
representation = tool.Geometry.get_representation_by_context(voided_element, context)
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=voided_obj,
@@ -243,7 +243,7 @@ class FilledOpeningGenerator:
if not voided_obj.data:
continue
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,
@@ -384,11 +384,11 @@ class RecalculateFill(bpy.types.Operator, tool.Ifc.Operator):
for building_element in building_elements:
building_obj = tool.Ifc.get_object(building_element)
if tool.Ifc.is_moved(building_obj):
blenderbim.core.geometry.edit_object_placement(
core_geometry.edit_object_placement(
tool.Ifc, tool.Geometry, tool.Surveyor, obj=building_obj
)
for opening in openings:
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)
ifcopenshell.api.run(
"geometry.edit_object_placement", tool.Ifc.get(), product=opening, matrix=obj.matrix_world
)
@@ -403,7 +403,7 @@ class RecalculateFill(bpy.types.Operator, tool.Ifc.Operator):
if building_obj and building_obj.data:
representation = tool.Geometry.get_active_representation(building_obj)
if representation:
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=building_obj,
@@ -567,7 +567,7 @@ class AddBoolean(Operator, tool.Ifc.Operator):
tool.Model.mark_manual_booleans(element1, booleans)
tool.Model.clear_scene_openings()
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj1,
@@ -710,7 +710,7 @@ class RemoveBooleans(Operator, tool.Ifc.Operator, AddObjectHelper):
bbim_boolean_updates.setdefault(element, []).append(boolean_id)
body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
if body:
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=upstream_obj,
@@ -740,7 +740,7 @@ class ShowOpenings(Operator, tool.Ifc.Operator):
if not element or not getattr(element, "HasOpenings", None):
continue
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)
openings = tool.Model.load_openings(
[
r.RelatedOpeningElement
@@ -802,8 +802,8 @@ class EditOpenings(Operator, tool.Ifc.Operator):
opening_obj = tool.Ifc.get_object(opening)
building_objs.add(obj)
similar_openings = blenderbim.core.geometry.get_similar_openings(tool.Ifc, opening)
similar_openings_building_objs = blenderbim.core.geometry.get_similar_openings_building_objs(
similar_openings = core_geometry.get_similar_openings(tool.Ifc, opening)
similar_openings_building_objs = core_geometry.get_similar_openings_building_objs(
tool.Ifc, similar_openings
)
building_objs.update(similar_openings_building_objs)
@@ -811,14 +811,14 @@ class EditOpenings(Operator, tool.Ifc.Operator):
if opening_obj:
if tool.Ifc.is_edited(opening_obj):
tool.Geometry.run_geometry_update_representation(obj=opening_obj)
blenderbim.core.geometry.edit_similar_opening_placement(
core_geometry.edit_similar_opening_placement(
tool.Geometry, opening, similar_openings
)
elif tool.Ifc.is_moved(opening_obj):
blenderbim.core.geometry.edit_object_placement(
core_geometry.edit_object_placement(
tool.Ifc, tool.Geometry, tool.Surveyor, obj=opening_obj
)
blenderbim.core.geometry.edit_similar_opening_placement(
core_geometry.edit_similar_opening_placement(
tool.Geometry, opening, similar_openings
)
@@ -18,8 +18,8 @@
import bpy
from .... import tool
import blenderbim.core.spatial
import blenderbim.core.aggregate
from ....core import spatial as core_spatial
from ....core import aggregate as core_aggregate
from ...ifc import IfcStore
@@ -70,7 +70,7 @@ class PieUpdateContainer(bpy.types.Operator):
for collection in obj.users_collection:
spatial_obj = collection.BIMCollectionProperties.obj
if spatial_obj and spatial_obj.BIMObjectProperties.ifc_definition_id:
blenderbim.core.spatial.assign_container(
core_spatial.assign_container(
tool.Ifc, tool.Collector, tool.Spatial, structure_obj=spatial_obj, element_obj=obj
)
break
@@ -29,10 +29,10 @@ import ifcopenshell.util.representation
import ifcopenshell.util.type
import ifcopenshell.util.unit
from .... import tool
import blenderbim.core.aggregate
import blenderbim.core.type
import blenderbim.core.geometry
import blenderbim.core.spatial
from ....core import aggregate as core_aggregate
from ....core import type as core_type
from ....core import geometry as core_geometry
from ....core import spatial as core_spatial
from . import wall, slab, profile, mep
from ...ifc import IfcStore
from .data import AuthoringData
@@ -201,7 +201,7 @@ class AddConstrTypeInstance(bpy.types.Operator):
mesh_data = obj.data
element = tool.Ifc.get_entity(obj)
blenderbim.core.type.assign_type(tool.Ifc, tool.Type, element=element, type=relating_type)
core_type.assign_type(tool.Ifc, tool.Type, element=element, type=relating_type)
if obj.data != mesh_data: # remove orphaned mesh from "bim.assign_class"
tool.Blender.remove_data_block(mesh_data)
@@ -219,14 +219,14 @@ class AddConstrTypeInstance(bpy.types.Operator):
parent = ifcopenshell.util.element.get_aggregate(building_element)
if parent:
parent_obj = tool.Ifc.get_object(parent)
blenderbim.core.aggregate.assign_object(
core_aggregate.assign_object(
tool.Ifc, tool.Aggregate, tool.Collector, relating_obj=parent_obj, related_obj=obj
)
else:
parent = ifcopenshell.util.element.get_container(building_element)
if parent:
parent_obj = tool.Ifc.get_object(parent)
blenderbim.core.spatial.assign_container(
core_spatial.assign_container(
tool.Ifc, tool.Collector, tool.Spatial, structure_obj=parent_obj, element_obj=obj
)
@@ -467,7 +467,7 @@ def generate_box(usecase_path, ifc_file, settings):
old_box = ifcopenshell.util.representation.get_representation(product, "Model", "Box", "MODEL_VIEW")
if settings["context"].ContextType == "Model" and getattr(settings["context"], "ContextIdentifier") == "Body":
if old_box:
blenderbim.core.geometry.remove_representation(tool.Ifc, tool.Geometry, obj=obj, representation=old_box)
core_geometry.remove_representation(tool.Ifc, tool.Geometry, obj=obj, representation=old_box)
new_settings = settings.copy()
new_settings["context"] = box_context
@@ -501,7 +501,7 @@ def regenerate_profile_usage(usecase_path, ifc_file, settings):
continue
representation = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
if representation:
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -27,12 +27,12 @@ import ifcopenshell.util.unit
import ifcopenshell.util.element
import ifcopenshell.util.placement
import ifcopenshell.util.representation
import blenderbim.bim.handler
from ... import handler as bim_handler
from .... import tool
import blenderbim.core.type
import blenderbim.core.geometry
import blenderbim.core.material
import blenderbim.core.root
from ....core import type as core_type
from ....core import geometry as core_geometry
from ....core import material as core_material
from ....core import root as core_root
from math import pi, degrees, inf
from mathutils import Vector, Matrix, Quaternion
from ..geometry.helper import Helper
@@ -88,7 +88,7 @@ class DumbProfileGenerator:
if self.container_obj:
matrix_world.translation.z = self.container_obj.location.z
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -103,7 +103,7 @@ class DumbProfileGenerator:
obj.matrix_world = matrix_world
bpy.context.view_layer.update()
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)
if self.axis_context:
representation = ifcopenshell.api.run(
@@ -127,7 +127,7 @@ class DumbProfileGenerator:
ifcopenshell.api.run(
"geometry.assign_representation", tool.Ifc.get(), product=element, representation=representation
)
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -452,7 +452,7 @@ class DumbProfileJoiner:
if old_axis:
for inverse in tool.Ifc.get().get_inverse(old_axis):
ifcopenshell.util.element.replace_attribute(inverse, old_axis, new_axis)
blenderbim.core.geometry.remove_representation(
core_geometry.remove_representation(
tool.Ifc, tool.Geometry, obj=obj, representation=old_axis
)
else:
@@ -488,7 +488,7 @@ class DumbProfileJoiner:
ifcopenshell.util.element.replace_attribute(inverse, old_body, new_body)
obj.data.BIMMeshProperties.ifc_definition_id = int(new_body.id())
obj.data.name = f"{self.body_context.id()}/{new_body.id()}"
blenderbim.core.geometry.remove_representation(tool.Ifc, tool.Geometry, obj=obj, representation=old_body)
core_geometry.remove_representation(tool.Ifc, tool.Geometry, obj=obj, representation=old_body)
else:
ifcopenshell.api.run(
"geometry.assign_representation", tool.Ifc.get(), product=element, representation=new_body
@@ -512,8 +512,8 @@ class DumbProfileJoiner:
else:
coordinates[2] -= change_in_z
opening.ObjectPlacement.RelativePlacement.Location.Coordinates = coordinates
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
blenderbim.core.geometry.switch_representation(
core_geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -525,7 +525,7 @@ class DumbProfileJoiner:
tool.Geometry.record_object_materials(obj)
if element.is_a("IfcFlowSegment") or element.is_a("IfcFlowFitting"):
# lazy import to avoid circular import errors
from blenderbim.bim.module.model.mep import MEPGenerator
from .mep import MEPGenerator
MEPGenerator().setup_ports(obj)
@@ -931,7 +931,7 @@ class PatchNonParametricMepSegment(bpy.types.Operator, tool.Ifc.Operator):
return context.active_object
def _execute(self, context):
blenderbim.core.material.patch_non_parametric_mep_segment(
core_material.patch_non_parametric_mep_segment(
tool.Ifc, tool.Material, tool.Profile, obj=context.active_object
)
bpy.ops.bim.enable_editing_extrusion_axis()
@@ -984,7 +984,7 @@ def disable_editing_extrusion_axis(context):
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,
@@ -1048,7 +1048,7 @@ class EditExtrusionAxis(bpy.types.Operator, tool.Ifc.Operator):
matrix.translation = start
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,
@@ -24,8 +24,8 @@ import ifcopenshell.api
import ifcopenshell.util.representation
import ifcopenshell.util.unit
from ifcopenshell.util.shape_builder import V
import blenderbim.core.root
import blenderbim.core.geometry
from ....core import root as core_root
from ....core import geometry as core_geometry
from .... import tool
from .door import bm_sort_out_geom
from .data import RailingData, refresh
@@ -300,7 +300,7 @@ class BIM_OT_add_railing(bpy.types.Operator, tool.Ifc.Operator):
obj.location = spawn_location
body_context = ifcopenshell.util.representation.get_context(ifc_file, "Model", "Body", "MODEL_VIEW")
blenderbim.core.root.assign_class(
core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -476,7 +476,7 @@ def cancel_editing_railing_path(context):
else:
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,
@@ -23,7 +23,7 @@ import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.representation
import ifcopenshell.util.unit
import blenderbim.core.root
from ....core import root as core_root
from .... import tool
from ...helper import convert_property_group_from_si
from .door import bm_sort_out_geom
@@ -516,7 +516,7 @@ class BIM_OT_add_roof(bpy.types.Operator, tool.Ifc.Operator):
obj.location = spawn_location
body_context = ifcopenshell.util.representation.get_context(ifc_file, "Model", "Body", "MODEL_VIEW")
blenderbim.core.root.assign_class(
core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -18,7 +18,7 @@
import bpy
import ifcopenshell.file
import blenderbim.bim.handler
from ... import handler as bim_handler
from .... import tool
from ...ifc import IFC_CONNECTED_TYPE
from typing import Any
@@ -47,4 +47,4 @@ def sync_name(usecase_path: str, ifc_file: ifcopenshell.file, settings: dict[str
elif isinstance(obj, bpy.types.Material):
new_name = settings["attributes"]["Name"] or "Unnamed"
obj.name = new_name
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
@@ -26,10 +26,10 @@ import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.unit
import ifcopenshell.util.type
import blenderbim.bim.handler
import blenderbim.core.type
import blenderbim.core.geometry
import blenderbim.core.root
from ... import handler as bim_handler
from ....core import type as core_type
from ....core import geometry as core_geometry
from ....core import root as core_root
from .... import tool
from mathutils import Vector, Matrix
from ..geometry.helper import Helper
@@ -169,7 +169,7 @@ class DumbSlabGenerator:
obj.matrix_world = Matrix.Rotation(self.x_angle, 4, "X") @ matrix_world
bpy.context.view_layer.update()
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -179,7 +179,7 @@ class DumbSlabGenerator:
)
ifcopenshell.api.run("type.assign_type", self.file, related_objects=[element], relating_type=self.relating_type)
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)
representation = ifcopenshell.api.run(
"geometry.add_slab_representation",
tool.Ifc.get(),
@@ -191,7 +191,7 @@ class DumbSlabGenerator:
"geometry.assign_representation", tool.Ifc.get(), product=element, representation=representation
)
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -308,7 +308,7 @@ class DumbSlabPlaner:
)
for inverse in tool.Ifc.get().get_inverse(representation):
ifcopenshell.util.element.replace_attribute(inverse, representation, new_rep)
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -317,7 +317,7 @@ class DumbSlabPlaner:
is_global=True,
should_sync_changes_first=False,
)
blenderbim.core.geometry.remove_representation(
core_geometry.remove_representation(
tool.Ifc, tool.Geometry, obj=obj, representation=representation
)
return
@@ -335,7 +335,7 @@ class DumbSlabPlaner:
"geometry.assign_representation", tool.Ifc.get(), product=element, representation=representation
)
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -540,7 +540,7 @@ class EditSketchExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator):
bpy.ops.view3d.slvs_delete_entity(index=p1["slvs_index"])
bpy.ops.view3d.slvs_delete_entity(index=nm["slvs_index"])
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -585,7 +585,7 @@ def disable_editing_extrusion_profile(context):
body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
profile_mesh = obj.data
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -686,7 +686,7 @@ class EditExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator):
ifcopenshell.util.element.remove_deep2(tool.Ifc.get(), old_profile)
profile_mesh = obj.data
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -717,7 +717,7 @@ class EditExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator):
if old_footprint:
for inverse in tool.Ifc.get().get_inverse(old_footprint):
ifcopenshell.util.element.replace_attribute(inverse, old_footprint, new_footprint)
blenderbim.core.geometry.remove_representation(
core_geometry.remove_representation(
tool.Ifc, tool.Geometry, obj=obj, representation=old_footprint
)
else:
@@ -23,7 +23,7 @@ import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.representation
import ifcopenshell.util.unit
import blenderbim.core.root
from ....core import root as core_root
from .... import tool
from mathutils import Vector
from bmesh.types import BMVert
@@ -218,7 +218,7 @@ class BIM_OT_add_clever_stair(bpy.types.Operator, tool.Ifc.Operator):
obj = bpy.data.objects.new("StairFlight", mesh)
obj.location = spawn_location
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim
from .... import bim
from .... import tool
from bpy.types import Panel, Menu
from .data import (
@@ -664,10 +664,10 @@ def add_menu(self, context):
def add_mesh_object_menu(self, context):
self.layout.separator()
self.layout.operator("mesh.add_grid", icon_value=blenderbim.bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_stair", icon_value=blenderbim.bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_clever_stair", icon_value=blenderbim.bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_window", icon_value=blenderbim.bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_door", icon_value=blenderbim.bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_railing", icon_value=blenderbim.bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_roof", icon_value=blenderbim.bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_grid", icon_value=bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_stair", icon_value=bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_clever_stair", icon_value=bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_window", icon_value=bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_door", icon_value=bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_railing", icon_value=bim.icons["IFC"].icon_id)
self.layout.operator("mesh.add_roof", icon_value=bim.icons["IFC"].icon_id)
@@ -28,10 +28,10 @@ import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.type
import mathutils.geometry
import blenderbim.bim.handler
import blenderbim.core.type
import blenderbim.core.root
import blenderbim.core.geometry
from ... import handler as bim_handler
from ....core import type as core_type
from ....core import root as core_root
from ....core import geometry as core_geometry
from ....core import model as core
from .... import tool
from ...ifc import IfcStore
@@ -227,7 +227,7 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator):
if tool.Model.get_usage_type(element) == "LAYER2":
layer2_objs.append(obj)
else:
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -554,7 +554,7 @@ class DumbWallGenerator:
obj.matrix_world = matrix_world
bpy.context.view_layer.update()
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -573,7 +573,7 @@ class DumbWallGenerator:
ifcopenshell.api.run(
"geometry.assign_representation", tool.Ifc.get(), product=element, representation=representation
)
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)
representation = ifcopenshell.api.run(
"geometry.add_wall_representation",
tool.Ifc.get(),
@@ -587,7 +587,7 @@ class DumbWallGenerator:
ifcopenshell.api.run(
"geometry.assign_representation", tool.Ifc.get(), product=element, representation=representation
)
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -791,7 +791,7 @@ class DumbWallJoiner:
def flip(self, wall1):
if tool.Ifc.is_moved(wall1):
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=wall1)
core_geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=wall1)
element1 = tool.Ifc.get_entity(wall1)
if not element1 or tool.Model.get_usage_type(element1) != "LAYER2":
@@ -865,7 +865,7 @@ class DumbWallJoiner:
bpy.context.view_layer.update()
body = ifcopenshell.util.representation.get_representation(element1, "Model", "Body", "MODEL_VIEW")
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=wall1,
@@ -938,7 +938,7 @@ class DumbWallJoiner:
wall2.data = wall2.data.copy()
for collection in wall1.users_collection:
collection.objects.link(wall2)
blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=wall2)
core_root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=wall2)
return wall2
def join_Z(self, wall1, slab2):
@@ -1131,7 +1131,7 @@ class DumbWallJoiner:
if old_axis:
for inverse in tool.Ifc.get().get_inverse(old_axis):
ifcopenshell.util.element.replace_attribute(inverse, old_axis, new_axis)
blenderbim.core.geometry.remove_representation(
core_geometry.remove_representation(
tool.Ifc, tool.Geometry, obj=obj, representation=old_axis
)
else:
@@ -1158,7 +1158,7 @@ class DumbWallJoiner:
ifcopenshell.util.element.replace_attribute(inverse, old_body, new_body)
obj.data.BIMMeshProperties.ifc_definition_id = int(new_body.id())
obj.data.name = f"{self.body_context.id()}/{new_body.id()}"
blenderbim.core.geometry.remove_representation(tool.Ifc, tool.Geometry, obj=obj, representation=old_body)
core_geometry.remove_representation(tool.Ifc, tool.Geometry, obj=obj, representation=old_body)
else:
ifcopenshell.api.run(
"geometry.assign_representation", tool.Ifc.get(), product=element, representation=new_body
@@ -1184,23 +1184,23 @@ class DumbWallJoiner:
coordinates[0] -= change_in_x
opening.ObjectPlacement.RelativePlacement.Location.Coordinates = coordinates
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)
# If opening has filling then stick to the filling's position
# We're applying new openings position only after wall position is applied
for opening in [r.RelatedOpeningElement for r in element.HasOpenings if r.RelatedOpeningElement.HasFillings]:
similar_openings = blenderbim.core.geometry.get_similar_openings(tool.Ifc, opening)
similar_openings = core_geometry.get_similar_openings(tool.Ifc, opening)
filling_obj = tool.Ifc.get_object(opening.HasFillings[0].RelatedBuildingElement)
filling_moved = tool.Ifc.is_moved(filling_obj)
if filling_moved:
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=filling_obj)
core_geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=filling_obj)
if filling_moved or wall_moved:
ifcopenshell.api.run(
"geometry.edit_object_placement", tool.Ifc.get(), product=opening, matrix=filling_obj.matrix_world
)
blenderbim.core.geometry.edit_similar_opening_placement(tool.Geometry, opening, similar_openings)
core_geometry.edit_similar_opening_placement(tool.Geometry, opening, similar_openings)
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -23,8 +23,8 @@ import bmesh
import collections
import ifcopenshell
from .... import tool
import blenderbim.core.root
import blenderbim.core.geometry
from ....core import root as core_root
from ....core import geometry as core_geometry
from ifcopenshell.api.geometry.add_window_representation import DEFAULT_PANEL_SCHEMAS
import ifcopenshell.api
import ifcopenshell.util.element
@@ -105,7 +105,7 @@ def update_window_modifier_representation(context, obj):
previously_active_context.ContextIdentifier,
previously_active_context.TargetView,
)
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -403,10 +403,10 @@ class BIM_OT_add_window(bpy.types.Operator, tool.Ifc.Operator):
obj = bpy.data.objects.new("IfcWindow", mesh)
obj.location = spawn_location
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc, tool.Collector, tool.Root, obj=obj, ifc_class="IfcWindow", should_add_representation=False
)
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)
if tool.Ifc.get_schema() != "IFC2X3":
element.PredefinedType = "WINDOW"
@@ -465,7 +465,7 @@ class CancelEditingWindow(bpy.types.Operator, tool.Ifc.Operator):
props.set_props_kwargs_from_ifc_data(data)
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,
@@ -21,8 +21,8 @@ import ifcopenshell
import ifcopenshell.util.element
from .... import tool
from ....core import nest as core
import blenderbim.core.spatial
import blenderbim.bim.handler
from ....core import spatial as core_spatial
from ... import handler as bim_handler
from ...ifc import IfcStore
@@ -19,7 +19,7 @@
import bpy
from .... import tool
from ....core import owner as core
import blenderbim.bim.handler
from ... import handler as bim_handler
from ...ifc import IfcStore
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from .data import PeopleData, OrganisationsData, OwnerData, ActorData, ObjectActorData
@@ -33,7 +33,7 @@ def draw_roles(box, parent):
row = box.row(align=True)
row.operator("bim.edit_role", icon="CHECKMARK")
row.operator("bim.disable_editing_role", icon="CANCEL", text="")
blenderbim.bim.helper.draw_attributes(role["props"], box)
bim_helper.draw_attributes(role["props"], box)
else:
row = box.row(align=True)
row.label(text=role["label"])
@@ -56,7 +56,7 @@ def draw_addresses(box, parent):
row = box.row(align=True)
row.operator("bim.edit_address", icon="CHECKMARK")
row.operator("bim.disable_editing_address", icon="CANCEL", text="")
blenderbim.bim.helper.draw_attributes(address["props"], box)
bim_helper.draw_attributes(address["props"], box)
for attribute in address["list_attributes"]:
row = box.row(align=True)
row.label(text=attribute["name"])
@@ -108,7 +108,7 @@ class BIM_PT_people(bpy.types.Panel):
row = box.row(align=True)
row.operator("bim.edit_person", icon="CHECKMARK")
row.operator("bim.disable_editing_person", icon="CANCEL", text="")
blenderbim.bim.helper.draw_attributes(person["props"], box)
bim_helper.draw_attributes(person["props"], box)
for attribute in person["list_attributes"]:
row = box.row(align=True)
@@ -167,7 +167,7 @@ class BIM_PT_organisations(bpy.types.Panel):
row = box.row(align=True)
row.operator("bim.edit_organisation", icon="CHECKMARK")
row.operator("bim.disable_editing_organisation", icon="CANCEL", text="")
blenderbim.bim.helper.draw_attributes(organisation["props"], box)
bim_helper.draw_attributes(organisation["props"], box)
draw_roles(box, organisation)
draw_addresses(box, organisation)
@@ -274,7 +274,7 @@ class BIM_PT_actor(bpy.types.Panel):
row = box.row(align=True)
row.operator("bim.edit_actor", icon="CHECKMARK")
row.operator("bim.disable_editing_actor", icon="CANCEL", text="")
blenderbim.bim.helper.draw_attributes(self.props.actor_attributes, box)
bim_helper.draw_attributes(self.props.actor_attributes, box)
else:
row = self.layout.row(align=True)
row.label(text=actor["name"], icon="USER")
@@ -22,7 +22,7 @@ import json
import ifcopenshell
from .... import tool
from ....core import patch as core
import blenderbim.bim.handler
from ... import handler as bim_handler
from pathlib import Path
try:
@@ -159,5 +159,5 @@ class RunMigratePatch(bpy.types.Operator):
bpy.ops.file.refresh()
except:
pass # Probably running in headless mode
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
@@ -18,7 +18,7 @@
import bpy
import ifcopenshell.api
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from ..model import profile as model_profile
from ....core import profile as core
@@ -85,7 +85,7 @@ class EnableEditingProfile(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
props = context.scene.BIMProfileProperties
props.profile_attributes.clear()
blenderbim.bim.helper.import_attributes2(tool.Ifc.get().by_id(self.profile), props.profile_attributes)
bim_helper.import_attributes2(tool.Ifc.get().by_id(self.profile), props.profile_attributes)
props.active_profile_id = self.profile
@@ -107,7 +107,7 @@ class EditProfile(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
props = context.scene.BIMProfileProperties
attributes = blenderbim.bim.helper.export_attributes(props.profile_attributes)
attributes = bim_helper.export_attributes(props.profile_attributes)
profile = tool.Ifc.get().by_id(props.active_profile_id)
ifcopenshell.api.run("profile.edit_profile", tool.Ifc.get(), profile=profile, attributes=attributes)
model_profile.DumbProfileRegenerator().regenerate_from_profile_def(profile)
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from bpy.types import Panel, UIList
from .data import ProfileData
@@ -102,7 +102,7 @@ class BIM_PT_profiles(Panel):
self.draw_editable_ui(context)
def draw_editable_ui(self, context):
blenderbim.bim.helper.draw_attributes(self.props.profile_attributes, self.layout)
bim_helper.draw_attributes(self.props.profile_attributes, self.layout)
class BIM_UL_profiles(UIList):
@@ -37,13 +37,13 @@ import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.util.shape
import ifcopenshell.util.unit
import blenderbim.bim.handler
import blenderbim.bim.schema
from ... import handler as bim_handler
from ... import schema as bim_schema
from .... import tool
from ....core import project as core
import blenderbim.core.context
import blenderbim.core.owner
import blenderbim.core.spatial
from ....core import context as core_context
from ....core import owner as core_owner
from ....core import spatial as core_spatial
from ...ifc import IfcStore
from ...ui import IFCFileSelector
from ....bim import import_ifc
@@ -132,7 +132,7 @@ class CreateProject(bpy.types.Operator):
for mat in bpy.data.materials:
bpy.data.materials.remove(mat)
core.create_project(tool.Ifc, tool.Georeference, tool.Project, tool.Spatial, schema=props.export_schema, template=template)
blenderbim.bim.schema.reload(tool.Ifc.get().schema_identifier)
bim_schema.reload(tool.Ifc.get().schema_identifier)
tool.Blender.register_toolbar()
def rollback(self, data):
@@ -469,7 +469,7 @@ class AppendLibraryElement(bpy.types.Operator):
except:
# TODO Remove this terrible code when I refactor this into the core
pass
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
def import_material_from_ifc(self, element: ifcopenshell.entity_instance, context: bpy.types.Context) -> None:
@@ -795,7 +795,7 @@ class LoadProjectElements(bpy.types.Operator):
def execute(self, context):
self.props = context.scene.BIMProjectProperties
self.file = IfcStore.get_file()
blenderbim.bim.schema.reload(self.file.schema_identifier)
bim_schema.reload(self.file.schema_identifier)
start = time.time()
logger = logging.getLogger("ImportIFC")
path_log = os.path.join(context.scene.BIMProperties.data_dir, "process.log")
@@ -1315,7 +1315,7 @@ class ExportIFCBase:
if save_blend_file:
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
bpy.context.scene.BIMProperties.is_dirty = False
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
self.report(
{"INFO"},
f'IFC Project "{os.path.basename(output_file)}" {"" if not save_blend_file else "And Current Blend File Are"} Saved',
@@ -1860,7 +1860,7 @@ class AppendInspectedLinkedElement(AppendLibraryElement):
bl_options = {"REGISTER"}
def _execute(self, context):
from blenderbim.bim.module.project.data import LinksData
from .data import LinksData
if not LinksData.linked_data:
self.report({"INFO"}, "No linked element found.")
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import os
import blenderbim.bim
from .... import bim
from .... import tool
from ...helper import prop_with_search
from bpy.types import Panel, Menu, UIList
@@ -49,7 +49,7 @@ class BIM_MT_recent_projects(Menu):
for path in paths:
op = self.layout.operator(
"bim.load_project", text=path.name, icon_value=blenderbim.bim.icons["IFC"].icon_id
"bim.load_project", text=path.name, icon_value=bim.icons["IFC"].icon_id
)
op.filepath = str(path)
op.should_start_fresh_session = True
@@ -71,7 +71,7 @@ class BIM_MT_new_project(Menu):
# Do we need to set it back to exec default?
# self.layout.operator_context = "EXEC_DEFAULT"
self.layout.separator()
self.layout.label(text="New IFC Project", icon_value=blenderbim.bim.icons["IFC"].icon_id)
self.layout.label(text="New IFC Project", icon_value=bim.icons["IFC"].icon_id)
self.layout.operator("bim.new_project", text="Metric (m) Project").preset = "metric_m"
self.layout.operator("bim.new_project", text="Metric (mm) Project").preset = "metric_mm"
self.layout.operator("bim.new_project", text="Imperial (ft) Project").preset = "imperial_ft"
@@ -21,7 +21,7 @@ import ifcopenshell
import ifcopenshell.util.doc
import ifcopenshell.util.element
from .... import tool
import blenderbim.bim.schema
from ... import schema as bim_schema
# TODO: Should this cache belong here? Dunno. Maybe.
@@ -106,7 +106,7 @@ class ObjectPsetsData(Data):
element = tool.Ifc.get_entity(obj)
if not element:
return []
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(
psets = bim_schema.ifc.psetqto.get_applicable(
element.is_a(), ifcopenshell.util.element.get_predefined_type(element), pset_only=True
)
psetnames = cls.format_pset_enum(psets)
@@ -119,7 +119,7 @@ class ObjectPsetsData(Data):
element = tool.Ifc.get_entity(obj)
if not element:
return []
qtos = blenderbim.bim.schema.ifc.psetqto.get_applicable(
qtos = bim_schema.ifc.psetqto.get_applicable(
element.is_a(), ifcopenshell.util.element.get_predefined_type(element), qto_only=True
)
return cls.format_pset_enum(qtos)
@@ -178,7 +178,7 @@ class MaterialPsetsData(Data):
if material.ifc_definition_id:
material = tool.Ifc.get().by_id(material.ifc_definition_id)
category = getattr(material, "Category", None) or None
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable("IfcMaterial", category, pset_only=True)
psets = bim_schema.ifc.psetqto.get_applicable("IfcMaterial", category, pset_only=True)
psetnames = cls.format_pset_enum(psets)
assigned_names = ifcopenshell.util.element.get_psets(
material, psets_only=True, should_inherit=False
@@ -22,12 +22,12 @@ import ifcopenshell.api
import ifcopenshell.util.unit
import ifcopenshell.util.pset
import ifcopenshell.util.attribute
import blenderbim.bim.schema
import blenderbim.bim.helper
import blenderbim.bim.handler
from ... import schema as bim_schema
from ... import helper as bim_helper
from ... import handler as bim_handler
from .... import tool
from ....core import pset as core
import blenderbim.bim.module.pset.data
from . import data as bim_module_pset_data
from ...ifc import IfcStore
@@ -37,8 +37,8 @@ class TogglePsetExpansion(bpy.types.Operator, tool.Ifc.Operator):
pset_id: bpy.props.IntProperty()
def _execute(self, context):
blenderbim.bim.module.pset.data.is_expanded[self.pset_id] = (
not blenderbim.bim.module.pset.data.is_expanded.setdefault(self.pset_id, True)
bim_module_pset_data.is_expanded[self.pset_id] = (
not bim_module_pset_data.is_expanded.setdefault(self.pset_id, True)
)
@@ -129,7 +129,7 @@ class EditPset(bpy.types.Operator, tool.Ifc.Operator):
pset=pset,
name=props.active_pset_name,
properties=properties,
pset_template=blenderbim.bim.schema.ifc.psetqto.get_by_name(props.active_pset_name),
pset_template=bim_schema.ifc.psetqto.get_by_name(props.active_pset_name),
)
else:
for key, value in properties.items():
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.schema
from ... import schema as bim_schema
import ifcopenshell
import ifcopenshell.util.attribute
import ifcopenshell.util.doc
@@ -105,7 +105,7 @@ def get_material_set_pset_names(self, context):
return []
ifc_class = material.is_a()
if ifc_class not in psetnames:
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psets = bim_schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psetnames[ifc_class] = blender_formatted_enum_from_psets(psets)
return psetnames[ifc_class]
@@ -117,7 +117,7 @@ def get_material_set_item_pset_names(self, context):
return []
ifc_class = tool.Ifc.get().by_id(ifc_definition_id).is_a()
if ifc_class not in psetnames:
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psets = bim_schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psetnames[ifc_class] = blender_formatted_enum_from_psets(psets)
return psetnames[ifc_class]
@@ -126,7 +126,7 @@ def get_task_qto_names(self, context):
global qtonames
ifc_class = "IfcTask"
if ifc_class not in qtonames:
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, qto_only=True)
psets = bim_schema.ifc.psetqto.get_applicable(ifc_class, qto_only=True)
qtonames[ifc_class] = blender_formatted_enum_from_psets(psets)
return qtonames[ifc_class]
@@ -137,7 +137,7 @@ def get_resource_pset_names(self, context):
rtprops = context.scene.BIMResourceTreeProperties
ifc_class = IfcStore.get_file().by_id(rtprops.resources[rprops.active_resource_index].ifc_definition_id).is_a()
if ifc_class not in psetnames:
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psets = bim_schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psetnames[ifc_class] = blender_formatted_enum_from_psets(psets)
return psetnames[ifc_class]
@@ -148,7 +148,7 @@ def get_resource_qto_names(self, context):
rtprops = context.scene.BIMResourceTreeProperties
ifc_class = IfcStore.get_file().by_id(rtprops.resources[rprops.active_resource_index].ifc_definition_id).is_a()
if ifc_class not in qtonames:
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, qto_only=True)
psets = bim_schema.ifc.psetqto.get_applicable(ifc_class, qto_only=True)
qtonames[ifc_class] = blender_formatted_enum_from_psets(psets)
return qtonames[ifc_class]
@@ -157,7 +157,7 @@ def get_group_pset_names(self, context):
global psetnames
ifc_class = "IfcGroup"
if ifc_class not in psetnames:
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psets = bim_schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psetnames[ifc_class] = blender_formatted_enum_from_psets(psets)
return psetnames[ifc_class]
@@ -166,7 +166,7 @@ def get_group_qto_names(self, context):
global qtonames
ifc_class = "IfcGroup"
if ifc_class not in qtonames:
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, qto_only=True)
psets = bim_schema.ifc.psetqto.get_applicable(ifc_class, qto_only=True)
qtonames[ifc_class] = blender_formatted_enum_from_psets(psets)
return qtonames[ifc_class]
@@ -175,7 +175,7 @@ def get_profile_pset_names(self, context):
pprops = context.scene.BIMProfileProperties
ifc_class = IfcStore.get_file().by_id(pprops.profiles[pprops.active_profile_index].ifc_definition_id).is_a()
if ifc_class not in psetnames:
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psets = bim_schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psetnames[ifc_class] = blender_formatted_enum_from_psets(psets)
return psetnames[ifc_class]
@@ -184,7 +184,7 @@ def get_work_schedule_pset_names(self, context):
global psetnames
ifc_class = "IfcWorkSchedule"
if ifc_class not in psetnames:
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psets = bim_schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
psetnames[ifc_class] = blender_formatted_enum_from_psets(psets)
return psetnames[ifc_class]
@@ -20,8 +20,8 @@ import os
import bpy
import ifcopenshell
import ifcopenshell.api
import blenderbim.bim.schema
import blenderbim.bim.handler
from ... import schema as bim_schema
from ... import handler as bim_handler
from .... import tool
from ...ifc import IfcStore
from typing import final
@@ -38,7 +38,7 @@ class PsetTemplateOperator:
IfcStore.pset_template_file.end_transaction()
IfcStore.add_transaction_operation(self)
IfcStore.end_transaction(self)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
def rollback(self, data):
@@ -71,8 +71,8 @@ class AddPsetTemplateFile(bpy.types.Operator):
ifcopenshell.api.run("pset_template.add_prop_template", template, pset_template=pset_template)
template.write(filepath)
self.props.new_template_filename = ""
blenderbim.bim.handler.refresh_ui_data()
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
bim_handler.refresh_ui_data()
bim_schema.reload(tool.Ifc.get().schema)
context.scene.BIMPsetTemplateProperties.pset_template_files = filepath
return {"FINISHED"}
@@ -86,8 +86,8 @@ class AddPsetTemplate(bpy.types.Operator, PsetTemplateOperator):
template = ifcopenshell.api.run("pset_template.add_pset_template", IfcStore.pset_template_file)
ifcopenshell.api.run("pset_template.add_prop_template", IfcStore.pset_template_file, pset_template=template)
IfcStore.pset_template_file.write(IfcStore.pset_template_path)
blenderbim.bim.handler.refresh_ui_data()
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
bim_handler.refresh_ui_data()
bim_schema.reload(tool.Ifc.get().schema)
context.scene.BIMPsetTemplateProperties.pset_templates = str(template.id())
@@ -106,8 +106,8 @@ class RemovePsetTemplate(bpy.types.Operator, PsetTemplateOperator):
**{"pset_template": IfcStore.pset_template_file.by_id(int(props.pset_templates))}
)
IfcStore.pset_template_file.write(IfcStore.pset_template_path)
blenderbim.bim.handler.refresh_ui_data()
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
bim_handler.refresh_ui_data()
bim_schema.reload(tool.Ifc.get().schema)
class EnableEditingPsetTemplate(bpy.types.Operator):
@@ -220,8 +220,8 @@ class EditPsetTemplate(bpy.types.Operator, PsetTemplateOperator):
)
bpy.ops.bim.disable_editing_pset_template()
IfcStore.pset_template_file.write(IfcStore.pset_template_path)
blenderbim.bim.handler.refresh_ui_data()
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
bim_handler.refresh_ui_data()
bim_schema.reload(tool.Ifc.get().schema)
class SavePsetTemplateFile(bpy.types.Operator):
@@ -230,8 +230,8 @@ class SavePsetTemplateFile(bpy.types.Operator):
def execute(self, context):
IfcStore.pset_template_file.write(IfcStore.pset_template_path)
blenderbim.bim.handler.refresh_ui_data()
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
bim_handler.refresh_ui_data()
bim_schema.reload(tool.Ifc.get().schema)
return {"FINISHED"}
@@ -244,8 +244,8 @@ class RemovePsetTemplateFile(bpy.types.Operator):
os.remove(IfcStore.pset_template_path)
except:
pass
blenderbim.bim.handler.refresh_ui_data()
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
bim_handler.refresh_ui_data()
bim_schema.reload(tool.Ifc.get().schema)
return {"FINISHED"}
@@ -264,8 +264,8 @@ class AddPropTemplate(bpy.types.Operator, PsetTemplateOperator):
)
bpy.ops.bim.disable_editing_prop_template()
IfcStore.pset_template_file.write(IfcStore.pset_template_path)
blenderbim.bim.handler.refresh_ui_data()
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
bim_handler.refresh_ui_data()
bim_schema.reload(tool.Ifc.get().schema)
class RemovePropTemplate(bpy.types.Operator, PsetTemplateOperator):
@@ -281,8 +281,8 @@ class RemovePropTemplate(bpy.types.Operator, PsetTemplateOperator):
**{"prop_template": IfcStore.pset_template_file.by_id(self.prop_template)}
)
IfcStore.pset_template_file.write(IfcStore.pset_template_path)
blenderbim.bim.handler.refresh_ui_data()
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
bim_handler.refresh_ui_data()
bim_schema.reload(tool.Ifc.get().schema)
class EditPropTemplate(bpy.types.Operator, PsetTemplateOperator):
@@ -312,6 +312,6 @@ class EditPropTemplate(bpy.types.Operator, PsetTemplateOperator):
)
bpy.ops.bim.disable_editing_prop_template()
IfcStore.pset_template_file.write(IfcStore.pset_template_path)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
if tool.Ifc.get():
blenderbim.bim.schema.reload(tool.Ifc.get().schema)
bim_schema.reload(tool.Ifc.get().schema)
@@ -21,9 +21,9 @@ import ifcopenshell.api
import ifcopenshell.util.resource
from ...ifc import IfcStore
from .... import tool
import blenderbim.bim.module.pset.data
import blenderbim.bim.module.resource.data
import blenderbim.bim.module.sequence.data
from ..pset import data as bim_module_pset_data
from . import data as bim_module_resource_data
from ..sequence import data as bim_module_sequence_data
from ...prop import StrProperty, Attribute
from bpy.types import PropertyGroup
from bpy.props import (
@@ -61,7 +61,7 @@ def updateResourceName(self, context):
if props.active_resource_id == self.ifc_definition_id:
attribute = props.resource_attributes.get("Name")
attribute.string_value = self.name
blenderbim.bim.module.resource.data.refresh()
bim_module_resource_data.refresh()
tool.Sequence.refresh_task_resources()
@@ -70,7 +70,7 @@ def get_quantity_types(self, context):
def update_active_resource_index(self, context):
blenderbim.bim.module.pset.data.refresh()
bim_module_pset_data.refresh()
if self.should_show_resource_tools:
tool.Resource.load_productivity_data()
@@ -87,9 +87,9 @@ def updateResourceUsage(self, context):
tool.Sequence.load_task_properties()
tool.Resource.load_resource_properties()
tool.Sequence.refresh_task_resources()
blenderbim.bim.module.resource.data.refresh()
blenderbim.bim.module.sequence.data.refresh()
blenderbim.bim.module.pset.data.refresh()
bim_module_resource_data.refresh()
bim_module_sequence_data.refresh()
bim_module_pset_data.refresh()
class ISODuration(PropertyGroup):
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel, UIList
from ...ifc import IfcStore
from .data import ResourceData
@@ -235,10 +235,10 @@ class BIM_PT_resources(Panel):
row.operator("bim.disable_editing_resource", text="", icon="CANCEL")
def draw_editable_resource_attributes_ui(self):
blenderbim.bim.helper.draw_attributes(self.props.resource_attributes, self.layout)
bim_helper.draw_attributes(self.props.resource_attributes, self.layout)
def draw_editable_resource_time_attributes_ui(self):
blenderbim.bim.helper.draw_attributes(self.props.resource_time_attributes, self.layout)
bim_helper.draw_attributes(self.props.resource_time_attributes, self.layout)
def draw_editable_resource_quantity_ui(self):
resource = ResourceData.data["resources"][self.props.active_resource_id]
@@ -261,7 +261,7 @@ class BIM_PT_resources(Panel):
if self.props.is_editing_quantity:
box = self.layout.box()
blenderbim.bim.helper.draw_attributes(self.props.quantity_attributes, box)
bim_helper.draw_attributes(self.props.quantity_attributes, box)
else:
row = self.layout.row(align=True)
row.prop(self.props, "quantity_types", text="")
@@ -285,7 +285,7 @@ class BIM_PT_resources(Panel):
self.draw_readonly_cost_value_ui(row, cost_value)
if self.props.cost_value_editing_type == "ATTRIBUTES":
blenderbim.bim.helper.draw_attributes(self.props.cost_value_attributes, self.layout.box())
bim_helper.draw_attributes(self.props.cost_value_attributes, self.layout.box())
def draw_readonly_cost_value_ui(self, layout, cost_value):
if self.props.active_cost_value_id == cost_value["id"] and self.props.cost_value_editing_type == "FORMULA":
@@ -22,12 +22,12 @@ import ifcopenshell.api
import ifcopenshell.util.schema
import ifcopenshell.util.element
import ifcopenshell.util.type
import blenderbim.bim.handler
import blenderbim.core.geometry
import blenderbim.core.material
import blenderbim.core.spatial
import blenderbim.core.style
import blenderbim.core.type
from ... import handler as bim_handler
from ....core import geometry as core_geometry
from ....core import material as core_material
from ....core import spatial as core_spatial
from ....core import style as core_style
from ....core import type as core_type
from ....core import root as core
from .... import tool
from ...ifc import IfcStore
@@ -300,4 +300,4 @@ class CopyClass(bpy.types.Operator, tool.Ifc.Operator):
objects = [bpy.data.objects.get(self.obj)] if self.obj else context.selected_objects
for obj in objects:
core.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=obj)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel
from .data import SearchData, ColourByPropertyData, SelectSimilarData
@@ -36,7 +36,7 @@ class BIM_PT_search(Panel):
props = context.scene.BIMSearchProperties
blenderbim.bim.helper.draw_filter(self.layout, props.filter_groups, SearchData, "search")
bim_helper.draw_filter(self.layout, props.filter_groups, SearchData, "search")
if len(props.filter_groups):
row = self.layout.row(align=True)
@@ -25,8 +25,8 @@ from .... import tool
from ....core import sequence as core
from ...ifc import IfcStore
from .data import SequenceData, AnimationColorSchemeData, refresh as refresh_sequence_data
import blenderbim.bim.module.resource.data
import blenderbim.bim.module.pset.data
from ..resource import data as bim_module_resource_data
from ..pset import data as bim_module_pset_data
from ...prop import StrProperty, Attribute
from dateutil import parser
from bpy.types import PropertyGroup
@@ -92,7 +92,7 @@ def update_active_task_index(self, context):
task = tool.Sequence.get_highlighted_task()
self.highlighted_task_id = task.id() if task else 0
tool.Sequence.update_task_ICOM(task)
blenderbim.bim.module.pset.data.refresh()
bim_module_pset_data.refresh()
if self.editing_task_type == "SEQUENCE":
tool.Sequence.load_task_properties()
@@ -342,9 +342,9 @@ def updateAssignedResourceUsage(self, context):
tool.Sequence.load_task_properties()
tool.Resource.load_resource_properties()
tool.Sequence.refresh_task_resources()
blenderbim.bim.module.resource.data.refresh()
bim_module_resource_data.refresh()
refresh_sequence_data()
blenderbim.bim.module.pset.data.refresh()
bim_module_pset_data.refresh()
def update_task_bar_list(self, context):
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import isodate
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel, UIList
from ...ifc import IfcStore
from ...helper import draw_attributes
@@ -384,10 +384,10 @@ class BIM_PT_work_schedules(Panel):
op.task = task["id"]
def draw_editable_sequence_attributes_ui(self):
blenderbim.bim.helper.draw_attributes(self.props.sequence_attributes, self.layout)
bim_helper.draw_attributes(self.props.sequence_attributes, self.layout)
def draw_editable_sequence_lag_time_ui(self):
blenderbim.bim.helper.draw_attributes(self.props.lag_time_attributes, self.layout)
bim_helper.draw_attributes(self.props.lag_time_attributes, self.layout)
def draw_editable_task_calendar_ui(self):
task = SequenceData.data["tasks"][self.props.active_task_id]
@@ -409,12 +409,12 @@ class BIM_PT_work_schedules(Panel):
row.label(text="Must Create a Calendar First. See Work Calendar Panel", icon="INFO")
def draw_editable_task_attributes_ui(self):
blenderbim.bim.helper.draw_attributes(
bim_helper.draw_attributes(
self.props.task_attributes, self.layout, copy_operator="bim.copy_task_attribute"
)
def draw_editable_task_time_attributes_ui(self):
blenderbim.bim.helper.draw_attributes(self.props.task_time_attributes, self.layout)
bim_helper.draw_attributes(self.props.task_time_attributes, self.layout)
def draw_baseline_ui(self, work_schedule_id):
if not self.props.should_show_schedule_baseline_ui:
@@ -20,10 +20,10 @@ import bpy
import ifcopenshell.util.element
from .... import tool
from ....core import spatial as core
import blenderbim.core.geometry
import blenderbim.core.aggregate
import blenderbim.core.root
import blenderbim.bim.handler
from ....core import geometry as core_geometry
from ....core import aggregate as core_aggregate
from ....core import root as core_root
from ... import handler as bim_handler
class ReferenceStructure(bpy.types.Operator, tool.Ifc.Operator):
@@ -140,7 +140,7 @@ class CopyToContainer(bpy.types.Operator, tool.Ifc.Operator):
old_to_new[tool.Ifc.get_entity(obj)] = result_objs
# Recreate decompositions
tool.Root.recreate_decompositions(relationships, old_to_new)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
class SelectContainer(bpy.types.Operator, tool.Ifc.Operator):
@@ -23,8 +23,8 @@ from .... import tool
from ..model.data import AuthoringData
from bpy.types import WorkSpaceTool
from ...ifc import IfcStore
import blenderbim.bim.handler
import blenderbim.core.spatial
from ... import handler as bim_handler
from ....core import spatial as core_spatial
class SpatialTool(WorkSpaceTool):
@@ -153,8 +153,8 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bpy.ops.bim.generate_spaces_from_walls()
else:
try:
blenderbim.core.spatial.generate_space(tool.Ifc, tool.Model, tool.Root, tool.Spatial, tool.Type)
except blenderbim.core.spatial.NoDefaultContainer:
core_spatial.generate_space(tool.Ifc, tool.Model, tool.Root, tool.Spatial, tool.Type)
except core_spatial.NoDefaultContainer:
return self.report({"ERROR"}, "Please set a default container to create the space in.")
def hotkey_S_B(self):
@@ -21,11 +21,11 @@ import json
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.attribute
import blenderbim.bim.helper
import blenderbim.bim.handler
from ... import helper as bim_helper
from ... import handler as bim_handler
from ....core import structural as core
from .... import tool
import blenderbim.core.context
from ....core import context as core_context
from math import degrees
from mathutils import Vector, Matrix
from ...ifc import IfcStore
@@ -516,7 +516,7 @@ class EditStructuralLoadCase(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
props = context.scene.BIMStructuralProperties
attributes = blenderbim.bim.helper.export_attributes(props.load_case_attributes)
attributes = bim_helper.export_attributes(props.load_case_attributes)
self.file = IfcStore.get_file()
ifcopenshell.api.run(
"structural.edit_structural_load_case",
@@ -552,7 +552,7 @@ class EnableEditingStructuralLoadCase(bpy.types.Operator):
self.props.active_load_case_id = self.load_case
self.props.load_case_editing_type = "ATTRIBUTES"
self.props.load_case_attributes.clear()
blenderbim.bim.helper.import_attributes2(
bim_helper.import_attributes2(
tool.Ifc.get().by_id(self.load_case), self.props.load_case_attributes, callback=self.import_attributes
)
return {"FINISHED"}
@@ -756,7 +756,7 @@ class EnableEditingStructuralLoad(bpy.types.Operator):
def execute(self, context):
props = context.scene.BIMStructuralProperties
props.structural_load_attributes.clear()
blenderbim.bim.helper.import_attributes2(
bim_helper.import_attributes2(
tool.Ifc.get().by_id(self.structural_load), props.structural_load_attributes
)
props.active_structural_load_id = self.structural_load
@@ -798,7 +798,7 @@ class EditStructuralLoad(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
props = context.scene.BIMStructuralProperties
attributes = blenderbim.bim.helper.export_attributes(props.structural_load_attributes)
attributes = bim_helper.export_attributes(props.structural_load_attributes)
self.file = IfcStore.get_file()
ifcopenshell.api.run(
"structural.edit_structural_load",
@@ -909,7 +909,7 @@ class EnableEditingBoundaryCondition(bpy.types.Operator):
props.boundary_condition_attributes.clear()
boundary_condition = tool.Ifc.get().by_id(self.boundary_condition)
# blenderbim.bim.helper.import_attributes(data["type"], props.boundary_condition_attributes, data)
# bim_helper.import_attributes(data["type"], props.boundary_condition_attributes, data)
for attribute in IfcStore.get_schema().declaration_by_name(boundary_condition.is_a()).all_attributes():
value = getattr(boundary_condition, attribute.name(), None)
data_type = ifcopenshell.util.attribute.get_primitive_type(attribute)
@@ -971,7 +971,7 @@ class EditBoundaryCondition(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
props = context.scene.BIMStructuralProperties
self.file = IfcStore.get_file()
# attributes = blenderbim.bim.helper.export_attributes(props.boundary_condition_attributes)
# attributes = bim_helper.export_attributes(props.boundary_condition_attributes)
attributes = {}
for attribute in props.boundary_condition_attributes:
if attribute.is_null:
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel, UIList
from ...ifc import IfcStore
from ...helper import draw_attributes, prop_with_search
@@ -491,7 +491,7 @@ class BIM_PT_structural_loads(Panel):
)
if self.props.active_structural_load_id:
blenderbim.bim.helper.draw_attributes(self.props.structural_load_attributes, self.layout)
bim_helper.draw_attributes(self.props.structural_load_attributes, self.layout)
class BIM_UL_structural_loads(UIList):
@@ -565,7 +565,7 @@ class BIM_PT_boundary_conditions(Panel):
if self.props.active_boundary_condition_id:
draw_boundary_condition_editable_ui(self.layout, self.props)
# blenderbim.bim.helper.draw_attributes(self.props.boundary_condition_attributes, self.layout)
# bim_helper.draw_attributes(self.props.boundary_condition_attributes, self.layout)
class BIM_UL_boundary_conditions(UIList):
@@ -23,7 +23,7 @@ from .... import tool
from ...helper import prop_with_search
from bpy.types import WorkSpaceTool
from ...ifc import IfcStore
import blenderbim.bim.handler
from ... import handler as bim_handler
class StructuralTool(WorkSpaceTool):
@@ -18,8 +18,8 @@
import os
import bpy
import blenderbim.bim.helper
import blenderbim.bim.handler
from ... import helper as bim_helper
from ... import handler as bim_handler
from .... import tool
from ....core import style as core
import ifcopenshell.api
@@ -666,7 +666,7 @@ class EnableEditingSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
if attributes is not None:
attributes.clear()
blenderbim.bim.helper.import_attributes2(surface_style or self.ifc_class, attributes, callback)
bim_helper.import_attributes2(surface_style or self.ifc_class, attributes, callback)
material = tool.Ifc.get_object(style)
active_style_type = material.BIMStyleProperties.active_style_type
@@ -753,7 +753,7 @@ class EditSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
"style.edit_surface_style",
tool.Ifc.get(),
style=self.surface_style,
attributes=blenderbim.bim.helper.export_attributes(attributes),
attributes=bim_helper.export_attributes(attributes),
)
def add_new_style(self):
@@ -804,7 +804,7 @@ class EditSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
tool.Ifc.get(),
style=self.style,
ifc_class=self.props.is_editing_class,
attributes=blenderbim.bim.helper.export_attributes(attributes),
attributes=bim_helper.export_attributes(attributes),
)
def get_shading_attributes(self):
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from bpy.types import Panel, UIList
from ...ifc import IfcStore
@@ -46,7 +46,7 @@ class BIM_PT_styles(Panel):
if not self.props.is_editing:
row = self.layout.row(align=True)
row.label(text="{} Styles".format(StylesData.data["total_styles"]), icon="SHADING_RENDERED")
blenderbim.bim.helper.prop_with_search(row, self.props, "style_type", text="")
bim_helper.prop_with_search(row, self.props, "style_type", text="")
row.operator("bim.load_styles", text="", icon="IMPORT").style_type = self.props.style_type
return
@@ -128,7 +128,7 @@ class BIM_PT_styles(Panel):
# display style elements props during edit
if self.props.is_editing_style:
if self.props.is_editing_class == "IfcSurfaceStyle":
blenderbim.bim.helper.draw_attributes(self.props.attributes, self.layout)
bim_helper.draw_attributes(self.props.attributes, self.layout)
row = self.layout.row(align=True)
row.operator("bim.edit_style", text="Save Attributes", icon="CHECKMARK")
row.operator("bim.disable_editing_style", text="", icon="CANCEL")
@@ -243,19 +243,19 @@ class BIM_PT_styles(Panel):
op = row.operator("bim.browse_external_style", icon="APPEND_BLEND", text="Append From Blend File")
style = self.props.styles[self.props.active_style_index]
op.active_surface_style_id = style.ifc_definition_id
blenderbim.bim.helper.draw_attributes(self.props.external_style_attributes, self.layout)
bim_helper.draw_attributes(self.props.external_style_attributes, self.layout)
row = self.layout.row(align=True)
row.operator("bim.edit_surface_style", text="Save External Style", icon="CHECKMARK")
row.operator("bim.disable_editing_style", text="", icon="CANCEL")
def draw_refraction_surface_style(self):
blenderbim.bim.helper.draw_attributes(self.props.refraction_style_attributes, self.layout)
bim_helper.draw_attributes(self.props.refraction_style_attributes, self.layout)
row = self.layout.row(align=True)
row.operator("bim.edit_surface_style", text="Save Refraction Style", icon="CHECKMARK")
row.operator("bim.disable_editing_style", text="", icon="CANCEL")
def draw_lighting_surface_style(self):
blenderbim.bim.helper.draw_attributes(self.props.lighting_style_colours, self.layout)
bim_helper.draw_attributes(self.props.lighting_style_colours, self.layout)
row = self.layout.row(align=True)
row.operator("bim.edit_surface_style", text="Save Lighting Style", icon="CHECKMARK")
row.operator("bim.disable_editing_style", text="", icon="CANCEL")
@@ -20,8 +20,8 @@ import bpy
import ifcopenshell.api
from .... import tool
from ....core import system as core
import blenderbim.bim.handler
import blenderbim.bim.helper
from ... import handler as bim_handler
from ... import helper as bim_helper
from ...ifc import IfcStore
from .data import PortData
from mathutils import Matrix
@@ -380,7 +380,7 @@ class EnableEditingZone(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
props = bpy.context.scene.BIMZoneProperties
props.attributes.clear()
blenderbim.bim.helper.import_attributes2(tool.Ifc.get().by_id(self.zone), props.attributes)
bim_helper.import_attributes2(tool.Ifc.get().by_id(self.zone), props.attributes)
props.is_editing = self.zone
@@ -402,7 +402,7 @@ class EditZone(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
props = bpy.context.scene.BIMZoneProperties
zone = tool.Ifc.get().by_id(props.is_editing)
attributes = blenderbim.bim.helper.export_attributes(props.attributes)
attributes = bim_helper.export_attributes(props.attributes)
ifcopenshell.api.run("system.edit_system", tool.Ifc.get(), system=zone, attributes=attributes)
props.is_editing = 0
bpy.ops.bim.load_zones()
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
import blenderbim.bim.helper
from ... import helper as bim_helper
from .... import tool
from ...helper import prop_with_search
from bpy.types import Panel, UIList
@@ -377,7 +377,7 @@ class BIM_PT_zones(Panel):
self.layout.template_list("BIM_UL_zones", "", self.props, "zones", self.props, "active_zone_index")
if self.props.is_editing:
blenderbim.bim.helper.draw_attributes(self.props.attributes, self.layout)
bim_helper.draw_attributes(self.props.attributes, self.layout)
row = self.layout.row(align=True)
row.operator("bim.edit_zone", icon="CHECKMARK")
row.operator("bim.disable_editing_zone", icon="CANCEL", text="")
@@ -26,7 +26,7 @@ import ifctester.ids
import ifctester.reporter
import ifcopenshell
from .... import tool
import blenderbim.bim.handler
from ... import handler as bim_handler
from ...operator import MultipleFileSelector
from pathlib import Path
@@ -58,7 +58,7 @@ class ExecuteIfcTester(bpy.types.Operator, tool.Ifc.Operator):
for f in props.specs_files:
self.execute_tester(ifc_data, ifc_file.name, f.name)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
def execute_tester(self, ifc_data, ifc_path, specs_path):
@@ -25,9 +25,9 @@ import ifcopenshell.util.type
import ifcopenshell.util.unit
import ifcopenshell.api
from .... import tool
import blenderbim.core.geometry
from ....core import geometry as core_geometry
from ....core import type as core
import blenderbim.core.root
from ....core import root as core_root
from ...ifc import IfcStore
@@ -98,7 +98,7 @@ class UnassignType(bpy.types.Operator):
element.Representation.Representations = representations
if new_active_representation:
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
@@ -268,7 +268,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
bm.free()
obj = bpy.data.objects.new(name, mesh)
obj.matrix_world.translation = location
blenderbim.core.root.assign_class(
core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -283,7 +283,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
elif template in ("LAYERSET_AXIS2", "LAYERSET_AXIS3"):
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(ifc_file)
obj = bpy.data.objects.new(name, None)
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -317,7 +317,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
elif template == "PROFILESET" or template.startswith("FLOW_SEGMENT_"):
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(ifc_file)
obj = bpy.data.objects.new(name, None)
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -390,7 +390,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
elif template == "EMPTY":
obj = bpy.data.objects.new(name, None)
blenderbim.core.root.assign_class(
core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -405,7 +405,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
elif template == "WINDOW":
mesh = bpy.data.meshes.new(name)
obj = bpy.data.objects.new(name, mesh)
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -420,7 +420,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
elif template == "DOOR":
mesh = bpy.data.meshes.new(name)
obj = bpy.data.objects.new(name, mesh)
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -435,7 +435,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
elif template == "STAIR":
mesh = bpy.data.meshes.new(name)
obj = bpy.data.objects.new(name, mesh)
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -450,7 +450,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
elif template == "RAILING":
mesh = bpy.data.meshes.new(name)
obj = bpy.data.objects.new(name, mesh)
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -466,7 +466,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator):
elif template == "ROOF":
mesh = bpy.data.meshes.new(name)
obj = bpy.data.objects.new(name, mesh)
element = blenderbim.core.root.assign_class(
element = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -549,7 +549,7 @@ class DuplicateType(bpy.types.Operator, tool.Ifc.Operator):
new_obj = obj.copy()
if obj.data:
new_obj.data = obj.data.copy()
new = blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj)
new = core_root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj)
new.Name += " Copy"
bpy.ops.bim.load_type_thumbnails(ifc_class=new.is_a())
if obj in context.selectable_objects:
@@ -20,8 +20,8 @@ import bpy
import json
import ifcopenshell.api
import ifcopenshell.util.unit
import blenderbim.bim.helper
import blenderbim.bim.handler
from ... import helper as bim_helper
from ... import handler as bim_handler
from .... import tool
from ....core import unit as core
from ...ifc import IfcStore
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.bim.helper
from ... import helper as bim_helper
from bpy.types import Panel, UIList
from ...ifc import IfcStore
from ...helper import prop_with_search
@@ -98,7 +98,7 @@ class BIM_PT_units(Panel):
self.draw_editable_ui(context)
def draw_editable_ui(self, context):
blenderbim.bim.helper.draw_attributes(self.props.unit_attributes, self.layout)
bim_helper.draw_attributes(self.props.unit_attributes, self.layout)
class BIM_UL_units(UIList):
@@ -21,9 +21,9 @@ import ifcopenshell.api
import ifcopenshell.util.element
import ifcopenshell.util.representation
from .... import tool
import blenderbim.core.geometry
import blenderbim.core.root
import blenderbim.bim.handler
from ....core import geometry as core_geometry
from ....core import root as core_root
from ... import handler as bim_handler
from ...ifc import IfcStore
from ..model.opening import FilledOpeningGenerator
@@ -86,7 +86,7 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
continue
if tool.Ifc.is_moved(obj1):
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj1)
core_geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj1)
has_visible_openings = False
for opening in [r.RelatedOpeningElement for r in element1.HasOpenings]:
@@ -96,7 +96,7 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
body_context = ifcopenshell.util.representation.get_context(IfcStore.get_file(), "Model", "Body")
if not element2:
element2 = blenderbim.core.root.assign_class(
element2 = core_root.assign_class(
tool.Ifc,
tool.Collector,
tool.Root,
@@ -108,7 +108,7 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
ifcopenshell.api.run("void.add_opening", tool.Ifc.get(), opening=element2, element=element1)
if tool.Ifc.is_moved(obj2):
blenderbim.core.geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj2)
core_geometry.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj2)
voided_objs = [obj1]
for subelement in ifcopenshell.util.element.get_decomposition(element1):
@@ -119,7 +119,7 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
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,
@@ -162,7 +162,7 @@ class RemoveOpening(bpy.types.Operator, tool.Ifc.Operator):
building_obj = tool.Ifc.get_object(building_element)
if building_obj and building_obj.data:
representation = tool.Geometry.get_active_representation(building_obj)
blenderbim.core.geometry.switch_representation(
core_geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=building_obj,
@@ -271,5 +271,5 @@ class BooleansMarkAsManual(bpy.types.Operator):
self.report(
{"INFO"}, f"{len(booleans)} booleans were marked as {'manual' if self.mark_as_manual else 'automatic'}"
)
blenderbim.bim.handler.refresh_ui_data()
bim_handler.refresh_ui_data()
return {"FINISHED"}
+3 -2
View File
@@ -30,7 +30,8 @@ import subprocess
import tempfile
import webbrowser
import ifcopenshell
import blenderbim.bim.handler
from .. import bim
from . import handler as bim_handler
from .. import tool
from . import schema
from ..bim import import_ifc
@@ -58,7 +59,7 @@ class SetTab(bpy.types.Operator):
@classmethod
def description(cls, context, operator):
return next((t[1] for t in blenderbim.bim.prop.get_tab(None, context) if t[0] == operator.tab), "")
return next((t[1] for t in bim.prop.get_tab(None, context) if t[0] == operator.tab), "")
def execute(self, context):
if context.area.spaces.active.search_filter:
+9 -9
View File
@@ -30,9 +30,9 @@ from ifcopenshell.util.doc import (
get_property_doc,
get_predefined_type_doc,
)
import blenderbim.bim
import blenderbim.bim.schema
import blenderbim.bim.handler
from .. import bim
from . import schema as bim_schema
from . import handler as bim_handler
from .ifc import IfcStore
from .. import tool
from collections import defaultdict
@@ -109,20 +109,20 @@ def get_attribute_enum_values(prop, context):
def update_schema_dir(self, context):
import blenderbim.bim.schema
from . import schema
blenderbim.bim.schema.ifc.schema_dir = context.scene.BIMProperties.schema_dir
schema.ifc.schema_dir = context.scene.BIMProperties.schema_dir
def update_data_dir(self, context):
import blenderbim.bim.schema
from . import schema
blenderbim.bim.schema.ifc.data_dir = context.scene.BIMProperties.data_dir
schema.ifc.data_dir = context.scene.BIMProperties.data_dir
def update_ifc_file(self, context):
if context.scene.BIMProperties.ifc_file:
blenderbim.bim.handler.loadIfcStore(context.scene)
bim.handler.loadIfcStore(context.scene)
def update_section_color(self, context):
@@ -308,7 +308,7 @@ class Attribute(PropertyGroup):
def get_tab(self, context):
return [
("PROJECT", "Project Overview", "", blenderbim.bim.icons["IFC"].icon_id, 0),
("PROJECT", "Project Overview", "", bim.icons["IFC"].icon_id, 0),
("OBJECT", "Object Information", "", "FILE_3D", 1),
("GEOMETRY", "Geometry and Materials", "", "MATERIAL", 2),
("DRAWINGS", "Drawings and Documents", "", "DOCUMENTS", 3),
+5 -3
View File
@@ -18,6 +18,7 @@
import os
import bpy
import importlib
import addon_utils
import platform
from pathlib import Path
@@ -29,12 +30,13 @@ from ifcopenshell.util.doc import (
get_type_doc,
get_attribute_doc,
)
import blenderbim.bim
from .. import bim
from .. import tool
from ifcopenshell.util.file import IfcHeaderExtractor
from .prop import Attribute
from typing import Optional
bbim = importlib.import_module("..", package=__package__)
class IFCFileSelector:
filepath: str
@@ -397,7 +399,7 @@ class BIM_PT_tabs(Panel):
text="",
emboss=aprops.tab == "PROJECT",
depress=True,
icon_value=blenderbim.bim.icons["IFC"].icon_id,
icon_value=bim.icons["IFC"].icon_id,
).tab = "PROJECT"
self.draw_tab_entry(row, "FILE_3D", "OBJECT", is_ifc_project, aprops.tab == "OBJECT")
self.draw_tab_entry(row, "MATERIAL", "GEOMETRY", is_ifc_project, aprops.tab == "GEOMETRY")
@@ -433,7 +435,7 @@ class BIM_PT_tabs(Panel):
row = self.layout.row(align=True)
row.prop(aprops, "tab", text="")
if blenderbim.last_error:
if bbim.last_error:
box = self.layout.box()
box.alert = True
row = box.row(align=True)