mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
More import fixes
This commit is contained in:
@@ -21,6 +21,7 @@ import bpy
|
||||
import bmesh
|
||||
import json
|
||||
import os
|
||||
import importlib
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.util.element
|
||||
from ..core import tool as core_tool
|
||||
@@ -34,6 +35,8 @@ from ..bim.ifc import IFC_CONNECTED_TYPE
|
||||
from typing import Any, Optional, Union, Literal, Iterable, Callable
|
||||
|
||||
|
||||
bbim = importlib.import_module("..", package=__package__)
|
||||
|
||||
VIEWPORT_ATTRIBUTES = [
|
||||
"view_matrix",
|
||||
"view_distance",
|
||||
@@ -947,11 +950,11 @@ class Blender(core_tool.Blender):
|
||||
|
||||
@classmethod
|
||||
def register_toolbar(cls):
|
||||
import bim.module.model.workspace as ws_model
|
||||
import bim.module.drawing.workspace as ws_drawing
|
||||
import bim.module.spatial.workspace as ws_spatial
|
||||
import bim.module.structural.workspace as ws_structural
|
||||
import bim.module.covering.workspace as ws_covering
|
||||
from ..bim.module.model import workspace as ws_model
|
||||
from ..bim.module.drawing import workspace as ws_drawing
|
||||
from ..bim.module.spatial import workspace as ws_spatial
|
||||
from ..bim.module.structural import workspace as ws_structural
|
||||
from ..bim.module.covering import workspace as ws_covering
|
||||
|
||||
if bpy.app.background:
|
||||
return
|
||||
@@ -1110,7 +1113,7 @@ class Blender(core_tool.Blender):
|
||||
@classmethod
|
||||
def get_blender_addon_package_name(cls) -> str:
|
||||
if bpy.app.version >= (4, 2, 0):
|
||||
return blenderbim.BLENDER_PACKAGE_NAME
|
||||
return bbim.BLENDER_PACKAGE_NAME
|
||||
return "blenderbim"
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -27,7 +27,7 @@ from typing import Any, Sequence
|
||||
class Boundary(core_tool.Boundary):
|
||||
@classmethod
|
||||
def get_assign_connection_geometry_settings(cls, obj: bpy.types.Object) -> dict[str, Any]:
|
||||
from blenderbim.bim.module.geometry.helper import Helper
|
||||
from ..bim.module.geometry.helper import Helper
|
||||
|
||||
ifc = tool.Ifc.get()
|
||||
helper = Helper(ifc)
|
||||
|
||||
@@ -21,6 +21,7 @@ import bpy
|
||||
import ifcopenshell
|
||||
import ifcopenshell.guid
|
||||
import ifcopenshell.util.brick
|
||||
from ..core import brick as core_brick
|
||||
from ..core import tool as core_tool
|
||||
from .. import tool
|
||||
from contextlib import contextmanager
|
||||
@@ -395,17 +396,17 @@ class Brick(core_tool.Brick):
|
||||
|
||||
@classmethod
|
||||
def run_assign_brick_reference(cls, element=None, library=None, brick_uri=None):
|
||||
return blenderbim.core.brick.assign_brick_reference(
|
||||
return core_brick.assign_brick_reference(
|
||||
tool.Ifc, tool.Brick, element=element, library=library, brick_uri=brick_uri
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def run_refresh_brick_viewer(cls):
|
||||
return blenderbim.core.brick.refresh_brick_viewer(tool.Brick)
|
||||
return core_brick.refresh_brick_viewer(tool.Brick)
|
||||
|
||||
@classmethod
|
||||
def run_view_brick_class(cls, brick_class=None, split_screen=False):
|
||||
return blenderbim.core.brick.view_brick_class(tool.Brick, brick_class=brick_class, split_screen=split_screen)
|
||||
return core_brick.view_brick_class(tool.Brick, brick_class=brick_class, split_screen=split_screen)
|
||||
|
||||
@classmethod
|
||||
def select_browser_item(cls, item, split_screen=False):
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
import bpy
|
||||
import ifcopenshell.util.system
|
||||
from ..bim import helper as bim_helper
|
||||
from ..core import tool as core_tool
|
||||
from .. import tool
|
||||
from ..bim import import_ifc
|
||||
@@ -54,7 +55,7 @@ class Document(core_tool.Document):
|
||||
|
||||
@classmethod
|
||||
def export_document_attributes(cls):
|
||||
return blenderbim.bim.helper.export_attributes(bpy.context.scene.BIMDocumentProperties.document_attributes)
|
||||
return bim_helper.export_attributes(bpy.context.scene.BIMDocumentProperties.document_attributes)
|
||||
|
||||
@classmethod
|
||||
def get_active_breadcrumb(cls):
|
||||
@@ -66,7 +67,7 @@ class Document(core_tool.Document):
|
||||
def import_document_attributes(cls, document):
|
||||
props = bpy.context.scene.BIMDocumentProperties
|
||||
props.document_attributes.clear()
|
||||
blenderbim.bim.helper.import_attributes2(document, props.document_attributes)
|
||||
bim_helper.import_attributes2(document, props.document_attributes)
|
||||
|
||||
@classmethod
|
||||
def import_project_documents(cls):
|
||||
|
||||
@@ -31,6 +31,7 @@ import platform
|
||||
import mathutils
|
||||
import subprocess
|
||||
import numpy as np
|
||||
from ..bim import helper as bim_helper
|
||||
from ..core import tool as core_tool
|
||||
from ..core import geometry as core_geometry
|
||||
from .. import tool
|
||||
@@ -95,7 +96,7 @@ class Drawing(core_tool.Drawing):
|
||||
|
||||
@classmethod
|
||||
def create_annotation_object(cls, drawing: ifcopenshell.entity_instance, object_type: str) -> bpy.types.Object:
|
||||
import blenderbim.bim.module.drawing.annotation as annotation
|
||||
from ..bim.module.drawing import annotation
|
||||
|
||||
data_type = cls.get_annotation_data_type(object_type)
|
||||
obj = annotation.Annotator.get_annotation_obj(drawing, object_type, data_type)
|
||||
@@ -258,7 +259,7 @@ class Drawing(core_tool.Drawing):
|
||||
|
||||
@classmethod
|
||||
def create_svg_schedule(cls, schedule):
|
||||
import blenderbim.bim.module.drawing.scheduler as scheduler
|
||||
from ..bim.module.drawing import scheduler
|
||||
|
||||
schedule_creator = scheduler.Scheduler()
|
||||
schedule_creator.schedule(
|
||||
@@ -267,7 +268,7 @@ class Drawing(core_tool.Drawing):
|
||||
|
||||
@classmethod
|
||||
def create_svg_sheet(cls, document: ifcopenshell.entity_instance, titleblock: str) -> str:
|
||||
import blenderbim.bim.module.drawing.sheeter as sheeter
|
||||
from ..bim.module.drawing import sheeter
|
||||
|
||||
sheet_builder = sheeter.SheetBuilder()
|
||||
sheet_builder.data_dir = bpy.context.scene.BIMProperties.data_dir
|
||||
@@ -277,7 +278,7 @@ class Drawing(core_tool.Drawing):
|
||||
|
||||
@classmethod
|
||||
def add_drawings(cls, sheet):
|
||||
import blenderbim.bim.module.drawing.sheeter as sheeter
|
||||
from ..bim.module.drawing import sheeter
|
||||
|
||||
sheet_builder = sheeter.SheetBuilder()
|
||||
sheet_builder.data_dir = bpy.context.scene.BIMProperties.data_dir
|
||||
@@ -390,7 +391,7 @@ class Drawing(core_tool.Drawing):
|
||||
def export_text_literal_attributes(cls, obj: bpy.types.Object) -> list[dict[str, Any]]:
|
||||
literals = []
|
||||
for literal_props in obj.BIMTextProperties.literals:
|
||||
literal_data = blenderbim.bim.helper.export_attributes(literal_props.attributes)
|
||||
literal_data = bim_helper.export_attributes(literal_props.attributes)
|
||||
literals.append(literal_data)
|
||||
return literals
|
||||
|
||||
@@ -734,7 +735,7 @@ class Drawing(core_tool.Drawing):
|
||||
|
||||
@classmethod
|
||||
def import_camera_props(cls, drawing: ifcopenshell.entity_instance, obj: bpy.types.Object) -> None:
|
||||
from blenderbim.bim.module.drawing.prop import get_diagram_scales
|
||||
from ..bim.module.drawing.prop import get_diagram_scales
|
||||
|
||||
# Temporarily clear the definition id to prevent prop update callbacks to IFC.
|
||||
ifc_definition_id = obj.BIMObjectProperties.ifc_definition_id
|
||||
@@ -874,14 +875,14 @@ class Drawing(core_tool.Drawing):
|
||||
|
||||
@classmethod
|
||||
def import_text_attributes(cls, obj: bpy.types.Object) -> None:
|
||||
from blenderbim.bim.module.drawing.prop import BOX_ALIGNMENT_POSITIONS
|
||||
from ..bim.module.drawing.prop import BOX_ALIGNMENT_POSITIONS
|
||||
|
||||
props = obj.BIMTextProperties
|
||||
props.literals.clear()
|
||||
|
||||
for ifc_literal in cls.get_text_literal(obj, return_list=True):
|
||||
literal_props = props.literals.add()
|
||||
blenderbim.bim.helper.import_attributes2(ifc_literal, literal_props.attributes)
|
||||
bim_helper.import_attributes2(ifc_literal, literal_props.attributes)
|
||||
|
||||
box_alignment_mask = [False] * 9
|
||||
position_string = literal_props.attributes["BoxAlignment"].string_value
|
||||
@@ -889,7 +890,7 @@ class Drawing(core_tool.Drawing):
|
||||
literal_props.box_alignment = box_alignment_mask
|
||||
literal_props.ifc_definition_id = ifc_literal.id()
|
||||
|
||||
from blenderbim.bim.module.drawing.data import DecoratorData
|
||||
from ..bim.module.drawing.data import DecoratorData
|
||||
|
||||
text_data = DecoratorData.get_ifc_text_data(obj)
|
||||
props.font_size = str(text_data["FontSize"])
|
||||
@@ -979,7 +980,7 @@ class Drawing(core_tool.Drawing):
|
||||
"""updates pset `EPset_Annotation.Classes` value
|
||||
based on current font size from `obj.BIMTextProperties.font_size`
|
||||
"""
|
||||
from blenderbim.bim.module.drawing.data import FONT_SIZES
|
||||
from ..bim.module.drawing.data import FONT_SIZES
|
||||
|
||||
props = obj.BIMTextProperties
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
@@ -1185,7 +1186,7 @@ class Drawing(core_tool.Drawing):
|
||||
reference_element: ifcopenshell.entity_instance,
|
||||
context: ifcopenshell.entity_instance,
|
||||
) -> ifcopenshell.entity_instance:
|
||||
import blenderbim.bim.module.drawing.helper as helper
|
||||
from ..bim.module.drawing import helper
|
||||
|
||||
camera = tool.Ifc.get_object(drawing)
|
||||
bounds = helper.ortho_view_frame(camera.data) if camera.data.type == "ORTHO" else None
|
||||
@@ -1252,7 +1253,7 @@ class Drawing(core_tool.Drawing):
|
||||
reference_element: ifcopenshell.entity_instance,
|
||||
context: ifcopenshell.entity_instance,
|
||||
) -> ifcopenshell.entity_instance:
|
||||
import blenderbim.bim.module.drawing.helper as helper
|
||||
from ..bim.module.drawing import helper
|
||||
|
||||
reference_obj = tool.Ifc.get_object(reference_element)
|
||||
reference_obj.matrix_world
|
||||
@@ -1376,7 +1377,7 @@ class Drawing(core_tool.Drawing):
|
||||
reference_element: ifcopenshell.entity_instance,
|
||||
context: ifcopenshell.entity_instance,
|
||||
) -> ifcopenshell.entity_instance:
|
||||
import blenderbim.bim.module.drawing.helper as helper
|
||||
from ..bim.module.drawing import helper
|
||||
|
||||
target_view = tool.Drawing.get_drawing_target_view(drawing)
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ class Ifc(core_tool.Ifc):
|
||||
if global_id:
|
||||
IfcStore.guid_map[global_id] = obj
|
||||
|
||||
blenderbim.bim.handler.subscribe_to(obj, "name", bim_handler.name_callback)
|
||||
bim_handler.subscribe_to(obj, "name", bim_handler.name_callback)
|
||||
bim_handler.subscribe_to(
|
||||
obj, "active_material_index", bim_handler.active_material_index_callback
|
||||
)
|
||||
@@ -151,7 +151,7 @@ class Ifc(core_tool.Ifc):
|
||||
if style:
|
||||
IfcStore.id_map[style.id()] = obj
|
||||
|
||||
blenderbim.bim.handler.subscribe_to(obj, "name", bim_handler.name_callback)
|
||||
bim_handler.subscribe_to(obj, "name", bim_handler.name_callback)
|
||||
|
||||
@classmethod
|
||||
def link(cls, element: ifcopenshell.entity_instance, obj: IFC_CONNECTED_TYPE) -> None:
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import bpy
|
||||
from ..bim import helper as bim_helper
|
||||
from ..core import tool as core_tool
|
||||
from .. import tool
|
||||
|
||||
@@ -29,12 +30,12 @@ class Library(core_tool.Library):
|
||||
@classmethod
|
||||
def export_library_attributes(cls):
|
||||
props = bpy.context.scene.BIMLibraryProperties
|
||||
return blenderbim.bim.helper.export_attributes(props.library_attributes)
|
||||
return bim_helper.export_attributes(props.library_attributes)
|
||||
|
||||
@classmethod
|
||||
def export_reference_attributes(cls):
|
||||
props = bpy.context.scene.BIMLibraryProperties
|
||||
return blenderbim.bim.helper.export_attributes(props.reference_attributes)
|
||||
return bim_helper.export_attributes(props.reference_attributes)
|
||||
|
||||
@classmethod
|
||||
def get_active_library(cls):
|
||||
@@ -48,13 +49,13 @@ class Library(core_tool.Library):
|
||||
def import_library_attributes(cls, library):
|
||||
props = bpy.context.scene.BIMLibraryProperties
|
||||
props.library_attributes.clear()
|
||||
blenderbim.bim.helper.import_attributes2(library, props.library_attributes)
|
||||
bim_helper.import_attributes2(library, props.library_attributes)
|
||||
|
||||
@classmethod
|
||||
def import_reference_attributes(cls, reference):
|
||||
props = bpy.context.scene.BIMLibraryProperties
|
||||
props.reference_attributes.clear()
|
||||
blenderbim.bim.helper.import_attributes2(reference, props.reference_attributes)
|
||||
bim_helper.import_attributes2(reference, props.reference_attributes)
|
||||
|
||||
@classmethod
|
||||
def import_references(cls, library):
|
||||
|
||||
@@ -31,7 +31,7 @@ from typing import Union, Any, TYPE_CHECKING, Optional
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# Avoid circular imports.
|
||||
from blenderbim.bim.module.material.prop import Material as MaterialItem
|
||||
from ..bim.module.material.prop import Material as MaterialItem
|
||||
|
||||
|
||||
class Material(core_tool.Material):
|
||||
|
||||
@@ -31,7 +31,6 @@ import ifcopenshell.util.representation
|
||||
from ..core import geometry as core_geometry
|
||||
from ..core import tool as core_tool
|
||||
from .. import tool
|
||||
from ..core. import geometry
|
||||
from math import atan, degrees
|
||||
from mathutils import Matrix, Vector
|
||||
from copy import deepcopy
|
||||
@@ -762,7 +761,7 @@ class Model(core_tool.Model):
|
||||
ifcopenshell.api.run(
|
||||
"geometry.assign_representation", ifc_file, product=ifc_element, representation=new_representation
|
||||
)
|
||||
geometry.switch_representation(
|
||||
core_geometry.switch_representation(
|
||||
tool.Ifc,
|
||||
tool.Geometry,
|
||||
obj=obj,
|
||||
|
||||
@@ -21,6 +21,7 @@ import bpy
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.representation
|
||||
import ifcopenshell.util.unit
|
||||
from ..bim import handler as bim_handler
|
||||
from ..core import aggregate as core_aggregate
|
||||
from ..core import context as core_context
|
||||
from ..core import tool as core_tool
|
||||
@@ -122,7 +123,7 @@ class Project(core_tool.Project):
|
||||
|
||||
@classmethod
|
||||
def set_context(cls, context):
|
||||
blenderbim.bim.handler.refresh_ui_data()
|
||||
bim_handler.refresh_ui_data()
|
||||
bpy.context.scene.BIMRootProperties.contexts = str(context.id())
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
import bpy
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.element
|
||||
from ..bim import helper as bim_helper
|
||||
from ..core import tool as core_tool
|
||||
from .. import tool
|
||||
from ..bim import schema as bim_schema
|
||||
@@ -204,7 +205,7 @@ class Pset(core_tool.Pset):
|
||||
metadata.bool_value = False if metadata.is_null else bool(data[prop_template.Name])
|
||||
|
||||
metadata.ifc_class = pset_template.Name
|
||||
blenderbim.bim.helper.add_attribute_description(metadata, prop_template)
|
||||
bim_helper.add_attribute_description(metadata, prop_template)
|
||||
|
||||
@classmethod
|
||||
def import_pset_from_template(cls, pset_template, pset, props):
|
||||
|
||||
@@ -127,8 +127,6 @@ class Qto(core_tool.Qto):
|
||||
Example:
|
||||
|
||||
.. code::Python
|
||||
import blenderbim.tool as tool
|
||||
|
||||
relating_cost_items = tool.Qto.relating_cost_items(my_beautiful_wall)
|
||||
for relating_cost_item in relating_cost_items:
|
||||
print(f"RELATING COST ITEM NAME: {relating_cost_item["cost_item_name"]}")
|
||||
|
||||
@@ -22,7 +22,7 @@ import bpy
|
||||
from ..core import tool as core_tool
|
||||
from .. import tool
|
||||
from ..bim import helper as bim_helper
|
||||
from ..bim.module.sequence. import helper
|
||||
from ..bim.module.sequence import helper
|
||||
import json
|
||||
import time
|
||||
import isodate
|
||||
|
||||
@@ -33,7 +33,7 @@ from ..core import tool as core_tool
|
||||
from .. import core as core
|
||||
from .. import tool
|
||||
from ..bim import helper as bim_helper
|
||||
from ..bim.module.sequence. import helper
|
||||
from ..bim.module.sequence import helper
|
||||
from dateutil import parser
|
||||
from datetime import datetime
|
||||
from typing import Optional, Any, Union
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
import bpy
|
||||
import json
|
||||
import ifcopenshell
|
||||
from ..bim import helper as bim_helper
|
||||
from ..core import tool as core_tool
|
||||
from .. import tool
|
||||
|
||||
@@ -47,7 +48,7 @@ class Unit(core_tool.Unit):
|
||||
return True
|
||||
|
||||
props = bpy.context.scene.BIMUnitProperties
|
||||
return blenderbim.bim.helper.export_attributes(props.unit_attributes, callback=callback)
|
||||
return bim_helper.export_attributes(props.unit_attributes, callback=callback)
|
||||
|
||||
@classmethod
|
||||
def get_scene_unit_name(cls, unit_type):
|
||||
@@ -95,7 +96,7 @@ class Unit(core_tool.Unit):
|
||||
|
||||
props = bpy.context.scene.BIMUnitProperties
|
||||
props.unit_attributes.clear()
|
||||
blenderbim.bim.helper.import_attributes2(unit, props.unit_attributes, callback=callback)
|
||||
bim_helper.import_attributes2(unit, props.unit_attributes, callback=callback)
|
||||
|
||||
@classmethod
|
||||
def import_units(cls):
|
||||
|
||||
Reference in New Issue
Block a user