typing & use common tool.Ifc.Operator class

Lazy imported some modules to prevent circular imports.
This commit is contained in:
Andrej730
2024-07-05 16:31:57 +05:00
parent 8a9ca9ac60
commit 1d59edcbe8
26 changed files with 299 additions and 404 deletions
+2
View File
@@ -20,6 +20,8 @@ import os
import bpy import bpy
import json import json
import addon_utils import addon_utils
import ifcopenshell.util.element
import ifcopenshell.util.representation
import ifcopenshell.api.owner.settings import ifcopenshell.api.owner.settings
import blenderbim.bim import blenderbim.bim
import blenderbim.tool as tool import blenderbim.tool as tool
+5 -3
View File
@@ -36,7 +36,6 @@ import blenderbim.tool as tool
from itertools import chain, accumulate from itertools import chain, accumulate
from blenderbim.bim.ifc import IfcStore, IFC_CONNECTED_TYPE from blenderbim.bim.ifc import IfcStore, IFC_CONNECTED_TYPE
from blenderbim.tool.loader import OBJECT_DATA_TYPE from blenderbim.tool.loader import OBJECT_DATA_TYPE
from blenderbim.bim.module.drawing.prop import ANNOTATION_TYPES_DATA
from typing import Dict, Union, Optional, Any from typing import Dict, Union, Optional, Any
@@ -1262,9 +1261,12 @@ class IfcImporter:
if isinstance(obj, bpy.types.Object): if isinstance(obj, bpy.types.Object):
tool.Collector.assign(obj) tool.Collector.assign(obj)
def is_curve_annotation(self, element): def is_curve_annotation(self, element: ifcopenshell.entity_instance) -> bool:
object_type = element.ObjectType object_type = element.ObjectType
return object_type in ANNOTATION_TYPES_DATA and ANNOTATION_TYPES_DATA[object_type][3] == "curve" return (
object_type in tool.Drawing.ANNOTATION_TYPES_DATA
and tool.Drawing.ANNOTATION_TYPES_DATA[object_type][3] == "curve"
)
def get_drawing_group(self, element): def get_drawing_group(self, element):
for rel in element.HasAssignments or []: for rel in element.HasAssignments or []:
@@ -26,14 +26,7 @@ import blenderbim.bim.handler
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
class Operator: class BIM_OT_aggregate_assign_object(bpy.types.Operator, tool.Ifc.Operator):
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class BIM_OT_aggregate_assign_object(bpy.types.Operator, Operator):
"""Create aggregation relationship between two ifc elements""" """Create aggregation relationship between two ifc elements"""
bl_idname = "bim.aggregate_assign_object" bl_idname = "bim.aggregate_assign_object"
@@ -75,7 +68,7 @@ class BIM_OT_aggregate_assign_object(bpy.types.Operator, Operator):
self.report({"ERROR"}, f"Cannot aggregate to {relating_obj.name} with a body representation") self.report({"ERROR"}, f"Cannot aggregate to {relating_obj.name} with a body representation")
class BIM_OT_aggregate_unassign_object(bpy.types.Operator, Operator): class BIM_OT_aggregate_unassign_object(bpy.types.Operator, tool.Ifc.Operator):
"""Remove aggregation relationship between two ifc elements""" """Remove aggregation relationship between two ifc elements"""
bl_idname = "bim.aggregate_unassign_object" bl_idname = "bim.aggregate_unassign_object"
@@ -106,7 +99,7 @@ class BIM_OT_aggregate_unassign_object(bpy.types.Operator, Operator):
ifcopenshell.api.run("pset.remove_pset", tool.Ifc.get(), product=element, pset=pset) ifcopenshell.api.run("pset.remove_pset", tool.Ifc.get(), product=element, pset=pset)
class BIM_OT_enable_editing_aggregate(bpy.types.Operator, Operator): class BIM_OT_enable_editing_aggregate(bpy.types.Operator, tool.Ifc.Operator):
"""Enable editing aggregation relationship""" """Enable editing aggregation relationship"""
bl_idname = "bim.enable_editing_aggregate" bl_idname = "bim.enable_editing_aggregate"
@@ -117,7 +110,7 @@ class BIM_OT_enable_editing_aggregate(bpy.types.Operator, Operator):
core.enable_editing_aggregate(tool.Aggregate, obj=context.active_object) core.enable_editing_aggregate(tool.Aggregate, obj=context.active_object)
class BIM_OT_disable_editing_aggregate(bpy.types.Operator, Operator): class BIM_OT_disable_editing_aggregate(bpy.types.Operator, tool.Ifc.Operator):
"""Disable editing aggregation relationship""" """Disable editing aggregation relationship"""
bl_idname = "bim.disable_editing_aggregate" bl_idname = "bim.disable_editing_aggregate"
@@ -268,7 +261,7 @@ class BIM_OT_select_aggregate(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class BIM_OT_add_part_to_object(bpy.types.Operator, Operator): class BIM_OT_add_part_to_object(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_part_to_object" bl_idname = "bim.add_part_to_object"
bl_label = "Add Part to Object" bl_label = "Add Part to Object"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -293,7 +286,7 @@ class BIM_OT_add_part_to_object(bpy.types.Operator, Operator):
blenderbim.core.spatial.import_spatial_decomposition(tool.Spatial) blenderbim.core.spatial.import_spatial_decomposition(tool.Spatial)
class BIM_OT_break_link_to_other_aggregates(bpy.types.Operator, Operator): class BIM_OT_break_link_to_other_aggregates(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.break_link_to_other_aggregates" bl_idname = "bim.break_link_to_other_aggregates"
bl_label = "Break link to other aggregates" bl_label = "Break link to other aggregates"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -324,7 +317,7 @@ class BIM_OT_break_link_to_other_aggregates(bpy.types.Operator, Operator):
return {"FINISHED"} return {"FINISHED"}
class BIM_OT_select_linked_aggregates(bpy.types.Operator, Operator): class BIM_OT_select_linked_aggregates(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.select_linked_aggregates" bl_idname = "bim.select_linked_aggregates"
bl_label = "Select linked aggregates" bl_label = "Select linked aggregates"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -28,13 +28,6 @@ import blenderbim.core.attribute as core
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
class Operator:
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class EnableEditingAttributes(bpy.types.Operator): class EnableEditingAttributes(bpy.types.Operator):
bl_idname = "bim.enable_editing_attributes" bl_idname = "bim.enable_editing_attributes"
bl_label = "Enable Editing Attributes" bl_label = "Enable Editing Attributes"
@@ -89,7 +82,7 @@ class DisableEditingAttributes(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class EditAttributes(bpy.types.Operator, Operator): class EditAttributes(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_attributes" bl_idname = "bim.edit_attributes"
bl_label = "Edit Attributes" bl_label = "Edit Attributes"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -118,7 +111,7 @@ class EditAttributes(bpy.types.Operator, Operator):
return {"FINISHED"} return {"FINISHED"}
class GenerateGlobalId(bpy.types.Operator, Operator): class GenerateGlobalId(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.generate_global_id" bl_idname = "bim.generate_global_id"
bl_label = "Regenerate GlobalId" bl_label = "Regenerate GlobalId"
bl_description = "Regenerate GlobalId\n\nSHIFT+CLICK to regenerate GlobalIds for all selected objects" bl_description = "Regenerate GlobalId\n\nSHIFT+CLICK to regenerate GlobalIds for all selected objects"
@@ -161,7 +154,7 @@ class GenerateGlobalId(bpy.types.Operator, Operator):
return {"FINISHED"} return {"FINISHED"}
class CopyAttributeToSelection(bpy.types.Operator, Operator): class CopyAttributeToSelection(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.copy_attribute_to_selection" bl_idname = "bim.copy_attribute_to_selection"
bl_label = "Copy Attribute To Selection" bl_label = "Copy Attribute To Selection"
name: bpy.props.StringProperty() name: bpy.props.StringProperty()
@@ -26,14 +26,7 @@ from blenderbim.bim.ifc import IfcStore
from blenderbim.tool.brick import BrickStore from blenderbim.tool.brick import BrickStore
class Operator: class LoadBrickProject(bpy.types.Operator, tool.Ifc.Operator):
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class LoadBrickProject(bpy.types.Operator, Operator):
bl_idname = "bim.load_brick_project" bl_idname = "bim.load_brick_project"
bl_label = "Load Brickschema Project" bl_label = "Load Brickschema Project"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -53,7 +46,7 @@ class LoadBrickProject(bpy.types.Operator, Operator):
return {"RUNNING_MODAL"} return {"RUNNING_MODAL"}
class ViewBrickClass(bpy.types.Operator, Operator): class ViewBrickClass(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.view_brick_class" bl_idname = "bim.view_brick_class"
bl_label = "View Brick Class" bl_label = "View Brick Class"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -65,7 +58,7 @@ class ViewBrickClass(bpy.types.Operator, Operator):
core.view_brick_class(tool.Brick, brick_class=self.brick_class, split_screen=self.split_screen) core.view_brick_class(tool.Brick, brick_class=self.brick_class, split_screen=self.split_screen)
class ViewBrickItem(bpy.types.Operator, Operator): class ViewBrickItem(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.view_brick_item" bl_idname = "bim.view_brick_item"
bl_label = "View Brick Item" bl_label = "View Brick Item"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -80,7 +73,7 @@ class ViewBrickItem(bpy.types.Operator, Operator):
self.report({'ERROR'}, f'Could not find {self.item}') self.report({'ERROR'}, f'Could not find {self.item}')
class RewindBrickClass(bpy.types.Operator, Operator): class RewindBrickClass(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.rewind_brick_class" bl_idname = "bim.rewind_brick_class"
bl_label = "Rewind Brick Class" bl_label = "Rewind Brick Class"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -91,7 +84,7 @@ class RewindBrickClass(bpy.types.Operator, Operator):
core.rewind_brick_class(tool.Brick, split_screen=self.split_screen) core.rewind_brick_class(tool.Brick, split_screen=self.split_screen)
class CloseBrickProject(bpy.types.Operator, Operator): class CloseBrickProject(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.close_brick_project" bl_idname = "bim.close_brick_project"
bl_label = "Close Brick Project" bl_label = "Close Brick Project"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -101,7 +94,7 @@ class CloseBrickProject(bpy.types.Operator, Operator):
core.close_brick_project(tool.Brick) core.close_brick_project(tool.Brick)
class ConvertBrickProject(bpy.types.Operator, Operator): class ConvertBrickProject(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.convert_brick_project" bl_idname = "bim.convert_brick_project"
bl_label = "Convert Brick Project" bl_label = "Convert Brick Project"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -111,7 +104,7 @@ class ConvertBrickProject(bpy.types.Operator, Operator):
core.convert_brick_project(tool.Ifc, tool.Brick) core.convert_brick_project(tool.Ifc, tool.Brick)
class AssignBrickReference(bpy.types.Operator, Operator): class AssignBrickReference(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.assign_brick_reference" bl_idname = "bim.assign_brick_reference"
bl_label = "Assign Brick Reference" bl_label = "Assign Brick Reference"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -136,7 +129,7 @@ class AssignBrickReference(bpy.types.Operator, Operator):
) )
class AddBrick(bpy.types.Operator, Operator): class AddBrick(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_brick" bl_idname = "bim.add_brick"
bl_label = "Add Brick" bl_label = "Add Brick"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -155,7 +148,7 @@ class AddBrick(bpy.types.Operator, Operator):
) )
class AddBrickRelation(bpy.types.Operator, Operator): class AddBrickRelation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_brick_relation" bl_idname = "bim.add_brick_relation"
bl_label = "Add Brick Relation" bl_label = "Add Brick Relation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -178,7 +171,7 @@ class AddBrickRelation(bpy.types.Operator, Operator):
) )
class ConvertIfcToBrick(bpy.types.Operator, Operator): class ConvertIfcToBrick(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.convert_ifc_to_brick" bl_idname = "bim.convert_ifc_to_brick"
bl_label = "Convert IFC To Brick" bl_label = "Convert IFC To Brick"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -225,7 +218,7 @@ class NewBrickFile(bpy.types.Operator):
BrickStore.graph = data["graph"] BrickStore.graph = data["graph"]
class RefreshBrickViewer(bpy.types.Operator, Operator): class RefreshBrickViewer(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.refresh_brick_viewer" bl_idname = "bim.refresh_brick_viewer"
bl_label = "Refresh Brick Viewer" bl_label = "Refresh Brick Viewer"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -235,7 +228,7 @@ class RefreshBrickViewer(bpy.types.Operator, Operator):
core.refresh_brick_viewer(tool.Brick) core.refresh_brick_viewer(tool.Brick)
class RemoveBrick(bpy.types.Operator, Operator): class RemoveBrick(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_brick" bl_idname = "bim.remove_brick"
bl_label = "Remove Brick" bl_label = "Remove Brick"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -279,7 +272,7 @@ class SerializeBrick(bpy.types.Operator):
return "Save the Brick project" return "Save the Brick project"
class AddBrickNamespace(bpy.types.Operator, Operator): class AddBrickNamespace(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_brick_namespace" bl_idname = "bim.add_brick_namespace"
bl_label = "Add Brick Namespace" bl_label = "Add Brick Namespace"
bl_description = "Bind a new namespace to the Brick project" bl_description = "Bind a new namespace to the Brick project"
@@ -291,7 +284,7 @@ class AddBrickNamespace(bpy.types.Operator, Operator):
core.add_brick_namespace(tool.Brick, alias=alias, uri=uri) core.add_brick_namespace(tool.Brick, alias=alias, uri=uri)
class RemoveBrickRelation(bpy.types.Operator, Operator): class RemoveBrickRelation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_brick_relation" bl_idname = "bim.remove_brick_relation"
bl_label = "Remove Relation" bl_label = "Remove Relation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -302,4 +295,4 @@ class RemoveBrickRelation(bpy.types.Operator, Operator):
def _execute(self, context): def _execute(self, context):
props = context.scene.BIMBrickProperties props = context.scene.BIMBrickProperties
brick = props.bricks[props.active_brick_index] brick = props.bricks[props.active_brick_index]
core.remove_brick_relation(tool.Brick, brick_uri=brick.uri, predicate=self.predicate, object=self.object) core.remove_brick_relation(tool.Brick, brick_uri=brick.uri, predicate=self.predicate, object=self.object)
@@ -24,14 +24,7 @@ import blenderbim.bim.handler
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
class Operator: class AddContext(bpy.types.Operator, tool.Ifc.Operator):
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class AddContext(bpy.types.Operator, Operator):
bl_idname = "bim.add_context" bl_idname = "bim.add_context"
bl_label = "Add Subcontext" bl_label = "Add Subcontext"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -50,7 +43,7 @@ class AddContext(bpy.types.Operator, Operator):
) )
class RemoveContext(bpy.types.Operator, Operator): class RemoveContext(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_context" bl_idname = "bim.remove_context"
bl_label = "Remove Context" bl_label = "Remove Context"
bl_description = ( bl_description = (
@@ -64,7 +57,7 @@ class RemoveContext(bpy.types.Operator, Operator):
core.remove_context(tool.Ifc, context=tool.Ifc.get().by_id(self.context)) core.remove_context(tool.Ifc, context=tool.Ifc.get().by_id(self.context))
class EnableEditingContext(bpy.types.Operator, Operator): class EnableEditingContext(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_context" bl_idname = "bim.enable_editing_context"
bl_label = "Enable Editing Context" bl_label = "Enable Editing Context"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -74,7 +67,7 @@ class EnableEditingContext(bpy.types.Operator, Operator):
core.enable_editing_context(tool.Context, context=tool.Ifc.get().by_id(self.context)) core.enable_editing_context(tool.Context, context=tool.Ifc.get().by_id(self.context))
class DisableEditingContext(bpy.types.Operator, Operator): class DisableEditingContext(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_context" bl_idname = "bim.disable_editing_context"
bl_label = "Disable Editing Context" bl_label = "Disable Editing Context"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -83,7 +76,7 @@ class DisableEditingContext(bpy.types.Operator, Operator):
core.disable_editing_context(tool.Context) core.disable_editing_context(tool.Context)
class EditContext(bpy.types.Operator, Operator): class EditContext(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_context" bl_idname = "bim.edit_context"
bl_label = "Edit Context" bl_label = "Edit Context"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -28,14 +28,6 @@ from blenderbim.bim.ifc import IfcStore
import blenderbim.bim.handler import blenderbim.bim.handler
# declaring it here to avoid circular import problems
class Operator:
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class CoveringTool(WorkSpaceTool): class CoveringTool(WorkSpaceTool):
bl_space_type = "VIEW_3D" bl_space_type = "VIEW_3D"
bl_context_mode = "OBJECT" bl_context_mode = "OBJECT"
@@ -153,7 +145,7 @@ class CoveringToolUI:
op.ifc_class = cls.props.ifc_class op.ifc_class = cls.props.ifc_class
class Hotkey(bpy.types.Operator, Operator): class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.covering_hotkey" bl_idname = "bim.covering_hotkey"
bl_label = "Hotkey" bl_label = "Hotkey"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -73,19 +73,12 @@ class profile:
print(self.task, timer() - self.start) print(self.task, timer() - self.start)
class Operator:
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class LineworkContexts(NamedTuple): class LineworkContexts(NamedTuple):
body: List[List[int]] body: List[List[int]]
annotation: List[List[int]] annotation: List[List[int]]
class AddAnnotationType(bpy.types.Operator, Operator): class AddAnnotationType(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_annotation_type" bl_idname = "bim.add_annotation_type"
bl_label = "Add Annotation Type" bl_label = "Add Annotation Type"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -116,7 +109,7 @@ class AddAnnotationType(bpy.types.Operator, Operator):
bpy.ops.bim.add_reference_image("INVOKE_DEFAULT", use_existing_object_by_name=obj.name) bpy.ops.bim.add_reference_image("INVOKE_DEFAULT", use_existing_object_by_name=obj.name)
class EnableAddAnnotationType(bpy.types.Operator, Operator): class EnableAddAnnotationType(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_add_annotation_type" bl_idname = "bim.enable_add_annotation_type"
bl_label = "Enable Add Annotation Type" bl_label = "Enable Add Annotation Type"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -125,7 +118,7 @@ class EnableAddAnnotationType(bpy.types.Operator, Operator):
bpy.context.scene.BIMAnnotationProperties.is_adding_type = True bpy.context.scene.BIMAnnotationProperties.is_adding_type = True
class DisableAddAnnotationType(bpy.types.Operator, Operator): class DisableAddAnnotationType(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_add_annotation_type" bl_idname = "bim.disable_add_annotation_type"
bl_label = "Disable Add Annotation Type" bl_label = "Disable Add Annotation Type"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -134,7 +127,7 @@ class DisableAddAnnotationType(bpy.types.Operator, Operator):
bpy.context.scene.BIMAnnotationProperties.is_adding_type = False bpy.context.scene.BIMAnnotationProperties.is_adding_type = False
class AddDrawing(bpy.types.Operator, Operator): class AddDrawing(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_drawing" bl_idname = "bim.add_drawing"
bl_label = "Add Drawing" bl_label = "Add Drawing"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -158,7 +151,7 @@ class AddDrawing(bpy.types.Operator, Operator):
pass pass
class DuplicateDrawing(bpy.types.Operator, Operator): class DuplicateDrawing(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.duplicate_drawing" bl_idname = "bim.duplicate_drawing"
bl_label = "Duplicate Drawing" bl_label = "Duplicate Drawing"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1185,7 +1178,7 @@ class CreateDrawing(bpy.types.Operator):
return drawing_path return drawing_path
class AddAnnotation(bpy.types.Operator, Operator): class AddAnnotation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_annotation" bl_idname = "bim.add_annotation"
bl_label = "Add Annotation" bl_label = "Add Annotation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1212,7 +1205,7 @@ class AddAnnotation(bpy.types.Operator, Operator):
self.report({"WARNING"}, r) self.report({"WARNING"}, r)
class AddSheet(bpy.types.Operator, Operator): class AddSheet(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_sheet" bl_idname = "bim.add_sheet"
bl_label = "Add Sheet" bl_label = "Add Sheet"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1221,7 +1214,7 @@ class AddSheet(bpy.types.Operator, Operator):
core.add_sheet(tool.Ifc, tool.Drawing, titleblock=context.scene.DocProperties.titleblock) core.add_sheet(tool.Ifc, tool.Drawing, titleblock=context.scene.DocProperties.titleblock)
class OpenSheet(bpy.types.Operator, Operator): class OpenSheet(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.open_sheet" bl_idname = "bim.open_sheet"
bl_label = "Open Sheet Layout" bl_label = "Open Sheet Layout"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1234,7 +1227,7 @@ class OpenSheet(bpy.types.Operator, Operator):
core.open_sheet(tool.Drawing, sheet=sheet) core.open_sheet(tool.Drawing, sheet=sheet)
class AddDrawingToSheet(bpy.types.Operator, Operator): class AddDrawingToSheet(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_drawing_to_sheet" bl_idname = "bim.add_drawing_to_sheet"
bl_label = "Add Drawing To Sheet" bl_label = "Add Drawing To Sheet"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1286,7 +1279,7 @@ class AddDrawingToSheet(bpy.types.Operator, Operator):
tool.Drawing.import_sheets() tool.Drawing.import_sheets()
class RemoveDrawingFromSheet(bpy.types.Operator, Operator): class RemoveDrawingFromSheet(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_drawing_from_sheet" bl_idname = "bim.remove_drawing_from_sheet"
bl_label = "Remove Drawing From Sheet" bl_label = "Remove Drawing From Sheet"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1305,7 +1298,7 @@ class RemoveDrawingFromSheet(bpy.types.Operator, Operator):
tool.Drawing.import_sheets() tool.Drawing.import_sheets()
class CreateSheets(bpy.types.Operator, Operator): class CreateSheets(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.create_sheets" bl_idname = "bim.create_sheets"
bl_label = "Create Sheets" bl_label = "Create Sheets"
bl_description = "Build a sheet from the sheet layout" bl_description = "Build a sheet from the sheet layout"
@@ -1598,7 +1591,7 @@ class ResizeText(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class RemoveDrawing(bpy.types.Operator, Operator): class RemoveDrawing(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_drawing" bl_idname = "bim.remove_drawing"
bl_label = "Remove Drawing" bl_label = "Remove Drawing"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1701,7 +1694,7 @@ class ReloadDrawingStyles(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class AddDrawingStyle(bpy.types.Operator, Operator): class AddDrawingStyle(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_drawing_style" bl_idname = "bim.add_drawing_style"
bl_label = "Add Drawing Style" bl_label = "Add Drawing Style"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1715,7 +1708,7 @@ class AddDrawingStyle(bpy.types.Operator, Operator):
return {"FINISHED"} return {"FINISHED"}
class RemoveDrawingStyle(bpy.types.Operator, Operator): class RemoveDrawingStyle(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_drawing_style" bl_idname = "bim.remove_drawing_style"
bl_label = "Remove Drawing Style" bl_label = "Remove Drawing Style"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1728,7 +1721,7 @@ class RemoveDrawingStyle(bpy.types.Operator, Operator):
return {"FINISHED"} return {"FINISHED"}
class SaveDrawingStyle(bpy.types.Operator, Operator): class SaveDrawingStyle(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.save_drawing_style" bl_idname = "bim.save_drawing_style"
bl_label = "Save Drawing Style" bl_label = "Save Drawing Style"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1793,7 +1786,7 @@ class SaveDrawingStyle(bpy.types.Operator, Operator):
return space return space
class SaveDrawingStylesData(bpy.types.Operator, Operator): class SaveDrawingStylesData(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.save_drawing_styles_data" bl_idname = "bim.save_drawing_styles_data"
bl_label = "Save Drawing Styles Data" bl_label = "Save Drawing Styles Data"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1846,7 +1839,7 @@ class SaveDrawingStylesData(bpy.types.Operator, Operator):
return {"FINISHED"} return {"FINISHED"}
class ActivateDrawingStyle(bpy.types.Operator, Operator): class ActivateDrawingStyle(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.activate_drawing_style" bl_idname = "bim.activate_drawing_style"
bl_label = "Activate Drawing Style" bl_label = "Activate Drawing Style"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1935,7 +1928,7 @@ class ActivateDrawingStyle(bpy.types.Operator, Operator):
return space return space
class RemoveSheet(bpy.types.Operator, Operator): class RemoveSheet(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_sheet" bl_idname = "bim.remove_sheet"
bl_label = "Remove Sheet" bl_label = "Remove Sheet"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1945,7 +1938,7 @@ class RemoveSheet(bpy.types.Operator, Operator):
core.remove_sheet(tool.Ifc, tool.Drawing, sheet=tool.Ifc.get().by_id(self.sheet)) core.remove_sheet(tool.Ifc, tool.Drawing, sheet=tool.Ifc.get().by_id(self.sheet))
class AddSchedule(bpy.types.Operator, Operator): class AddSchedule(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_schedule" bl_idname = "bim.add_schedule"
bl_label = "Add Schedule" bl_label = "Add Schedule"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1975,7 +1968,7 @@ class AddSchedule(bpy.types.Operator, Operator):
return {"RUNNING_MODAL"} return {"RUNNING_MODAL"}
class RemoveSchedule(bpy.types.Operator, Operator): class RemoveSchedule(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_schedule" bl_idname = "bim.remove_schedule"
bl_label = "Remove Schedule" bl_label = "Remove Schedule"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1985,7 +1978,7 @@ class RemoveSchedule(bpy.types.Operator, Operator):
core.remove_document(tool.Ifc, tool.Drawing, "SCHEDULE", document=tool.Ifc.get().by_id(self.schedule)) core.remove_document(tool.Ifc, tool.Drawing, "SCHEDULE", document=tool.Ifc.get().by_id(self.schedule))
class OpenSchedule(bpy.types.Operator, Operator): class OpenSchedule(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.open_schedule" bl_idname = "bim.open_schedule"
bl_label = "Open Schedule" bl_label = "Open Schedule"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1995,7 +1988,7 @@ class OpenSchedule(bpy.types.Operator, Operator):
core.open_schedule(tool.Drawing, schedule=tool.Ifc.get().by_id(self.schedule)) core.open_schedule(tool.Drawing, schedule=tool.Ifc.get().by_id(self.schedule))
class BuildSchedule(bpy.types.Operator, Operator): class BuildSchedule(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.build_schedule" bl_idname = "bim.build_schedule"
bl_label = "Build Schedule" bl_label = "Build Schedule"
schedule: bpy.props.IntProperty() schedule: bpy.props.IntProperty()
@@ -2004,7 +1997,7 @@ class BuildSchedule(bpy.types.Operator, Operator):
core.build_schedule(tool.Drawing, schedule=tool.Ifc.get().by_id(self.schedule)) core.build_schedule(tool.Drawing, schedule=tool.Ifc.get().by_id(self.schedule))
class AddScheduleToSheet(bpy.types.Operator, Operator): class AddScheduleToSheet(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_schedule_to_sheet" bl_idname = "bim.add_schedule_to_sheet"
bl_label = "Add Schedule To Sheet" bl_label = "Add Schedule To Sheet"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2060,7 +2053,7 @@ class AddScheduleToSheet(bpy.types.Operator, Operator):
tool.Drawing.import_sheets() tool.Drawing.import_sheets()
class AddReferenceToSheet(bpy.types.Operator, Operator): class AddReferenceToSheet(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_reference_to_sheet" bl_idname = "bim.add_reference_to_sheet"
bl_label = "Add Reference To Sheet" bl_label = "Add Reference To Sheet"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2117,7 +2110,7 @@ class AddReferenceToSheet(bpy.types.Operator, Operator):
tool.Drawing.import_sheets() tool.Drawing.import_sheets()
class AddReference(bpy.types.Operator, Operator): class AddReference(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_reference" bl_idname = "bim.add_reference"
bl_label = "Add Reference" bl_label = "Add Reference"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2147,7 +2140,7 @@ class AddReference(bpy.types.Operator, Operator):
return {"RUNNING_MODAL"} return {"RUNNING_MODAL"}
class RemoveReference(bpy.types.Operator, Operator): class RemoveReference(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_reference" bl_idname = "bim.remove_reference"
bl_label = "Remove Reference" bl_label = "Remove Reference"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2157,7 +2150,7 @@ class RemoveReference(bpy.types.Operator, Operator):
core.remove_document(tool.Ifc, tool.Drawing, "REFERENCE", document=tool.Ifc.get().by_id(self.reference)) core.remove_document(tool.Ifc, tool.Drawing, "REFERENCE", document=tool.Ifc.get().by_id(self.reference))
class OpenReference(bpy.types.Operator, Operator): class OpenReference(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.open_reference" bl_idname = "bim.open_reference"
bl_label = "Open Reference" bl_label = "Open Reference"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2270,7 +2263,7 @@ class EditTextPopup(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class EditText(bpy.types.Operator, Operator): class EditText(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_text" bl_idname = "bim.edit_text"
bl_label = "Edit Text" bl_label = "Edit Text"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2280,7 +2273,7 @@ class EditText(bpy.types.Operator, Operator):
tool.Blender.update_viewport() tool.Blender.update_viewport()
class EnableEditingText(bpy.types.Operator, Operator): class EnableEditingText(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_text" bl_idname = "bim.enable_editing_text"
bl_label = "Enable Editing Text" bl_label = "Enable Editing Text"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2289,7 +2282,7 @@ class EnableEditingText(bpy.types.Operator, Operator):
core.enable_editing_text(tool.Drawing, obj=context.active_object) core.enable_editing_text(tool.Drawing, obj=context.active_object)
class DisableEditingText(bpy.types.Operator, Operator): class DisableEditingText(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_text" bl_idname = "bim.disable_editing_text"
bl_label = "Disable Editing Text" bl_label = "Disable Editing Text"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2407,7 +2400,7 @@ class AssignSelectedObjectAsProduct(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class EditAssignedProduct(bpy.types.Operator, Operator): class EditAssignedProduct(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_assigned_product" bl_idname = "bim.edit_assigned_product"
bl_label = "Edit Text Product" bl_label = "Edit Text Product"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2420,7 +2413,7 @@ class EditAssignedProduct(bpy.types.Operator, Operator):
tool.Blender.update_viewport() tool.Blender.update_viewport()
class EnableEditingAssignedProduct(bpy.types.Operator, Operator): class EnableEditingAssignedProduct(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_assigned_product" bl_idname = "bim.enable_editing_assigned_product"
bl_label = "Enable Editing Assigned Product" bl_label = "Enable Editing Assigned Product"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2429,7 +2422,7 @@ class EnableEditingAssignedProduct(bpy.types.Operator, Operator):
core.enable_editing_assigned_product(tool.Drawing, obj=context.active_object) core.enable_editing_assigned_product(tool.Drawing, obj=context.active_object)
class DisableEditingAssignedProduct(bpy.types.Operator, Operator): class DisableEditingAssignedProduct(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_assigned_product" bl_idname = "bim.disable_editing_assigned_product"
bl_label = "Disable Editing Assigned Product" bl_label = "Disable Editing Assigned Product"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2438,7 +2431,7 @@ class DisableEditingAssignedProduct(bpy.types.Operator, Operator):
core.disable_editing_assigned_product(tool.Drawing, obj=context.active_object) core.disable_editing_assigned_product(tool.Drawing, obj=context.active_object)
class LoadSheets(bpy.types.Operator, Operator): class LoadSheets(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.load_sheets" bl_idname = "bim.load_sheets"
bl_label = "Load Sheets" bl_label = "Load Sheets"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2465,7 +2458,7 @@ class LoadSheets(bpy.types.Operator, Operator):
self.report({"ERROR"}, "Some sheets svg files are missing:\n" + "\n".join(sheets_not_found)) self.report({"ERROR"}, "Some sheets svg files are missing:\n" + "\n".join(sheets_not_found))
class EditSheet(bpy.types.Operator, Operator): class EditSheet(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_sheet" bl_idname = "bim.edit_sheet"
bl_label = "Edit Sheet" bl_label = "Edit Sheet"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2521,7 +2514,7 @@ class EditSheet(bpy.types.Operator, Operator):
tool.Drawing.import_sheets() tool.Drawing.import_sheets()
class DisableEditingSheets(bpy.types.Operator, Operator): class DisableEditingSheets(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_sheets" bl_idname = "bim.disable_editing_sheets"
bl_label = "Disable Editing Sheets" bl_label = "Disable Editing Sheets"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2530,7 +2523,7 @@ class DisableEditingSheets(bpy.types.Operator, Operator):
core.disable_editing_sheets(tool.Drawing) core.disable_editing_sheets(tool.Drawing)
class LoadSchedules(bpy.types.Operator, Operator): class LoadSchedules(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.load_schedules" bl_idname = "bim.load_schedules"
bl_label = "Load Schedules" bl_label = "Load Schedules"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2539,7 +2532,7 @@ class LoadSchedules(bpy.types.Operator, Operator):
core.load_schedules(tool.Drawing) core.load_schedules(tool.Drawing)
class DisableEditingSchedules(bpy.types.Operator, Operator): class DisableEditingSchedules(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_schedules" bl_idname = "bim.disable_editing_schedules"
bl_label = "Disable Editing Schedules" bl_label = "Disable Editing Schedules"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2548,7 +2541,7 @@ class DisableEditingSchedules(bpy.types.Operator, Operator):
core.disable_editing_schedules(tool.Drawing) core.disable_editing_schedules(tool.Drawing)
class LoadReferences(bpy.types.Operator, Operator): class LoadReferences(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.load_references" bl_idname = "bim.load_references"
bl_label = "Load References" bl_label = "Load References"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2557,7 +2550,7 @@ class LoadReferences(bpy.types.Operator, Operator):
core.load_references(tool.Drawing) core.load_references(tool.Drawing)
class DisableEditingReferences(bpy.types.Operator, Operator): class DisableEditingReferences(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_references" bl_idname = "bim.disable_editing_references"
bl_label = "Disable Editing References" bl_label = "Disable Editing References"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2566,7 +2559,7 @@ class DisableEditingReferences(bpy.types.Operator, Operator):
core.disable_editing_references(tool.Drawing) core.disable_editing_references(tool.Drawing)
class LoadDrawings(bpy.types.Operator, Operator): class LoadDrawings(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.load_drawings" bl_idname = "bim.load_drawings"
bl_label = "Load Drawings" bl_label = "Load Drawings"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2575,7 +2568,7 @@ class LoadDrawings(bpy.types.Operator, Operator):
core.load_drawings(tool.Drawing) core.load_drawings(tool.Drawing)
class DisableEditingDrawings(bpy.types.Operator, Operator): class DisableEditingDrawings(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_drawings" bl_idname = "bim.disable_editing_drawings"
bl_label = "Disable Editing Drawings" bl_label = "Disable Editing Drawings"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2640,7 +2633,7 @@ class ContractSheet(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class SelectAssignedProduct(bpy.types.Operator, Operator): class SelectAssignedProduct(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.select_assigned_product" bl_idname = "bim.select_assigned_product"
bl_label = "Select Assigned Product" bl_label = "Select Assigned Product"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2649,7 +2642,7 @@ class SelectAssignedProduct(bpy.types.Operator, Operator):
core.select_assigned_product(tool.Drawing, context) core.select_assigned_product(tool.Drawing, context)
class EnableEditingElementFilter(bpy.types.Operator, Operator): class EnableEditingElementFilter(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_element_filter" bl_idname = "bim.enable_editing_element_filter"
bl_label = "Enable Editing Element Filter" bl_label = "Enable Editing Element Filter"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2669,7 +2662,7 @@ class EnableEditingElementFilter(bpy.types.Operator, Operator):
pass pass
class EditElementFilter(bpy.types.Operator, Operator): class EditElementFilter(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_element_filter" bl_idname = "bim.edit_element_filter"
bl_label = "Edit Element Filter" bl_label = "Edit Element Filter"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2690,7 +2683,7 @@ class EditElementFilter(bpy.types.Operator, Operator):
bpy.ops.bim.activate_drawing(drawing=element.id(), camera_view_point=False) bpy.ops.bim.activate_drawing(drawing=element.id(), camera_view_point=False)
class AddReferenceImage(bpy.types.Operator, Operator): class AddReferenceImage(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_reference_image" bl_idname = "bim.add_reference_image"
bl_label = "Add Reference Image" bl_label = "Add Reference Image"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -506,31 +506,9 @@ class BIMAssignedProductProperties(PropertyGroup):
relating_product: PointerProperty(name="Relating Product", type=bpy.types.Object) relating_product: PointerProperty(name="Relating Product", type=bpy.types.Object)
# ObjectType: annotation_name, description, icon, data_type annotation_classes = [
# fmt: off (x, *tool.Drawing.ANNOTATION_TYPES_DATA[x][:3], i) for i, x in enumerate(tool.Drawing.ANNOTATION_TYPES_DATA)
ANNOTATION_TYPES_DATA = { ]
"DIMENSION": ("Dimension", "Add dimensions annotation.\nMeasurement values can be hidden through ShowDescriptionOnly property\nof BBIM_Dimension property set", "FIXED_SIZE", "curve"),
"ANGLE": ("Angle", "", "DRIVER_ROTATIONAL_DIFFERENCE", "curve"),
"RADIUS": ("Radius", "", "FORWARD", "curve"),
"DIAMETER": ("Diameter", "Add diameter annotation.\nMeasurement values can be hidden through ShowDescriptionOnly property\nof BBIM_Dimension property set", "ARROW_LEFTRIGHT", "curve"),
"TEXT": ("Text", "", "SMALL_CAPS", "empty"),
"TEXT_LEADER": ("Leader", "", "TRACKING_BACKWARDS", "curve"),
"STAIR_ARROW": ("Stair Arrow", "Add stair arrow annotation.\nIf you have IfcStairFlight object selected, it will be used as a reference for the annotation", "SCREEN_BACK", "curve"),
"PLAN_LEVEL": ("Level (Plan)", "", "SORTBYEXT", "curve"),
"SECTION_LEVEL": ("Level (Section)", "", "TRIA_DOWN", "curve"),
"BREAKLINE": ("Breakline", "", "FCURVE", "mesh"),
"SYMBOL": ("Symbol", "", "KEYFRAME", "empty"),
"MULTI_SYMBOL": ("Multi-Symbol", "", "OUTLINER_DATA_POINTCLOUD", "mesh"),
"LINEWORK": ("Line", "", "SNAP_MIDPOINT", "mesh"),
"BATTING": ("Batting", "Add batting annotation.\nThickness could be changed through Thickness property of BBIM_Batting property set", "FORCE_FORCE", "mesh"),
"REVISION_CLOUD":("Revision Cloud", "Add revision cloud", "VOLUME_DATA", "mesh"),
"FILL_AREA": ("Fill Area", "", "NODE_TEXTURE", "mesh"),
"FALL": ("Fall", "", "SORT_ASC", "curve"),
"IMAGE": ("Image", "Add reference image attached to the drawing", "TEXTURE", "mesh"),
}
# fmt: on
annotation_classes = [(x, *ANNOTATION_TYPES_DATA[x][:3], i) for i, x in enumerate(ANNOTATION_TYPES_DATA)]
def get_relating_type_id(self, context): def get_relating_type_id(self, context):
@@ -28,7 +28,6 @@ from blenderbim.bim.module.drawing.data import (
ElementFiltersData, ElementFiltersData,
DecoratorData, DecoratorData,
) )
from blenderbim.bim.module.drawing.prop import ANNOTATION_TYPES_DATA
class BIM_PT_camera(Panel): class BIM_PT_camera(Panel):
@@ -23,21 +23,11 @@ import blenderbim.tool as tool
from blenderbim.bim.helper import prop_with_search from blenderbim.bim.helper import prop_with_search
from bpy.types import WorkSpaceTool from bpy.types import WorkSpaceTool
from blenderbim.bim.module.drawing.prop import ANNOTATION_TYPES_DATA
from blenderbim.bim.module.drawing.data import DecoratorData, AnnotationData from blenderbim.bim.module.drawing.data import DecoratorData, AnnotationData
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
import blenderbim.bim.handler import blenderbim.bim.handler
# TODO: Fix circular import.
# Declaring it here to avoid circular import problems
class Operator:
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class LaunchAnnotationTypeManager(bpy.types.Operator): class LaunchAnnotationTypeManager(bpy.types.Operator):
bl_idname = "bim.launch_annotation_type_manager" bl_idname = "bim.launch_annotation_type_manager"
bl_label = "Launch Annotation Type Manager" bl_label = "Launch Annotation Type Manager"
@@ -196,7 +186,9 @@ def create_annotation():
create_annotation_occurrence(bpy.context) create_annotation_occurrence(bpy.context)
else: else:
object_type = props.object_type object_type = props.object_type
bpy.ops.bim.add_annotation(object_type=object_type, data_type=ANNOTATION_TYPES_DATA[object_type][-1]) bpy.ops.bim.add_annotation(
object_type=object_type, data_type=tool.Drawing.ANNOTATION_TYPES_DATA[object_type][-1]
)
if props.object_type == "IMAGE": if props.object_type == "IMAGE":
bpy.ops.bim.add_reference_image( bpy.ops.bim.add_reference_image(
"INVOKE_DEFAULT", use_existing_object_by_name=bpy.context.active_object.name "INVOKE_DEFAULT", use_existing_object_by_name=bpy.context.active_object.name
@@ -266,7 +258,7 @@ class AnnotationToolUI:
) )
class Hotkey(bpy.types.Operator, Operator): class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.annotation_hotkey" bl_idname = "bim.annotation_hotkey"
bl_label = "Hotkey" bl_label = "Hotkey"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -43,14 +43,7 @@ from ifcopenshell.util.shape_builder import ShapeBuilder
from typing import Any from typing import Any
class Operator: class EditObjectPlacement(bpy.types.Operator, tool.Ifc.Operator):
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class EditObjectPlacement(bpy.types.Operator, Operator):
bl_idname = "bim.edit_object_placement" bl_idname = "bim.edit_object_placement"
bl_label = "Edit Object Placement" bl_label = "Edit Object Placement"
bl_description = ( bl_description = (
@@ -66,7 +59,7 @@ class EditObjectPlacement(bpy.types.Operator, Operator):
core.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj) core.edit_object_placement(tool.Ifc, tool.Geometry, tool.Surveyor, obj=obj)
class OverrideMeshSeparate(bpy.types.Operator, Operator): class OverrideMeshSeparate(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.override_mesh_separate" bl_idname = "bim.override_mesh_separate"
bl_label = "IFC Mesh Separate" bl_label = "IFC Mesh Separate"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -102,7 +95,7 @@ class OverrideMeshSeparate(bpy.types.Operator, Operator):
bpy.ops.bim.update_representation(obj=new_obj.name) bpy.ops.bim.update_representation(obj=new_obj.name)
class OverrideOriginSet(bpy.types.Operator, Operator): class OverrideOriginSet(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.override_origin_set" bl_idname = "bim.override_origin_set"
bl_label = "IFC Origin Set" bl_label = "IFC Origin Set"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -127,7 +120,7 @@ class OverrideOriginSet(bpy.types.Operator, Operator):
bpy.ops.bim.update_representation(obj=obj.name) bpy.ops.bim.update_representation(obj=obj.name)
class AddRepresentation(bpy.types.Operator, Operator): class AddRepresentation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_representation" bl_idname = "bim.add_representation"
bl_label = "Add Representation" bl_label = "Add Representation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -253,7 +246,7 @@ class AddRepresentation(bpy.types.Operator, Operator):
row.prop(context.scene.BIMGeometryProperties, "representation_from_object", text="") row.prop(context.scene.BIMGeometryProperties, "representation_from_object", text="")
class SelectConnection(bpy.types.Operator, Operator): class SelectConnection(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.select_connection" bl_idname = "bim.select_connection"
bl_label = "Select Connection" bl_label = "Select Connection"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -263,7 +256,7 @@ class SelectConnection(bpy.types.Operator, Operator):
core.select_connection(tool.Geometry, connection=tool.Ifc.get().by_id(self.connection)) core.select_connection(tool.Geometry, connection=tool.Ifc.get().by_id(self.connection))
class RemoveConnection(bpy.types.Operator, Operator): class RemoveConnection(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_connection" bl_idname = "bim.remove_connection"
bl_label = "Remove Connection" bl_label = "Remove Connection"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -273,7 +266,7 @@ class RemoveConnection(bpy.types.Operator, Operator):
core.remove_connection(tool.Geometry, connection=tool.Ifc.get().by_id(self.connection)) core.remove_connection(tool.Geometry, connection=tool.Ifc.get().by_id(self.connection))
class SwitchRepresentation(bpy.types.Operator, Operator): class SwitchRepresentation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.switch_representation" bl_idname = "bim.switch_representation"
bl_label = "Switch Representation" bl_label = "Switch Representation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -322,7 +315,7 @@ class SwitchRepresentation(bpy.types.Operator, Operator):
) )
class RemoveRepresentation(bpy.types.Operator, Operator): class RemoveRepresentation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_representation" bl_idname = "bim.remove_representation"
bl_label = "Remove Representation" bl_label = "Remove Representation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -337,7 +330,7 @@ class RemoveRepresentation(bpy.types.Operator, Operator):
) )
class PurgeUnusedRepresentations(bpy.types.Operator, Operator): class PurgeUnusedRepresentations(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.purge_unused_representations" bl_idname = "bim.purge_unused_representations"
bl_label = "Purge Unused Representations" bl_label = "Purge Unused Representations"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -347,7 +340,7 @@ class PurgeUnusedRepresentations(bpy.types.Operator, Operator):
self.report({"INFO"}, f"{purged_representations} representations were purged.") self.report({"INFO"}, f"{purged_representations} representations were purged.")
class UpdateRepresentation(bpy.types.Operator, Operator): class UpdateRepresentation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.update_representation" bl_idname = "bim.update_representation"
bl_label = "Update Representation" bl_label = "Update Representation"
bl_description = ( bl_description = (
@@ -363,8 +356,9 @@ class UpdateRepresentation(bpy.types.Operator, Operator):
# Ensure mode is object to prevent invalid mesh data causing CTD # Ensure mode is object to prevent invalid mesh data causing CTD
bpy.ops.object.mode_set(mode="OBJECT", toggle=False) bpy.ops.object.mode_set(mode="OBJECT", toggle=False)
objs = [bpy.data.objects.get(self.obj)] if self.obj else context.selected_objects obj_name: str = self.obj
self.file = IfcStore.get_file() objs = [bpy.data.objects[obj_name]] if obj_name else context.selected_objects
self.file = tool.Ifc.get()
for obj in objs: for obj in objs:
# TODO: write unit tests to see how this bulk operation handles # TODO: write unit tests to see how this bulk operation handles
@@ -376,7 +370,7 @@ class UpdateRepresentation(bpy.types.Operator, Operator):
tool.Ifc.finish_edit(obj) tool.Ifc.finish_edit(obj)
return {"FINISHED"} return {"FINISHED"}
def update_obj_mesh_representation(self, context, obj): def update_obj_mesh_representation(self, context: bpy.types.Context, obj: bpy.types.Object) -> None:
product = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id) product = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
material = ifcopenshell.util.element.get_material(product, should_skip_usage=True) material = ifcopenshell.util.element.get_material(product, should_skip_usage=True)
@@ -527,7 +521,7 @@ class UpdateParametricRepresentation(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class GetRepresentationIfcParameters(bpy.types.Operator, Operator): class GetRepresentationIfcParameters(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.get_representation_ifc_parameters" bl_idname = "bim.get_representation_ifc_parameters"
bl_label = "Get Representation IFC Parameters" bl_label = "Get Representation IFC Parameters"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -538,7 +532,7 @@ class GetRepresentationIfcParameters(bpy.types.Operator, Operator):
self.report({"INFO"}, f"{len(parameters)} parameters found.") self.report({"INFO"}, f"{len(parameters)} parameters found.")
class CopyRepresentation(bpy.types.Operator, Operator): class CopyRepresentation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.copy_representation" bl_idname = "bim.copy_representation"
bl_label = "Copy Representation" bl_label = "Copy Representation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1456,7 +1450,7 @@ class RefreshLinkedAggregate(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class OverrideJoin(bpy.types.Operator, Operator): class OverrideJoin(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.override_object_join" bl_idname = "bim.override_object_join"
bl_label = "IFC Join" bl_label = "IFC Join"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1820,7 +1814,7 @@ class FlipObject(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class EnableEditingRepresentationItems(bpy.types.Operator, Operator): class EnableEditingRepresentationItems(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_representation_items" bl_idname = "bim.enable_editing_representation_items"
bl_label = "Enable Editing Representation Items" bl_label = "Enable Editing Representation Items"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1871,7 +1865,7 @@ class EnableEditingRepresentationItems(bpy.types.Operator, Operator):
props.items.move(props.items[:].index(item), i) props.items.move(props.items[:].index(item), i)
class DisableEditingRepresentationItems(bpy.types.Operator, Operator): class DisableEditingRepresentationItems(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_representation_items" bl_idname = "bim.disable_editing_representation_items"
bl_label = "Disable Editing Representation Items" bl_label = "Disable Editing Representation Items"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1881,7 +1875,7 @@ class DisableEditingRepresentationItems(bpy.types.Operator, Operator):
obj.BIMGeometryProperties.is_editing = False obj.BIMGeometryProperties.is_editing = False
class RemoveRepresentationItem(bpy.types.Operator, Operator): class RemoveRepresentationItem(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_representation_item" bl_idname = "bim.remove_representation_item"
bl_label = "Remove Representation Item" bl_label = "Remove Representation Item"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1939,7 +1933,7 @@ def poll_editing_representaiton_item_style(cls, context):
return True return True
class EnableEditingRepresentationItemStyle(bpy.types.Operator, Operator): class EnableEditingRepresentationItemStyle(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_representation_item_style" bl_idname = "bim.enable_editing_representation_item_style"
bl_label = "Enable Editing Representation Item Style" bl_label = "Enable Editing Representation Item Style"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1961,7 +1955,7 @@ class EnableEditingRepresentationItemStyle(bpy.types.Operator, Operator):
props.representation_item_style = str(style.id()) props.representation_item_style = str(style.id())
class EditRepresentationItemStyle(bpy.types.Operator, Operator): class EditRepresentationItemStyle(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_representation_item_style" bl_idname = "bim.edit_representation_item_style"
bl_label = "Edit Representation Item Style" bl_label = "Edit Representation Item Style"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1983,7 +1977,7 @@ class EditRepresentationItemStyle(bpy.types.Operator, Operator):
bpy.ops.bim.enable_editing_representation_items() bpy.ops.bim.enable_editing_representation_items()
class DisableEditingRepresentationItemStyle(bpy.types.Operator, Operator): class DisableEditingRepresentationItemStyle(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_representation_item_style" bl_idname = "bim.disable_editing_representation_item_style"
bl_label = "Disable Editing Representation Item Style" bl_label = "Disable Editing Representation Item Style"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -1993,7 +1987,7 @@ class DisableEditingRepresentationItemStyle(bpy.types.Operator, Operator):
props.is_editing_item_style = False props.is_editing_item_style = False
class UnassignRepresentationItemStyle(bpy.types.Operator, Operator): class UnassignRepresentationItemStyle(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.unassign_representation_item_style" bl_idname = "bim.unassign_representation_item_style"
bl_label = "Unassign Representation Item Style" bl_label = "Unassign Representation Item Style"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2021,7 +2015,7 @@ class UnassignRepresentationItemStyle(bpy.types.Operator, Operator):
bpy.ops.bim.enable_editing_representation_items() bpy.ops.bim.enable_editing_representation_items()
class EnableEditingRepresentationItemShapeAspect(bpy.types.Operator, Operator): class EnableEditingRepresentationItemShapeAspect(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_representation_item_shape_aspect" bl_idname = "bim.enable_editing_representation_item_shape_aspect"
bl_label = "Enable Editing Representation Item Shape Aspect" bl_label = "Enable Editing Representation Item Shape Aspect"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2036,7 +2030,7 @@ class EnableEditingRepresentationItemShapeAspect(bpy.types.Operator, Operator):
props.representation_item_shape_aspect = str(shape_aspect_id) props.representation_item_shape_aspect = str(shape_aspect_id)
class EditRepresentationItemShapeAspect(bpy.types.Operator, Operator): class EditRepresentationItemShapeAspect(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_representation_item_shape_aspect" bl_idname = "bim.edit_representation_item_shape_aspect"
bl_label = "Edit Representation Item Shape Aspect" bl_label = "Edit Representation Item Shape Aspect"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2092,7 +2086,7 @@ class EditRepresentationItemShapeAspect(bpy.types.Operator, Operator):
bpy.ops.bim.enable_editing_representation_items() bpy.ops.bim.enable_editing_representation_items()
class DisableEditingRepresentationItemShapeAspect(bpy.types.Operator, Operator): class DisableEditingRepresentationItemShapeAspect(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_representation_item_shape_aspect" bl_idname = "bim.disable_editing_representation_item_shape_aspect"
bl_label = "Disable Editing Representation Item Shape Aspect" bl_label = "Disable Editing Representation Item Shape Aspect"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -2102,7 +2096,7 @@ class DisableEditingRepresentationItemShapeAspect(bpy.types.Operator, Operator):
props.is_editing_item_shape_aspect = False props.is_editing_item_shape_aspect = False
class RemoveRepresentationItemFromShapeAspect(bpy.types.Operator, Operator): class RemoveRepresentationItemFromShapeAspect(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_representation_item_from_shape_aspect" bl_idname = "bim.remove_representation_item_from_shape_aspect"
bl_label = "Remove Representation Item From Shape Aspect" bl_label = "Remove Representation Item From Shape Aspect"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -24,14 +24,7 @@ import blenderbim.bim.handler
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
class Operator: class AddLibrary(bpy.types.Operator, tool.Ifc.Operator):
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class AddLibrary(bpy.types.Operator, Operator):
bl_idname = "bim.add_library" bl_idname = "bim.add_library"
bl_label = "Add Library" bl_label = "Add Library"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -40,7 +33,7 @@ class AddLibrary(bpy.types.Operator, Operator):
core.add_library(tool.Ifc) core.add_library(tool.Ifc)
class RemoveLibrary(bpy.types.Operator, Operator): class RemoveLibrary(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_library" bl_idname = "bim.remove_library"
bl_label = "Remove Library" bl_label = "Remove Library"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -50,7 +43,7 @@ class RemoveLibrary(bpy.types.Operator, Operator):
core.remove_library(tool.Ifc, library=tool.Ifc.get().by_id(self.library)) core.remove_library(tool.Ifc, library=tool.Ifc.get().by_id(self.library))
class EnableEditingLibraryReferences(bpy.types.Operator, Operator): class EnableEditingLibraryReferences(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_library_references" bl_idname = "bim.enable_editing_library_references"
bl_label = "Enable Editing Library References" bl_label = "Enable Editing Library References"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -60,7 +53,7 @@ class EnableEditingLibraryReferences(bpy.types.Operator, Operator):
core.enable_editing_library_references(tool.Library, library=tool.Ifc.get().by_id(self.library)) core.enable_editing_library_references(tool.Library, library=tool.Ifc.get().by_id(self.library))
class DisableEditingLibraryReferences(bpy.types.Operator, Operator): class DisableEditingLibraryReferences(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_library_references" bl_idname = "bim.disable_editing_library_references"
bl_label = "Disable Editing Library References" bl_label = "Disable Editing Library References"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -69,7 +62,7 @@ class DisableEditingLibraryReferences(bpy.types.Operator, Operator):
core.disable_editing_library_references(tool.Library) core.disable_editing_library_references(tool.Library)
class EnableEditingLibrary(bpy.types.Operator, Operator): class EnableEditingLibrary(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_library" bl_idname = "bim.enable_editing_library"
bl_label = "Enable Editing Library" bl_label = "Enable Editing Library"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -78,7 +71,7 @@ class EnableEditingLibrary(bpy.types.Operator, Operator):
core.enable_editing_library(tool.Library) core.enable_editing_library(tool.Library)
class DisableEditingLibrary(bpy.types.Operator, Operator): class DisableEditingLibrary(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_library" bl_idname = "bim.disable_editing_library"
bl_label = "Disable Editing Library" bl_label = "Disable Editing Library"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -87,7 +80,7 @@ class DisableEditingLibrary(bpy.types.Operator, Operator):
core.disable_editing_library(tool.Library) core.disable_editing_library(tool.Library)
class EditLibrary(bpy.types.Operator, Operator): class EditLibrary(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_library" bl_idname = "bim.edit_library"
bl_label = "Edit Library" bl_label = "Edit Library"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -96,7 +89,7 @@ class EditLibrary(bpy.types.Operator, Operator):
core.edit_library(tool.Ifc, tool.Library) core.edit_library(tool.Ifc, tool.Library)
class AddLibraryReference(bpy.types.Operator, Operator): class AddLibraryReference(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_library_reference" bl_idname = "bim.add_library_reference"
bl_label = "Add Library Reference" bl_label = "Add Library Reference"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -105,7 +98,7 @@ class AddLibraryReference(bpy.types.Operator, Operator):
core.add_library_reference(tool.Ifc, tool.Library) core.add_library_reference(tool.Ifc, tool.Library)
class RemoveLibraryReference(bpy.types.Operator, Operator): class RemoveLibraryReference(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_library_reference" bl_idname = "bim.remove_library_reference"
bl_label = "Remove Library Reference" bl_label = "Remove Library Reference"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -115,7 +108,7 @@ class RemoveLibraryReference(bpy.types.Operator, Operator):
core.remove_library_reference(tool.Ifc, tool.Library, reference=tool.Ifc.get().by_id(self.reference)) core.remove_library_reference(tool.Ifc, tool.Library, reference=tool.Ifc.get().by_id(self.reference))
class EnableEditingLibraryReference(bpy.types.Operator, Operator): class EnableEditingLibraryReference(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_library_reference" bl_idname = "bim.enable_editing_library_reference"
bl_label = "Enable Editing Library Reference" bl_label = "Enable Editing Library Reference"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -125,7 +118,7 @@ class EnableEditingLibraryReference(bpy.types.Operator, Operator):
core.enable_editing_library_reference(tool.Library, reference=tool.Ifc.get().by_id(self.reference)) core.enable_editing_library_reference(tool.Library, reference=tool.Ifc.get().by_id(self.reference))
class DisableEditingLibraryReference(bpy.types.Operator, Operator): class DisableEditingLibraryReference(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_library_reference" bl_idname = "bim.disable_editing_library_reference"
bl_label = "Disable Editing Library Reference" bl_label = "Disable Editing Library Reference"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -134,7 +127,7 @@ class DisableEditingLibraryReference(bpy.types.Operator, Operator):
core.disable_editing_library_reference(tool.Library) core.disable_editing_library_reference(tool.Library)
class EditLibraryReference(bpy.types.Operator, Operator): class EditLibraryReference(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_library_reference" bl_idname = "bim.edit_library_reference"
bl_label = "Edit Library Reference" bl_label = "Edit Library Reference"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -143,7 +136,7 @@ class EditLibraryReference(bpy.types.Operator, Operator):
core.edit_library_reference(tool.Ifc, tool.Library) core.edit_library_reference(tool.Ifc, tool.Library)
class AssignLibraryReference(bpy.types.Operator, Operator): class AssignLibraryReference(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.assign_library_reference" bl_idname = "bim.assign_library_reference"
bl_label = "Assign Library Reference" bl_label = "Assign Library Reference"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -155,7 +148,7 @@ class AssignLibraryReference(bpy.types.Operator, Operator):
) )
class UnassignLibraryReference(bpy.types.Operator, Operator): class UnassignLibraryReference(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.unassign_library_reference" bl_idname = "bim.unassign_library_reference"
bl_label = "Unassign Library Reference" bl_label = "Unassign Library Reference"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -28,13 +28,6 @@ from blenderbim.bim.ifc import IfcStore
from mathutils import Vector, Matrix, Euler from mathutils import Vector, Matrix, Euler
class Operator:
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class SetOverrideColour(bpy.types.Operator): class SetOverrideColour(bpy.types.Operator):
bl_idname = "bim.set_override_colour" bl_idname = "bim.set_override_colour"
bl_label = "Set Override Colour" bl_label = "Set Override Colour"
@@ -117,7 +110,7 @@ class SnapSpacesTogether(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class ResizeToStorey(bpy.types.Operator, Operator): class ResizeToStorey(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.resize_to_storey" bl_idname = "bim.resize_to_storey"
bl_label = "Resize To Storey" bl_label = "Resize To Storey"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -132,7 +125,7 @@ class ResizeToStorey(bpy.types.Operator, Operator):
core.resize_to_storey(tool.Misc, obj=obj, total_storeys=self.total_storeys) core.resize_to_storey(tool.Misc, obj=obj, total_storeys=self.total_storeys)
class SplitAlongEdge(bpy.types.Operator, Operator): class SplitAlongEdge(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.split_along_edge" bl_idname = "bim.split_along_edge"
bl_label = "Split Along Edge" bl_label = "Split Along Edge"
bl_description = ( bl_description = (
@@ -206,7 +199,7 @@ class SplitAlongEdge(bpy.types.Operator, Operator):
self.report({"INFO"}, f"Splitting finished, {len(new_objs)} new objects created.") self.report({"INFO"}, f"Splitting finished, {len(new_objs)} new objects created.")
class GetConnectedSystemElements(bpy.types.Operator, Operator): class GetConnectedSystemElements(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.get_connected_system_elements" bl_idname = "bim.get_connected_system_elements"
bl_label = "Get Connected System Elements" bl_label = "Get Connected System Elements"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -258,7 +251,7 @@ class GetConnectedSystemElements(bpy.types.Operator, Operator):
obj.select_set(True) obj.select_set(True)
class DrawSystemArrows(bpy.types.Operator, Operator): class DrawSystemArrows(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.draw_system_arrows" bl_idname = "bim.draw_system_arrows"
bl_label = "Draw System Arrows" bl_label = "Draw System Arrows"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -26,14 +26,7 @@ import blenderbim.bim.handler
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
class Operator: class BIM_OT_nest_assign_object(bpy.types.Operator, tool.Ifc.Operator):
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class BIM_OT_nest_assign_object(bpy.types.Operator, Operator):
"""Create nest relationship between two ifc elements""" """Create nest relationship between two ifc elements"""
bl_idname = "bim.nest_assign_object" bl_idname = "bim.nest_assign_object"
@@ -67,7 +60,7 @@ class BIM_OT_nest_assign_object(bpy.types.Operator, Operator):
self.report({"ERROR"}, f" Cannot nest {obj.name} to {relating_obj.name}") self.report({"ERROR"}, f" Cannot nest {obj.name} to {relating_obj.name}")
class BIM_OT_nest_unassign_object(bpy.types.Operator, Operator): class BIM_OT_nest_unassign_object(bpy.types.Operator, tool.Ifc.Operator):
"""Remove nest relationship between two ifc elements""" """Remove nest relationship between two ifc elements"""
bl_idname = "bim.nest_unassign_object" bl_idname = "bim.nest_unassign_object"
@@ -91,7 +84,7 @@ class BIM_OT_nest_unassign_object(bpy.types.Operator, Operator):
) )
class BIM_OT_enable_editing_nest(bpy.types.Operator, Operator): class BIM_OT_enable_editing_nest(bpy.types.Operator, tool.Ifc.Operator):
"""Enable editing nest relationship""" """Enable editing nest relationship"""
bl_idname = "bim.enable_editing_nest" bl_idname = "bim.enable_editing_nest"
@@ -102,7 +95,7 @@ class BIM_OT_enable_editing_nest(bpy.types.Operator, Operator):
core.enable_editing_nest(tool.Nest, obj=context.active_object) core.enable_editing_nest(tool.Nest, obj=context.active_object)
class BIM_OT_disable_editing_nest(bpy.types.Operator, Operator): class BIM_OT_disable_editing_nest(bpy.types.Operator, tool.Ifc.Operator):
"""Disable editing nest relationship""" """Disable editing nest relationship"""
bl_idname = "bim.disable_editing_nest" bl_idname = "bim.disable_editing_nest"
@@ -23,14 +23,7 @@ import blenderbim.bim.handler
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
class Operator: class EnableEditingPerson(bpy.types.Operator, tool.Ifc.Operator):
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class EnableEditingPerson(bpy.types.Operator, Operator):
bl_idname = "bim.enable_editing_person" bl_idname = "bim.enable_editing_person"
bl_label = "Enable Editing Person" bl_label = "Enable Editing Person"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -40,7 +33,7 @@ class EnableEditingPerson(bpy.types.Operator, Operator):
core.enable_editing_person(tool.Owner, person=tool.Ifc.get().by_id(self.person)) core.enable_editing_person(tool.Owner, person=tool.Ifc.get().by_id(self.person))
class DisableEditingPerson(bpy.types.Operator, Operator): class DisableEditingPerson(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_person" bl_idname = "bim.disable_editing_person"
bl_label = "Disable Editing Person" bl_label = "Disable Editing Person"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -49,7 +42,7 @@ class DisableEditingPerson(bpy.types.Operator, Operator):
core.disable_editing_person(tool.Owner) core.disable_editing_person(tool.Owner)
class AddPerson(bpy.types.Operator, Operator): class AddPerson(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_person" bl_idname = "bim.add_person"
bl_label = "Add Person" bl_label = "Add Person"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -58,7 +51,7 @@ class AddPerson(bpy.types.Operator, Operator):
core.add_person(tool.Ifc) core.add_person(tool.Ifc)
class EditPerson(bpy.types.Operator, Operator): class EditPerson(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_person" bl_idname = "bim.edit_person"
bl_label = "Edit Person" bl_label = "Edit Person"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -67,7 +60,7 @@ class EditPerson(bpy.types.Operator, Operator):
core.edit_person(tool.Ifc, tool.Owner) core.edit_person(tool.Ifc, tool.Owner)
class RemovePerson(bpy.types.Operator, Operator): class RemovePerson(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_person" bl_idname = "bim.remove_person"
bl_label = "Remove Person" bl_label = "Remove Person"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -77,7 +70,7 @@ class RemovePerson(bpy.types.Operator, Operator):
core.remove_person(tool.Ifc, person=tool.Ifc.get().by_id(self.person)) core.remove_person(tool.Ifc, person=tool.Ifc.get().by_id(self.person))
class AddPersonAttribute(bpy.types.Operator, Operator): class AddPersonAttribute(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_person_attribute" bl_idname = "bim.add_person_attribute"
bl_label = "Add Person Attribute" bl_label = "Add Person Attribute"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -87,7 +80,7 @@ class AddPersonAttribute(bpy.types.Operator, Operator):
core.add_person_attribute(tool.Owner, name=self.name) core.add_person_attribute(tool.Owner, name=self.name)
class RemovePersonAttribute(bpy.types.Operator, Operator): class RemovePersonAttribute(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_person_attribute" bl_idname = "bim.remove_person_attribute"
bl_label = "Remove Person Attribute" bl_label = "Remove Person Attribute"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -98,7 +91,7 @@ class RemovePersonAttribute(bpy.types.Operator, Operator):
core.remove_person_attribute(tool.Owner, name=self.name, id=self.id) core.remove_person_attribute(tool.Owner, name=self.name, id=self.id)
class EnableEditingRole(bpy.types.Operator, Operator): class EnableEditingRole(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_role" bl_idname = "bim.enable_editing_role"
bl_label = "Enable Editing Role" bl_label = "Enable Editing Role"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -108,7 +101,7 @@ class EnableEditingRole(bpy.types.Operator, Operator):
core.enable_editing_role(tool.Owner, role=tool.Ifc.get().by_id(self.role)) core.enable_editing_role(tool.Owner, role=tool.Ifc.get().by_id(self.role))
class DisableEditingRole(bpy.types.Operator, Operator): class DisableEditingRole(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_role" bl_idname = "bim.disable_editing_role"
bl_label = "Disable Editing Role" bl_label = "Disable Editing Role"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -117,7 +110,7 @@ class DisableEditingRole(bpy.types.Operator, Operator):
core.disable_editing_role(tool.Owner) core.disable_editing_role(tool.Owner)
class AddRole(bpy.types.Operator, Operator): class AddRole(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_role" bl_idname = "bim.add_role"
bl_label = "Add Role" bl_label = "Add Role"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -127,7 +120,7 @@ class AddRole(bpy.types.Operator, Operator):
core.add_role(tool.Ifc, parent=tool.Ifc.get().by_id(self.parent)) core.add_role(tool.Ifc, parent=tool.Ifc.get().by_id(self.parent))
class EditRole(bpy.types.Operator, Operator): class EditRole(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_role" bl_idname = "bim.edit_role"
bl_label = "Edit Role" bl_label = "Edit Role"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -136,7 +129,7 @@ class EditRole(bpy.types.Operator, Operator):
core.edit_role(tool.Ifc, tool.Owner) core.edit_role(tool.Ifc, tool.Owner)
class RemoveRole(bpy.types.Operator, Operator): class RemoveRole(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_role" bl_idname = "bim.remove_role"
bl_label = "Remove Role" bl_label = "Remove Role"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -146,7 +139,7 @@ class RemoveRole(bpy.types.Operator, Operator):
core.remove_role(tool.Ifc, role=tool.Ifc.get().by_id(self.role)) core.remove_role(tool.Ifc, role=tool.Ifc.get().by_id(self.role))
class AddAddress(bpy.types.Operator, Operator): class AddAddress(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_address" bl_idname = "bim.add_address"
bl_label = "Add Address" bl_label = "Add Address"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -157,7 +150,7 @@ class AddAddress(bpy.types.Operator, Operator):
core.add_address(tool.Ifc, parent=tool.Ifc.get().by_id(self.parent), ifc_class=self.ifc_class) core.add_address(tool.Ifc, parent=tool.Ifc.get().by_id(self.parent), ifc_class=self.ifc_class)
class AddAddressAttribute(bpy.types.Operator, Operator): class AddAddressAttribute(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_address_attribute" bl_idname = "bim.add_address_attribute"
bl_label = "Add Address Attribute" bl_label = "Add Address Attribute"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -167,7 +160,7 @@ class AddAddressAttribute(bpy.types.Operator, Operator):
core.add_address_attribute(tool.Owner, name=self.name) core.add_address_attribute(tool.Owner, name=self.name)
class RemoveAddressAttribute(bpy.types.Operator, Operator): class RemoveAddressAttribute(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_address_attribute" bl_idname = "bim.remove_address_attribute"
bl_label = "Remove Address Attribute" bl_label = "Remove Address Attribute"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -178,7 +171,7 @@ class RemoveAddressAttribute(bpy.types.Operator, Operator):
core.remove_address_attribute(tool.Owner, name=self.name, id=self.id) core.remove_address_attribute(tool.Owner, name=self.name, id=self.id)
class EnableEditingAddress(bpy.types.Operator, Operator): class EnableEditingAddress(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_address" bl_idname = "bim.enable_editing_address"
bl_label = "Enable Editing Address" bl_label = "Enable Editing Address"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -188,7 +181,7 @@ class EnableEditingAddress(bpy.types.Operator, Operator):
core.enable_editing_address(tool.Owner, address=tool.Ifc.get().by_id(self.address)) core.enable_editing_address(tool.Owner, address=tool.Ifc.get().by_id(self.address))
class DisableEditingAddress(bpy.types.Operator, Operator): class DisableEditingAddress(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_address" bl_idname = "bim.disable_editing_address"
bl_label = "Disable Editing Address" bl_label = "Disable Editing Address"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -197,7 +190,7 @@ class DisableEditingAddress(bpy.types.Operator, Operator):
core.disable_editing_address(tool.Owner) core.disable_editing_address(tool.Owner)
class EditAddress(bpy.types.Operator, Operator): class EditAddress(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_address" bl_idname = "bim.edit_address"
bl_label = "Edit Address" bl_label = "Edit Address"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -206,7 +199,7 @@ class EditAddress(bpy.types.Operator, Operator):
core.edit_address(tool.Ifc, tool.Owner) core.edit_address(tool.Ifc, tool.Owner)
class RemoveAddress(bpy.types.Operator, Operator): class RemoveAddress(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_address" bl_idname = "bim.remove_address"
bl_label = "Remove Address" bl_label = "Remove Address"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -216,7 +209,7 @@ class RemoveAddress(bpy.types.Operator, Operator):
core.remove_address(tool.Ifc, address=tool.Ifc.get().by_id(self.address)) core.remove_address(tool.Ifc, address=tool.Ifc.get().by_id(self.address))
class EnableEditingOrganisation(bpy.types.Operator, Operator): class EnableEditingOrganisation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_organisation" bl_idname = "bim.enable_editing_organisation"
bl_label = "Enable Editing Organisation" bl_label = "Enable Editing Organisation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -226,7 +219,7 @@ class EnableEditingOrganisation(bpy.types.Operator, Operator):
core.enable_editing_organisation(tool.Owner, organisation=tool.Ifc.get().by_id(self.organisation)) core.enable_editing_organisation(tool.Owner, organisation=tool.Ifc.get().by_id(self.organisation))
class DisableEditingOrganisation(bpy.types.Operator, Operator): class DisableEditingOrganisation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_organisation" bl_idname = "bim.disable_editing_organisation"
bl_label = "Disable Editing Organisation" bl_label = "Disable Editing Organisation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -235,7 +228,7 @@ class DisableEditingOrganisation(bpy.types.Operator, Operator):
core.disable_editing_organisation(tool.Owner) core.disable_editing_organisation(tool.Owner)
class AddOrganisation(bpy.types.Operator, Operator): class AddOrganisation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_organisation" bl_idname = "bim.add_organisation"
bl_label = "Add Organisation" bl_label = "Add Organisation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -244,7 +237,7 @@ class AddOrganisation(bpy.types.Operator, Operator):
core.add_organisation(tool.Ifc) core.add_organisation(tool.Ifc)
class EditOrganisation(bpy.types.Operator, Operator): class EditOrganisation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_organisation" bl_idname = "bim.edit_organisation"
bl_label = "Edit Organisation" bl_label = "Edit Organisation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -253,7 +246,7 @@ class EditOrganisation(bpy.types.Operator, Operator):
core.edit_organisation(tool.Ifc, tool.Owner) core.edit_organisation(tool.Ifc, tool.Owner)
class RemoveOrganisation(bpy.types.Operator, Operator): class RemoveOrganisation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_organisation" bl_idname = "bim.remove_organisation"
bl_label = "Remove Organisation" bl_label = "Remove Organisation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -263,7 +256,7 @@ class RemoveOrganisation(bpy.types.Operator, Operator):
core.remove_organisation(tool.Ifc, tool.Ifc.get().by_id(self.organisation)) core.remove_organisation(tool.Ifc, tool.Ifc.get().by_id(self.organisation))
class AddPersonAndOrganisation(bpy.types.Operator, Operator): class AddPersonAndOrganisation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_person_and_organisation" bl_idname = "bim.add_person_and_organisation"
bl_label = "Add Person And Organisation" bl_label = "Add Person And Organisation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -276,7 +269,7 @@ class AddPersonAndOrganisation(bpy.types.Operator, Operator):
) )
class RemovePersonAndOrganisation(bpy.types.Operator, Operator): class RemovePersonAndOrganisation(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_person_and_organisation" bl_idname = "bim.remove_person_and_organisation"
bl_label = "Remove Person And Organisation" bl_label = "Remove Person And Organisation"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -288,7 +281,7 @@ class RemovePersonAndOrganisation(bpy.types.Operator, Operator):
) )
class SetUser(bpy.types.Operator, Operator): class SetUser(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.set_user" bl_idname = "bim.set_user"
bl_label = "Set User" bl_label = "Set User"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -298,7 +291,7 @@ class SetUser(bpy.types.Operator, Operator):
core.set_user(tool.Owner, user=tool.Ifc.get().by_id(self.user)) core.set_user(tool.Owner, user=tool.Ifc.get().by_id(self.user))
class ClearUser(bpy.types.Operator, Operator): class ClearUser(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.clear_user" bl_idname = "bim.clear_user"
bl_label = "Clear User" bl_label = "Clear User"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -308,7 +301,7 @@ class ClearUser(bpy.types.Operator, Operator):
core.clear_user(tool.Owner) core.clear_user(tool.Owner)
class AddActor(bpy.types.Operator, Operator): class AddActor(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_actor" bl_idname = "bim.add_actor"
bl_label = "Add Actor" bl_label = "Add Actor"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -319,7 +312,7 @@ class AddActor(bpy.types.Operator, Operator):
core.add_actor(tool.Ifc, ifc_class=props.actor_class, actor=tool.Ifc.get().by_id(int(props.the_actor))) core.add_actor(tool.Ifc, ifc_class=props.actor_class, actor=tool.Ifc.get().by_id(int(props.the_actor)))
class EnableEditingActor(bpy.types.Operator, Operator): class EnableEditingActor(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_actor" bl_idname = "bim.enable_editing_actor"
bl_label = "Enable Editing Actor" bl_label = "Enable Editing Actor"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -329,7 +322,7 @@ class EnableEditingActor(bpy.types.Operator, Operator):
core.enable_editing_actor(tool.Owner, actor=tool.Ifc.get().by_id(self.actor)) core.enable_editing_actor(tool.Owner, actor=tool.Ifc.get().by_id(self.actor))
class DisableEditingActor(bpy.types.Operator, Operator): class DisableEditingActor(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_actor" bl_idname = "bim.disable_editing_actor"
bl_label = "Disable Editing Actor" bl_label = "Disable Editing Actor"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -338,7 +331,7 @@ class DisableEditingActor(bpy.types.Operator, Operator):
core.disable_editing_actor(tool.Owner) core.disable_editing_actor(tool.Owner)
class EditActor(bpy.types.Operator, Operator): class EditActor(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_actor" bl_idname = "bim.edit_actor"
bl_label = "Edit Actor" bl_label = "Edit Actor"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -347,7 +340,7 @@ class EditActor(bpy.types.Operator, Operator):
core.edit_actor(tool.Ifc, tool.Owner) core.edit_actor(tool.Ifc, tool.Owner)
class RemoveActor(bpy.types.Operator, Operator): class RemoveActor(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_actor" bl_idname = "bim.remove_actor"
bl_label = "Remove Actor" bl_label = "Remove Actor"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -357,7 +350,7 @@ class RemoveActor(bpy.types.Operator, Operator):
core.remove_actor(tool.Ifc, actor=tool.Ifc.get().by_id(self.actor)) core.remove_actor(tool.Ifc, actor=tool.Ifc.get().by_id(self.actor))
class AssignActor(bpy.types.Operator, Operator): class AssignActor(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.assign_actor" bl_idname = "bim.assign_actor"
bl_label = "Assign Actor" bl_label = "Assign Actor"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -369,7 +362,7 @@ class AssignActor(bpy.types.Operator, Operator):
) )
class UnassignActor(bpy.types.Operator, Operator): class UnassignActor(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.unassign_actor" bl_idname = "bim.unassign_actor"
bl_label = "Unassign Actor" bl_label = "Unassign Actor"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -31,14 +31,7 @@ import blenderbim.bim.module.pset.data
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
class Operator: class TogglePsetExpansion(bpy.types.Operator, tool.Ifc.Operator):
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class TogglePsetExpansion(bpy.types.Operator, Operator):
bl_idname = "bim.toggle_pset_expansion" bl_idname = "bim.toggle_pset_expansion"
bl_label = "Toggle Pset Expansion" bl_label = "Toggle Pset Expansion"
pset_id: bpy.props.IntProperty() pset_id: bpy.props.IntProperty()
@@ -70,7 +63,7 @@ class EnablePsetEditing(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class DisablePsetEditing(bpy.types.Operator, Operator): class DisablePsetEditing(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_pset_editing" bl_idname = "bim.disable_pset_editing"
bl_label = "Disable Pset Editing" bl_label = "Disable Pset Editing"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -91,7 +84,7 @@ class DisablePsetEditing(bpy.types.Operator, Operator):
props.active_pset_type = "" props.active_pset_type = ""
class EditPset(bpy.types.Operator, Operator): class EditPset(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_pset" bl_idname = "bim.edit_pset"
bl_label = "Edit Pset" bl_label = "Edit Pset"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -159,7 +152,7 @@ class EditPset(bpy.types.Operator, Operator):
tool.Blender.update_viewport() tool.Blender.update_viewport()
class RemovePset(bpy.types.Operator, Operator): class RemovePset(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_pset" bl_idname = "bim.remove_pset"
bl_label = "Remove Pset" bl_label = "Remove Pset"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -187,7 +180,7 @@ class RemovePset(bpy.types.Operator, Operator):
) )
class AddPset(bpy.types.Operator, Operator): class AddPset(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_pset" bl_idname = "bim.add_pset"
bl_label = "Add Pset" bl_label = "Add Pset"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -198,7 +191,7 @@ class AddPset(bpy.types.Operator, Operator):
core.add_pset(tool.Ifc, tool.Pset, tool.Blender, obj_name=self.obj, obj_type=self.obj_type) core.add_pset(tool.Ifc, tool.Pset, tool.Blender, obj_name=self.obj, obj_type=self.obj_type)
class AddQto(bpy.types.Operator, Operator): class AddQto(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_qto" bl_idname = "bim.add_qto"
bl_label = "Add Qto" bl_label = "Add Qto"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -214,7 +207,7 @@ class AddQto(bpy.types.Operator, Operator):
) )
class CopyPropertyToSelection(bpy.types.Operator, Operator): class CopyPropertyToSelection(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.copy_property_to_selection" bl_idname = "bim.copy_property_to_selection"
bl_label = "Copy Property To Selection" bl_label = "Copy Property To Selection"
name: bpy.props.StringProperty() name: bpy.props.StringProperty()
@@ -24,9 +24,13 @@ import blenderbim.bim.schema
import blenderbim.bim.handler import blenderbim.bim.handler
import blenderbim.tool as tool import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
from typing import final
class Operator: class PsetTemplateOperator:
"""`tool.Ifc.Operator` but for pset template file."""
@final
def execute(self, context): def execute(self, context):
IfcStore.begin_transaction(self) IfcStore.begin_transaction(self)
IfcStore.pset_template_file.begin_transaction() IfcStore.pset_template_file.begin_transaction()
@@ -43,6 +47,9 @@ class Operator:
def commit(self, data): def commit(self, data):
IfcStore.pset_template_file.redo() IfcStore.pset_template_file.redo()
def _execute(self, context: bpy.types.Context) -> None:
tool.Ifc.Operator._execute(self, context)
class AddPsetTemplateFile(bpy.types.Operator): class AddPsetTemplateFile(bpy.types.Operator):
bl_idname = "bim.add_pset_template_file" bl_idname = "bim.add_pset_template_file"
@@ -70,7 +77,7 @@ class AddPsetTemplateFile(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class AddPsetTemplate(bpy.types.Operator, Operator): class AddPsetTemplate(bpy.types.Operator, PsetTemplateOperator):
bl_idname = "bim.add_pset_template" bl_idname = "bim.add_pset_template"
bl_label = "Add Pset Template" bl_label = "Add Pset Template"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -84,7 +91,7 @@ class AddPsetTemplate(bpy.types.Operator, Operator):
context.scene.BIMPsetTemplateProperties.pset_templates = str(template.id()) context.scene.BIMPsetTemplateProperties.pset_templates = str(template.id())
class RemovePsetTemplate(bpy.types.Operator, Operator): class RemovePsetTemplate(bpy.types.Operator, PsetTemplateOperator):
bl_idname = "bim.remove_pset_template" bl_idname = "bim.remove_pset_template"
bl_label = "Remove Pset Template" bl_label = "Remove Pset Template"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -191,7 +198,7 @@ class DisableEditingPropTemplate(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class EditPsetTemplate(bpy.types.Operator, Operator): class EditPsetTemplate(bpy.types.Operator, PsetTemplateOperator):
bl_idname = "bim.edit_pset_template" bl_idname = "bim.edit_pset_template"
bl_label = "Edit Pset Template" bl_label = "Edit Pset Template"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -242,7 +249,7 @@ class RemovePsetTemplateFile(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class AddPropTemplate(bpy.types.Operator, Operator): class AddPropTemplate(bpy.types.Operator, PsetTemplateOperator):
bl_idname = "bim.add_prop_template" bl_idname = "bim.add_prop_template"
bl_label = "Add Prop Template" bl_label = "Add Prop Template"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -261,7 +268,7 @@ class AddPropTemplate(bpy.types.Operator, Operator):
blenderbim.bim.schema.reload(tool.Ifc.get().schema) blenderbim.bim.schema.reload(tool.Ifc.get().schema)
class RemovePropTemplate(bpy.types.Operator, Operator): class RemovePropTemplate(bpy.types.Operator, PsetTemplateOperator):
bl_idname = "bim.remove_prop_template" bl_idname = "bim.remove_prop_template"
bl_label = "Remove Prop Template" bl_label = "Remove Prop Template"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -278,7 +285,7 @@ class RemovePropTemplate(bpy.types.Operator, Operator):
blenderbim.bim.schema.reload(tool.Ifc.get().schema) blenderbim.bim.schema.reload(tool.Ifc.get().schema)
class EditPropTemplate(bpy.types.Operator, Operator): class EditPropTemplate(bpy.types.Operator, PsetTemplateOperator):
bl_idname = "bim.edit_prop_template" bl_idname = "bim.edit_prop_template"
bl_label = "Edit Prop Template" bl_label = "Edit Prop Template"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -301,7 +308,7 @@ class EditPropTemplate(bpy.types.Operator, Operator):
"PrimaryMeasureType": props.active_prop_template.primary_measure_type, "PrimaryMeasureType": props.active_prop_template.primary_measure_type,
"TemplateType": props.active_prop_template.template_type, "TemplateType": props.active_prop_template.template_type,
"Enumerators": enumerators, "Enumerators": enumerators,
} },
) )
bpy.ops.bim.disable_editing_prop_template() bpy.ops.bim.disable_editing_prop_template()
IfcStore.pset_template_file.write(IfcStore.pset_template_path) IfcStore.pset_template_file.write(IfcStore.pset_template_path)
@@ -34,13 +34,6 @@ from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.helper import get_enum_items from blenderbim.bim.helper import get_enum_items
class Operator:
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class EnableReassignClass(bpy.types.Operator): class EnableReassignClass(bpy.types.Operator):
bl_idname = "bim.enable_reassign_class" bl_idname = "bim.enable_reassign_class"
bl_label = "Enable Reassign IFC Class" bl_label = "Enable Reassign IFC Class"
@@ -169,7 +162,7 @@ class ReassignClass(bpy.types.Operator):
return {"FINISHED"} return {"FINISHED"}
class AssignClass(bpy.types.Operator, Operator): class AssignClass(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.assign_class" bl_idname = "bim.assign_class"
bl_label = "Assign IFC Class" bl_label = "Assign IFC Class"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -297,7 +290,7 @@ class UnlinkObject(bpy.types.Operator):
return context.window_manager.invoke_props_dialog(self) return context.window_manager.invoke_props_dialog(self)
class CopyClass(bpy.types.Operator, Operator): class CopyClass(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.copy_class" bl_idname = "bim.copy_class"
bl_label = "Copy Class" bl_label = "Copy Class"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -27,14 +27,6 @@ import blenderbim.bim.handler
import blenderbim.core.spatial import blenderbim.core.spatial
# declaring it here to avoid circular import problems
class Operator:
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class SpatialTool(WorkSpaceTool): class SpatialTool(WorkSpaceTool):
bl_space_type = "VIEW_3D" bl_space_type = "VIEW_3D"
bl_context_mode = "OBJECT" bl_context_mode = "OBJECT"
@@ -129,7 +121,7 @@ class SpatialToolUI:
pass pass
class Hotkey(bpy.types.Operator, Operator): class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.spatial_hotkey" bl_idname = "bim.spatial_hotkey"
bl_label = "Hotkey" bl_label = "Hotkey"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -26,14 +26,6 @@ from blenderbim.bim.ifc import IfcStore
import blenderbim.bim.handler import blenderbim.bim.handler
# declaring it here to avoid circular import problems
class Operator:
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class StructuralTool(WorkSpaceTool): class StructuralTool(WorkSpaceTool):
bl_space_type = "VIEW_3D" bl_space_type = "VIEW_3D"
bl_context_mode = "OBJECT" bl_context_mode = "OBJECT"
@@ -95,7 +87,7 @@ class StructuralToolUI:
pass pass
class Hotkey(bpy.types.Operator, Operator): class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.structural_hotkey" bl_idname = "bim.structural_hotkey"
bl_label = "Hotkey" bl_label = "Hotkey"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -27,14 +27,7 @@ from blenderbim.bim.module.system.data import PortData
from mathutils import Matrix from mathutils import Matrix
class Operator: class LoadSystems(bpy.types.Operator, tool.Ifc.Operator):
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class LoadSystems(bpy.types.Operator, Operator):
bl_idname = "bim.load_systems" bl_idname = "bim.load_systems"
bl_label = "Load Systems" bl_label = "Load Systems"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -43,7 +36,7 @@ class LoadSystems(bpy.types.Operator, Operator):
core.load_systems(tool.System) core.load_systems(tool.System)
class DisableSystemEditingUI(bpy.types.Operator, Operator): class DisableSystemEditingUI(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_system_editing_ui" bl_idname = "bim.disable_system_editing_ui"
bl_label = "Disable System Editing UI" bl_label = "Disable System Editing UI"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -52,7 +45,7 @@ class DisableSystemEditingUI(bpy.types.Operator, Operator):
core.disable_system_editing_ui(tool.System) core.disable_system_editing_ui(tool.System)
class AddSystem(bpy.types.Operator, Operator): class AddSystem(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_system" bl_idname = "bim.add_system"
bl_label = "Add System" bl_label = "Add System"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -61,7 +54,7 @@ class AddSystem(bpy.types.Operator, Operator):
core.add_system(tool.Ifc, tool.System, ifc_class=context.scene.BIMSystemProperties.system_class) core.add_system(tool.Ifc, tool.System, ifc_class=context.scene.BIMSystemProperties.system_class)
class EditSystem(bpy.types.Operator, Operator): class EditSystem(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_system" bl_idname = "bim.edit_system"
bl_label = "Edit System" bl_label = "Edit System"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -72,7 +65,7 @@ class EditSystem(bpy.types.Operator, Operator):
) )
class RemoveSystem(bpy.types.Operator, Operator): class RemoveSystem(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_system" bl_idname = "bim.remove_system"
bl_label = "Remove System" bl_label = "Remove System"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -82,7 +75,7 @@ class RemoveSystem(bpy.types.Operator, Operator):
core.remove_system(tool.Ifc, tool.System, system=tool.Ifc.get().by_id(self.system)) core.remove_system(tool.Ifc, tool.System, system=tool.Ifc.get().by_id(self.system))
class EnableEditingSystem(bpy.types.Operator, Operator): class EnableEditingSystem(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_system" bl_idname = "bim.enable_editing_system"
bl_label = "Enable Editing System" bl_label = "Enable Editing System"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -92,7 +85,7 @@ class EnableEditingSystem(bpy.types.Operator, Operator):
core.enable_editing_system(tool.System, system=tool.Ifc.get().by_id(self.system)) core.enable_editing_system(tool.System, system=tool.Ifc.get().by_id(self.system))
class DisableEditingSystem(bpy.types.Operator, Operator): class DisableEditingSystem(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_system" bl_idname = "bim.disable_editing_system"
bl_label = "Disable Editing System" bl_label = "Disable Editing System"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -101,7 +94,7 @@ class DisableEditingSystem(bpy.types.Operator, Operator):
core.disable_editing_system(tool.System) core.disable_editing_system(tool.System)
class AssignSystem(bpy.types.Operator, Operator): class AssignSystem(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.assign_system" bl_idname = "bim.assign_system"
bl_label = "Assign System" bl_label = "Assign System"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -114,7 +107,7 @@ class AssignSystem(bpy.types.Operator, Operator):
core.assign_system(tool.Ifc, system=tool.Ifc.get().by_id(self.system), product=element) core.assign_system(tool.Ifc, system=tool.Ifc.get().by_id(self.system), product=element)
class UnassignSystem(bpy.types.Operator, Operator): class UnassignSystem(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.unassign_system" bl_idname = "bim.unassign_system"
bl_label = "Unassign System" bl_label = "Unassign System"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -127,7 +120,7 @@ class UnassignSystem(bpy.types.Operator, Operator):
core.unassign_system(tool.Ifc, system=tool.Ifc.get().by_id(self.system), product=element) core.unassign_system(tool.Ifc, system=tool.Ifc.get().by_id(self.system), product=element)
class SelectSystemProducts(bpy.types.Operator, Operator): class SelectSystemProducts(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.select_system_products" bl_idname = "bim.select_system_products"
bl_label = "Select System Products" bl_label = "Select System Products"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -137,7 +130,7 @@ class SelectSystemProducts(bpy.types.Operator, Operator):
core.select_system_products(tool.System, system=tool.Ifc.get().by_id(self.system)) core.select_system_products(tool.System, system=tool.Ifc.get().by_id(self.system))
class ShowPorts(bpy.types.Operator, Operator): class ShowPorts(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.show_ports" bl_idname = "bim.show_ports"
bl_label = "Show Ports" bl_label = "Show Ports"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -155,7 +148,7 @@ class ShowPorts(bpy.types.Operator, Operator):
core.show_ports(tool.Ifc, tool.System, tool.Spatial, element=tool.Ifc.get_entity(context.active_object)) core.show_ports(tool.Ifc, tool.System, tool.Spatial, element=tool.Ifc.get_entity(context.active_object))
class HidePorts(bpy.types.Operator, Operator): class HidePorts(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.hide_ports" bl_idname = "bim.hide_ports"
bl_label = "Hide Ports" bl_label = "Hide Ports"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -168,7 +161,7 @@ class HidePorts(bpy.types.Operator, Operator):
core.hide_ports(tool.Ifc, tool.System, element=tool.Ifc.get_entity(context.active_object)) core.hide_ports(tool.Ifc, tool.System, element=tool.Ifc.get_entity(context.active_object))
class AddPort(bpy.types.Operator, Operator): class AddPort(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_port" bl_idname = "bim.add_port"
bl_description = "Add port at current cursor position" bl_description = "Add port at current cursor position"
bl_label = "Add Port" bl_label = "Add Port"
@@ -178,7 +171,7 @@ class AddPort(bpy.types.Operator, Operator):
core.add_port(tool.Ifc, tool.System, element=tool.Ifc.get_entity(context.active_object)) core.add_port(tool.Ifc, tool.System, element=tool.Ifc.get_entity(context.active_object))
class RemovePort(bpy.types.Operator, Operator): class RemovePort(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_port" bl_idname = "bim.remove_port"
bl_label = "Remove Port" bl_label = "Remove Port"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -187,7 +180,7 @@ class RemovePort(bpy.types.Operator, Operator):
core.remove_port(tool.Ifc, tool.System, port=tool.Ifc.get_entity(context.active_object)) core.remove_port(tool.Ifc, tool.System, port=tool.Ifc.get_entity(context.active_object))
class ConnectPort(bpy.types.Operator, Operator): class ConnectPort(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.connect_port" bl_idname = "bim.connect_port"
bl_label = "Connect Ports" bl_label = "Connect Ports"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -202,7 +195,7 @@ class ConnectPort(bpy.types.Operator, Operator):
core.connect_port(tool.Ifc, port1=tool.Ifc.get_entity(obj1), port2=tool.Ifc.get_entity(obj2)) core.connect_port(tool.Ifc, port1=tool.Ifc.get_entity(obj1), port2=tool.Ifc.get_entity(obj2))
class DisconnectPort(bpy.types.Operator, Operator): class DisconnectPort(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disconnect_port" bl_idname = "bim.disconnect_port"
bl_label = "Disconnect Ports" bl_label = "Disconnect Ports"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -217,7 +210,7 @@ class DisconnectPort(bpy.types.Operator, Operator):
core.disconnect_port(tool.Ifc, port=element) core.disconnect_port(tool.Ifc, port=element)
class MEPConnectElements(bpy.types.Operator, Operator): class MEPConnectElements(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.mep_connect_elements" bl_idname = "bim.mep_connect_elements"
bl_label = "Connect MEP Elements" bl_label = "Connect MEP Elements"
bl_description = "Connects two selected elements by their closest located ports and adjusts them" bl_description = "Connects two selected elements by their closest located ports and adjusts them"
@@ -268,7 +261,7 @@ class MEPConnectElements(bpy.types.Operator, Operator):
return {"FINISHED"} return {"FINISHED"}
class SetFlowDirection(bpy.types.Operator, Operator): class SetFlowDirection(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.set_flow_direction" bl_idname = "bim.set_flow_direction"
bl_label = "Set Flow Direction" bl_label = "Set Flow Direction"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -332,7 +325,7 @@ class SetFlowDirection(bpy.types.Operator, Operator):
return {"CANCELLED"} return {"CANCELLED"}
class LoadZones(bpy.types.Operator, Operator): class LoadZones(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.load_zones" bl_idname = "bim.load_zones"
bl_label = "Load Zones" bl_label = "Load Zones"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -348,7 +341,7 @@ class LoadZones(bpy.types.Operator, Operator):
props.is_editing = 0 props.is_editing = 0
class UnloadZones(bpy.types.Operator, Operator): class UnloadZones(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.unload_zones" bl_idname = "bim.unload_zones"
bl_label = "Unload Zones" bl_label = "Unload Zones"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -358,7 +351,7 @@ class UnloadZones(bpy.types.Operator, Operator):
props.is_loaded = False props.is_loaded = False
class AddZone(bpy.types.Operator, Operator): class AddZone(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_zone" bl_idname = "bim.add_zone"
bl_label = "Add Zone" bl_label = "Add Zone"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -378,7 +371,7 @@ class AddZone(bpy.types.Operator, Operator):
bpy.ops.bim.load_zones() bpy.ops.bim.load_zones()
class EnableEditingZone(bpy.types.Operator, Operator): class EnableEditingZone(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_zone" bl_idname = "bim.enable_editing_zone"
bl_label = "Enable Editing Zone" bl_label = "Enable Editing Zone"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -391,7 +384,7 @@ class EnableEditingZone(bpy.types.Operator, Operator):
props.is_editing = self.zone props.is_editing = self.zone
class DisableEditingZone(bpy.types.Operator, Operator): class DisableEditingZone(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_zone" bl_idname = "bim.disable_editing_zone"
bl_label = "Disable Editing Zone" bl_label = "Disable Editing Zone"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -401,7 +394,7 @@ class DisableEditingZone(bpy.types.Operator, Operator):
props.is_editing = 0 props.is_editing = 0
class EditZone(bpy.types.Operator, Operator): class EditZone(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_zone" bl_idname = "bim.edit_zone"
bl_label = "Edit Zone" bl_label = "Edit Zone"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -415,7 +408,7 @@ class EditZone(bpy.types.Operator, Operator):
bpy.ops.bim.load_zones() bpy.ops.bim.load_zones()
class RemoveZone(bpy.types.Operator, Operator): class RemoveZone(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_zone" bl_idname = "bim.remove_zone"
bl_label = "Remove Zone" bl_label = "Remove Zone"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -426,7 +419,7 @@ class RemoveZone(bpy.types.Operator, Operator):
bpy.ops.bim.load_zones() bpy.ops.bim.load_zones()
class AssignUnassignFlowControl(bpy.types.Operator, Operator): class AssignUnassignFlowControl(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.assign_unassign_flow_control" bl_idname = "bim.assign_unassign_flow_control"
bl_label = "Assign/Unassign Flow Control" bl_label = "Assign/Unassign Flow Control"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -31,14 +31,7 @@ import blenderbim.core.root
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
class Operator: class AssignType(bpy.types.Operator, tool.Ifc.Operator):
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data()
return {"FINISHED"}
class AssignType(bpy.types.Operator, Operator):
bl_idname = "bim.assign_type" bl_idname = "bim.assign_type"
bl_label = "Assign Type" bl_label = "Assign Type"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -27,14 +27,7 @@ import blenderbim.core.unit as core
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
class Operator: class AssignSceneUnits(bpy.types.Operator, tool.Ifc.Operator):
def execute(self, context):
IfcStore.execute_ifc_operator(self, context)
blenderbim.bim.handler.refresh_ui_data
return {"FINISHED"}
class AssignSceneUnits(bpy.types.Operator, Operator):
bl_idname = "bim.assign_scene_units" bl_idname = "bim.assign_scene_units"
bl_label = "Assign Scene Units" bl_label = "Assign Scene Units"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -43,7 +36,7 @@ class AssignSceneUnits(bpy.types.Operator, Operator):
core.assign_scene_units(tool.Ifc, tool.Unit) core.assign_scene_units(tool.Ifc, tool.Unit)
class AssignUnit(bpy.types.Operator, Operator): class AssignUnit(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.assign_unit" bl_idname = "bim.assign_unit"
bl_label = "Assign Unit" bl_label = "Assign Unit"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -53,7 +46,7 @@ class AssignUnit(bpy.types.Operator, Operator):
core.assign_unit(tool.Ifc, tool.Unit, unit=tool.Ifc.get().by_id(self.unit)) core.assign_unit(tool.Ifc, tool.Unit, unit=tool.Ifc.get().by_id(self.unit))
class UnassignUnit(bpy.types.Operator, Operator): class UnassignUnit(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.unassign_unit" bl_idname = "bim.unassign_unit"
bl_label = "Unassign Unit" bl_label = "Unassign Unit"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -63,7 +56,7 @@ class UnassignUnit(bpy.types.Operator, Operator):
core.unassign_unit(tool.Ifc, tool.Unit, unit=tool.Ifc.get().by_id(self.unit)) core.unassign_unit(tool.Ifc, tool.Unit, unit=tool.Ifc.get().by_id(self.unit))
class LoadUnits(bpy.types.Operator, Operator): class LoadUnits(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.load_units" bl_idname = "bim.load_units"
bl_label = "Load Units" bl_label = "Load Units"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -73,7 +66,7 @@ class LoadUnits(bpy.types.Operator, Operator):
core.load_units(tool.Unit) core.load_units(tool.Unit)
class DisableUnitEditingUI(bpy.types.Operator, Operator): class DisableUnitEditingUI(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_unit_editing_ui" bl_idname = "bim.disable_unit_editing_ui"
bl_label = "Disable Unit Editing UI" bl_label = "Disable Unit Editing UI"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -83,7 +76,7 @@ class DisableUnitEditingUI(bpy.types.Operator, Operator):
core.disable_unit_editing_ui(tool.Unit) core.disable_unit_editing_ui(tool.Unit)
class RemoveUnit(bpy.types.Operator, Operator): class RemoveUnit(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.remove_unit" bl_idname = "bim.remove_unit"
bl_label = "Remove Unit" bl_label = "Remove Unit"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -93,7 +86,7 @@ class RemoveUnit(bpy.types.Operator, Operator):
core.remove_unit(tool.Ifc, tool.Unit, unit=tool.Ifc.get().by_id(self.unit)) core.remove_unit(tool.Ifc, tool.Unit, unit=tool.Ifc.get().by_id(self.unit))
class AddConversionBasedUnit(bpy.types.Operator, Operator): class AddConversionBasedUnit(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_conversion_based_unit" bl_idname = "bim.add_conversion_based_unit"
bl_label = "Add Conversion Based Unit" bl_label = "Add Conversion Based Unit"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -103,7 +96,7 @@ class AddConversionBasedUnit(bpy.types.Operator, Operator):
core.add_conversion_based_unit(tool.Ifc, tool.Unit, name=self.name) core.add_conversion_based_unit(tool.Ifc, tool.Unit, name=self.name)
class AddMonetaryUnit(bpy.types.Operator, Operator): class AddMonetaryUnit(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_monetary_unit" bl_idname = "bim.add_monetary_unit"
bl_label = "Add Monetary Unit" bl_label = "Add Monetary Unit"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -112,7 +105,7 @@ class AddMonetaryUnit(bpy.types.Operator, Operator):
core.add_monetary_unit(tool.Ifc, tool.Unit) core.add_monetary_unit(tool.Ifc, tool.Unit)
class AddSIUnit(bpy.types.Operator, Operator): class AddSIUnit(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_si_unit" bl_idname = "bim.add_si_unit"
bl_label = "Add SI Unit" bl_label = "Add SI Unit"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -122,7 +115,7 @@ class AddSIUnit(bpy.types.Operator, Operator):
core.add_si_unit(tool.Ifc, tool.Unit, unit_type=self.unit_type) core.add_si_unit(tool.Ifc, tool.Unit, unit_type=self.unit_type)
class AddContextDependentUnit(bpy.types.Operator, Operator): class AddContextDependentUnit(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.add_context_dependent_unit" bl_idname = "bim.add_context_dependent_unit"
bl_label = "Add Context Dependent Unit" bl_label = "Add Context Dependent Unit"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -133,7 +126,7 @@ class AddContextDependentUnit(bpy.types.Operator, Operator):
core.add_context_dependent_unit(tool.Ifc, tool.Unit, unit_type=self.unit_type, name=self.name) core.add_context_dependent_unit(tool.Ifc, tool.Unit, unit_type=self.unit_type, name=self.name)
class EnableEditingUnit(bpy.types.Operator, Operator): class EnableEditingUnit(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.enable_editing_unit" bl_idname = "bim.enable_editing_unit"
bl_label = "Enable Editing Unit" bl_label = "Enable Editing Unit"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -143,7 +136,7 @@ class EnableEditingUnit(bpy.types.Operator, Operator):
core.enable_editing_unit(tool.Unit, unit=tool.Ifc.get().by_id(self.unit)) core.enable_editing_unit(tool.Unit, unit=tool.Ifc.get().by_id(self.unit))
class DisableEditingUnit(bpy.types.Operator, Operator): class DisableEditingUnit(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.disable_editing_unit" bl_idname = "bim.disable_editing_unit"
bl_label = "Disable Editing Unit" bl_label = "Disable Editing Unit"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
@@ -152,7 +145,7 @@ class DisableEditingUnit(bpy.types.Operator, Operator):
core.disable_editing_unit(tool.Unit) core.disable_editing_unit(tool.Unit)
class EditUnit(bpy.types.Operator, Operator): class EditUnit(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_unit" bl_idname = "bim.edit_unit"
bl_label = "Edit Unit" bl_label = "Edit Unit"
bl_options = {"REGISTER", "UNDO"} bl_options = {"REGISTER", "UNDO"}
+8 -5
View File
@@ -20,12 +20,15 @@ import bpy
import mathutils import mathutils
import blenderbim.core.tool import blenderbim.core.tool
import blenderbim.tool as tool import blenderbim.tool as tool
from blenderbim.bim.module.geometry.helper import Helper from mathutils import Matrix, Vector
from typing import Any, Sequence
class Boundary(blenderbim.core.tool.Boundary): class Boundary(blenderbim.core.tool.Boundary):
@classmethod @classmethod
def get_assign_connection_geometry_settings(cls, obj): def get_assign_connection_geometry_settings(cls, obj: bpy.types.Object) -> dict[str, Any]:
from blenderbim.bim.module.geometry.helper import Helper
ifc = tool.Ifc.get() ifc = tool.Ifc.get()
helper = Helper(ifc) helper = Helper(ifc)
mesh = obj.data mesh = obj.data
@@ -55,16 +58,16 @@ class Boundary(blenderbim.core.tool.Boundary):
} }
@classmethod @classmethod
def polyline_from_indexes(cls, mesh, indexes): def polyline_from_indexes(cls, mesh: bpy.types.Mesh, indexes: Sequence[int]) -> tuple[Vector, ...]:
return tuple(mesh.vertices[i].co for i in indexes) return tuple(mesh.vertices[i].co for i in indexes)
@classmethod @classmethod
def polyline_to_2d(cls, polyline, placement_matrix): def polyline_to_2d(cls, polyline: Sequence[Vector], placement_matrix: Matrix) -> tuple[Vector, ...]:
matrix_inv = placement_matrix.inverted() matrix_inv = placement_matrix.inverted()
return tuple((matrix_inv @ v).to_2d() for v in polyline) return tuple((matrix_inv @ v).to_2d() for v in polyline)
@classmethod @classmethod
def move_origin_to_space_origin(cls, obj): def move_origin_to_space_origin(cls, obj: bpy.types.Object) -> None:
boundary = tool.Ifc.get_entity(obj) boundary = tool.Ifc.get_entity(obj)
space = tool.Ifc.get_object(boundary.RelatingSpace) space = tool.Ifc.get_object(boundary.RelatingSpace)
translation = obj.matrix_world.translation - space.matrix_world.translation translation = obj.matrix_world.translation - space.matrix_world.translation
+49 -9
View File
@@ -41,14 +41,8 @@ import ifcopenshell.util.element
import ifcopenshell.util.selector import ifcopenshell.util.selector
import ifcopenshell.util.shape import ifcopenshell.util.shape
import blenderbim.bim.import_ifc import blenderbim.bim.import_ifc
import blenderbim.bim.module.drawing.sheeter as sheeter
import blenderbim.bim.module.drawing.scheduler as scheduler
import blenderbim.bim.module.drawing.annotation as annotation
import blenderbim.bim.module.drawing.helper as helper
import blenderbim.core.root import blenderbim.core.root
from shapely.ops import unary_union from shapely.ops import unary_union
from blenderbim.bim.module.drawing.data import FONT_SIZES, DecoratorData
from blenderbim.bim.module.drawing.prop import get_diagram_scales, BOX_ALIGNMENT_POSITIONS, ANNOTATION_TYPES_DATA
from lxml import etree from lxml import etree
from mathutils import Vector, Matrix from mathutils import Vector, Matrix
from fractions import Fraction from fractions import Fraction
@@ -60,6 +54,30 @@ class Drawing(blenderbim.core.tool.Drawing):
ANNOTATION_DATA_TYPE = Literal["empty", "curve", "mesh"] ANNOTATION_DATA_TYPE = Literal["empty", "curve", "mesh"]
DOCUMENT_TYPE = Literal["SCHEDULE", "REFERENCE"] DOCUMENT_TYPE = Literal["SCHEDULE", "REFERENCE"]
# ObjectType: annotation_name, description, icon, data_type
# fmt: off
ANNOTATION_TYPES_DATA = {
"DIMENSION": ("Dimension", "Add dimensions annotation.\nMeasurement values can be hidden through ShowDescriptionOnly property\nof BBIM_Dimension property set", "FIXED_SIZE", "curve"),
"ANGLE": ("Angle", "", "DRIVER_ROTATIONAL_DIFFERENCE", "curve"),
"RADIUS": ("Radius", "", "FORWARD", "curve"),
"DIAMETER": ("Diameter", "Add diameter annotation.\nMeasurement values can be hidden through ShowDescriptionOnly property\nof BBIM_Dimension property set", "ARROW_LEFTRIGHT", "curve"),
"TEXT": ("Text", "", "SMALL_CAPS", "empty"),
"TEXT_LEADER": ("Leader", "", "TRACKING_BACKWARDS", "curve"),
"STAIR_ARROW": ("Stair Arrow", "Add stair arrow annotation.\nIf you have IfcStairFlight object selected, it will be used as a reference for the annotation", "SCREEN_BACK", "curve"),
"PLAN_LEVEL": ("Level (Plan)", "", "SORTBYEXT", "curve"),
"SECTION_LEVEL": ("Level (Section)", "", "TRIA_DOWN", "curve"),
"BREAKLINE": ("Breakline", "", "FCURVE", "mesh"),
"SYMBOL": ("Symbol", "", "KEYFRAME", "empty"),
"MULTI_SYMBOL": ("Multi-Symbol", "", "OUTLINER_DATA_POINTCLOUD", "mesh"),
"LINEWORK": ("Line", "", "SNAP_MIDPOINT", "mesh"),
"BATTING": ("Batting", "Add batting annotation.\nThickness could be changed through Thickness property of BBIM_Batting property set", "FORCE_FORCE", "mesh"),
"REVISION_CLOUD":("Revision Cloud", "Add revision cloud", "VOLUME_DATA", "mesh"),
"FILL_AREA": ("Fill Area", "", "NODE_TEXTURE", "mesh"),
"FALL": ("Fall", "", "SORT_ASC", "curve"),
"IMAGE": ("Image", "Add reference image attached to the drawing", "TEXTURE", "mesh"),
}
# fmt: on
@classmethod @classmethod
def canonicalise_class_name(cls, name): def canonicalise_class_name(cls, name):
return re.sub("[^0-9a-zA-Z]+", "", name) return re.sub("[^0-9a-zA-Z]+", "", name)
@@ -73,10 +91,12 @@ class Drawing(blenderbim.core.tool.Drawing):
@classmethod @classmethod
def get_annotation_data_type(cls, object_type: str) -> ANNOTATION_DATA_TYPE: def get_annotation_data_type(cls, object_type: str) -> ANNOTATION_DATA_TYPE:
return ANNOTATION_TYPES_DATA[object_type][3] return cls.ANNOTATION_TYPES_DATA[object_type][3]
@classmethod @classmethod
def create_annotation_object(cls, drawing: ifcopenshell.entity_instance, object_type: str) -> bpy.types.Object: def create_annotation_object(cls, drawing: ifcopenshell.entity_instance, object_type: str) -> bpy.types.Object:
import blenderbim.bim.module.drawing.annotation as annotation
data_type = cls.get_annotation_data_type(object_type) data_type = cls.get_annotation_data_type(object_type)
obj = annotation.Annotator.get_annotation_obj(drawing, object_type, data_type) obj = annotation.Annotator.get_annotation_obj(drawing, object_type, data_type)
if object_type == "FILL_AREA": if object_type == "FILL_AREA":
@@ -238,6 +258,8 @@ class Drawing(blenderbim.core.tool.Drawing):
@classmethod @classmethod
def create_svg_schedule(cls, schedule): def create_svg_schedule(cls, schedule):
import blenderbim.bim.module.drawing.scheduler as scheduler
schedule_creator = scheduler.Scheduler() schedule_creator = scheduler.Scheduler()
schedule_creator.schedule( schedule_creator.schedule(
cls.get_document_uri(schedule), cls.get_path_with_ext(cls.get_document_uri(schedule), "svg") cls.get_document_uri(schedule), cls.get_path_with_ext(cls.get_document_uri(schedule), "svg")
@@ -245,6 +267,8 @@ class Drawing(blenderbim.core.tool.Drawing):
@classmethod @classmethod
def create_svg_sheet(cls, document: ifcopenshell.entity_instance, titleblock: str) -> str: def create_svg_sheet(cls, document: ifcopenshell.entity_instance, titleblock: str) -> str:
import blenderbim.bim.module.drawing.sheeter as sheeter
sheet_builder = sheeter.SheetBuilder() sheet_builder = sheeter.SheetBuilder()
sheet_builder.data_dir = bpy.context.scene.BIMProperties.data_dir sheet_builder.data_dir = bpy.context.scene.BIMProperties.data_dir
uri = cls.get_document_uri(document, "LAYOUT") uri = cls.get_document_uri(document, "LAYOUT")
@@ -253,6 +277,8 @@ class Drawing(blenderbim.core.tool.Drawing):
@classmethod @classmethod
def add_drawings(cls, sheet): def add_drawings(cls, sheet):
import blenderbim.bim.module.drawing.sheeter as sheeter
sheet_builder = sheeter.SheetBuilder() sheet_builder = sheeter.SheetBuilder()
sheet_builder.data_dir = bpy.context.scene.BIMProperties.data_dir sheet_builder.data_dir = bpy.context.scene.BIMProperties.data_dir
drawing_references = {} drawing_references = {}
@@ -707,7 +733,9 @@ class Drawing(blenderbim.core.tool.Drawing):
return obj return obj
@classmethod @classmethod
def import_camera_props(cls, drawing, obj): def import_camera_props(cls, drawing: ifcopenshell.entity_instance, obj: bpy.types.Object) -> None:
from blenderbim.bim.module.drawing.prop import get_diagram_scales
# Temporarily clear the definition id to prevent prop update callbacks to IFC. # Temporarily clear the definition id to prevent prop update callbacks to IFC.
ifc_definition_id = obj.BIMObjectProperties.ifc_definition_id ifc_definition_id = obj.BIMObjectProperties.ifc_definition_id
obj.BIMObjectProperties.ifc_definition_id = 0 obj.BIMObjectProperties.ifc_definition_id = 0
@@ -749,7 +777,7 @@ class Drawing(blenderbim.core.tool.Drawing):
obj.BIMObjectProperties.ifc_definition_id = ifc_definition_id obj.BIMObjectProperties.ifc_definition_id = ifc_definition_id
@classmethod @classmethod
def import_drawings(cls): def import_drawings(cls) -> None:
props = bpy.context.scene.DocProperties props = bpy.context.scene.DocProperties
expanded_target_views = {d.target_view for d in props.drawings if d.is_expanded} expanded_target_views = {d.target_view for d in props.drawings if d.is_expanded}
current_drawings_selection = {d.ifc_definition_id: d.is_selected for d in props.drawings} current_drawings_selection = {d.ifc_definition_id: d.is_selected for d in props.drawings}
@@ -846,6 +874,8 @@ class Drawing(blenderbim.core.tool.Drawing):
@classmethod @classmethod
def import_text_attributes(cls, obj: bpy.types.Object) -> None: def import_text_attributes(cls, obj: bpy.types.Object) -> None:
from blenderbim.bim.module.drawing.prop import BOX_ALIGNMENT_POSITIONS
props = obj.BIMTextProperties props = obj.BIMTextProperties
props.literals.clear() props.literals.clear()
@@ -859,6 +889,8 @@ class Drawing(blenderbim.core.tool.Drawing):
literal_props.box_alignment = box_alignment_mask literal_props.box_alignment = box_alignment_mask
literal_props.ifc_definition_id = ifc_literal.id() literal_props.ifc_definition_id = ifc_literal.id()
from blenderbim.bim.module.drawing.data import DecoratorData
text_data = DecoratorData.get_ifc_text_data(obj) text_data = DecoratorData.get_ifc_text_data(obj)
props.font_size = str(text_data["FontSize"]) props.font_size = str(text_data["FontSize"])
@@ -947,6 +979,8 @@ class Drawing(blenderbim.core.tool.Drawing):
"""updates pset `EPset_Annotation.Classes` value """updates pset `EPset_Annotation.Classes` value
based on current font size from `obj.BIMTextProperties.font_size` based on current font size from `obj.BIMTextProperties.font_size`
""" """
from blenderbim.bim.module.drawing.data import FONT_SIZES
props = obj.BIMTextProperties props = obj.BIMTextProperties
element = tool.Ifc.get_entity(obj) element = tool.Ifc.get_entity(obj)
# updating text font size in EPset_Annotation.Classes # updating text font size in EPset_Annotation.Classes
@@ -1151,6 +1185,8 @@ class Drawing(blenderbim.core.tool.Drawing):
reference_element: ifcopenshell.entity_instance, reference_element: ifcopenshell.entity_instance,
context: ifcopenshell.entity_instance, context: ifcopenshell.entity_instance,
) -> ifcopenshell.entity_instance: ) -> ifcopenshell.entity_instance:
import blenderbim.bim.module.drawing.helper as helper
camera = tool.Ifc.get_object(drawing) camera = tool.Ifc.get_object(drawing)
bounds = helper.ortho_view_frame(camera.data) if camera.data.type == "ORTHO" else None bounds = helper.ortho_view_frame(camera.data) if camera.data.type == "ORTHO" else None
reference_obj = tool.Ifc.get_object(reference_element) reference_obj = tool.Ifc.get_object(reference_element)
@@ -1216,6 +1252,8 @@ class Drawing(blenderbim.core.tool.Drawing):
reference_element: ifcopenshell.entity_instance, reference_element: ifcopenshell.entity_instance,
context: ifcopenshell.entity_instance, context: ifcopenshell.entity_instance,
) -> ifcopenshell.entity_instance: ) -> ifcopenshell.entity_instance:
import blenderbim.bim.module.drawing.helper as helper
reference_obj = tool.Ifc.get_object(reference_element) reference_obj = tool.Ifc.get_object(reference_element)
reference_obj.matrix_world reference_obj.matrix_world
camera = tool.Ifc.get_object(drawing) camera = tool.Ifc.get_object(drawing)
@@ -1338,6 +1376,8 @@ class Drawing(blenderbim.core.tool.Drawing):
reference_element: ifcopenshell.entity_instance, reference_element: ifcopenshell.entity_instance,
context: ifcopenshell.entity_instance, context: ifcopenshell.entity_instance,
) -> ifcopenshell.entity_instance: ) -> ifcopenshell.entity_instance:
import blenderbim.bim.module.drawing.helper as helper
target_view = tool.Drawing.get_drawing_target_view(drawing) target_view = tool.Drawing.get_drawing_target_view(drawing)
camera = tool.Ifc.get_object(drawing) camera = tool.Ifc.get_object(drawing)