mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 18:10:00 +00:00
for example it was throwing errors when using WindowTool you selected a wall and it would try to assign current type to wall
This commit is contained in:
@@ -27,7 +27,7 @@ from bpy.app.handlers import persistent
|
|||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from blenderbim.bim.module.owner.prop import get_user_person, get_user_organisation
|
from blenderbim.bim.module.owner.prop import get_user_person, get_user_organisation
|
||||||
from blenderbim.bim.module.model.data import AuthoringData
|
from blenderbim.bim.module.model.data import AuthoringData
|
||||||
from blenderbim.bim.module.model.workspace import LIST_OF_TOOLS
|
from blenderbim.bim.module.model.workspace import LIST_OF_TOOLS, TOOLS_TO_CLASSES_MAP
|
||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
from math import cos, degrees
|
from math import cos, degrees
|
||||||
|
|
||||||
@@ -130,9 +130,11 @@ def update_bim_tool_props():
|
|||||||
if element.is_a("IfcElementType") or element.is_a("IfcElement"):
|
if element.is_a("IfcElementType") or element.is_a("IfcElement"):
|
||||||
element_type = ifcopenshell.util.element.get_type(element)
|
element_type = ifcopenshell.util.element.get_type(element)
|
||||||
if element_type:
|
if element_type:
|
||||||
if current_tool.idname == "bim.bim_tool":
|
is_bim_tool = current_tool.idname == "bim.bim_tool"
|
||||||
|
if is_bim_tool:
|
||||||
props.ifc_class = element_type.is_a()
|
props.ifc_class = element_type.is_a()
|
||||||
props.relating_type_id = str(element_type.id())
|
if is_bim_tool or TOOLS_TO_CLASSES_MAP.get(current_tool.idname) == element_type.is_a():
|
||||||
|
props.relating_type_id = str(element_type.id())
|
||||||
extrusion = tool.Model.get_extrusion(representation)
|
extrusion = tool.Model.get_extrusion(representation)
|
||||||
if not extrusion:
|
if not extrusion:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -78,9 +78,11 @@ class WallTool(BimTool):
|
|||||||
bl_description = "Create and edit walls"
|
bl_description = "Create and edit walls"
|
||||||
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.wall")
|
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.wall")
|
||||||
bl_widget = None
|
bl_widget = None
|
||||||
|
ifc_element_type = "IfcWallType"
|
||||||
|
|
||||||
def draw_settings(context, layout, ws_tool):
|
@classmethod
|
||||||
BimToolUI.draw(context, layout, ifc_element_type="IfcWallType")
|
def draw_settings(cls, context, layout, ws_tool):
|
||||||
|
BimToolUI.draw(context, layout, ifc_element_type=cls.ifc_element_type)
|
||||||
|
|
||||||
|
|
||||||
class SlabTool(BimTool):
|
class SlabTool(BimTool):
|
||||||
@@ -91,9 +93,11 @@ class SlabTool(BimTool):
|
|||||||
bl_description = "Create and edit slabs"
|
bl_description = "Create and edit slabs"
|
||||||
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.slab")
|
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.slab")
|
||||||
bl_widget = None
|
bl_widget = None
|
||||||
|
ifc_element_type = "IfcSlabType"
|
||||||
|
|
||||||
def draw_settings(context, layout, ws_tool):
|
@classmethod
|
||||||
BimToolUI.draw(context, layout, ifc_element_type="IfcSlabType")
|
def draw_settings(cls, context, layout, ws_tool):
|
||||||
|
BimToolUI.draw(context, layout, ifc_element_type=cls.ifc_element_type)
|
||||||
|
|
||||||
|
|
||||||
class DoorTool(BimTool):
|
class DoorTool(BimTool):
|
||||||
@@ -104,9 +108,11 @@ class DoorTool(BimTool):
|
|||||||
bl_description = "Create and edit doors"
|
bl_description = "Create and edit doors"
|
||||||
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.door")
|
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.door")
|
||||||
bl_widget = None
|
bl_widget = None
|
||||||
|
ifc_element_type = "IfcDoorType"
|
||||||
|
|
||||||
def draw_settings(context, layout, ws_tool):
|
@classmethod
|
||||||
BimToolUI.draw(context, layout, ifc_element_type="IfcDoorType")
|
def draw_settings(cls, context, layout, ws_tool):
|
||||||
|
BimToolUI.draw(context, layout, ifc_element_type=cls.ifc_element_type)
|
||||||
|
|
||||||
|
|
||||||
class WindowTool(BimTool):
|
class WindowTool(BimTool):
|
||||||
@@ -117,9 +123,11 @@ class WindowTool(BimTool):
|
|||||||
bl_description = "Create and edit windows"
|
bl_description = "Create and edit windows"
|
||||||
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.window")
|
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.window")
|
||||||
bl_widget = None
|
bl_widget = None
|
||||||
|
ifc_element_type = "IfcWindowType"
|
||||||
|
|
||||||
def draw_settings(context, layout, ws_tool):
|
@classmethod
|
||||||
BimToolUI.draw(context, layout, ifc_element_type="IfcWindowType")
|
def draw_settings(cls, context, layout, ws_tool):
|
||||||
|
BimToolUI.draw(context, layout, ifc_element_type=cls.ifc_element_type)
|
||||||
|
|
||||||
|
|
||||||
class ColumnTool(BimTool):
|
class ColumnTool(BimTool):
|
||||||
@@ -130,9 +138,11 @@ class ColumnTool(BimTool):
|
|||||||
bl_description = "Create and edit columns"
|
bl_description = "Create and edit columns"
|
||||||
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.column")
|
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.column")
|
||||||
bl_widget = None
|
bl_widget = None
|
||||||
|
ifc_element_type = "IfcColumnType"
|
||||||
|
|
||||||
def draw_settings(context, layout, ws_tool):
|
@classmethod
|
||||||
BimToolUI.draw(context, layout, ifc_element_type="IfcColumnType")
|
def draw_settings(cls, context, layout, ws_tool):
|
||||||
|
BimToolUI.draw(context, layout, ifc_element_type=cls.ifc_element_type)
|
||||||
|
|
||||||
|
|
||||||
class BeamTool(BimTool):
|
class BeamTool(BimTool):
|
||||||
@@ -143,9 +153,11 @@ class BeamTool(BimTool):
|
|||||||
bl_description = "Create and edit beams"
|
bl_description = "Create and edit beams"
|
||||||
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.beam")
|
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.beam")
|
||||||
bl_widget = None
|
bl_widget = None
|
||||||
|
ifc_element_type = "IfcBeamType"
|
||||||
|
|
||||||
def draw_settings(context, layout, ws_tool):
|
@classmethod
|
||||||
BimToolUI.draw(context, layout, ifc_element_type="IfcBeamType")
|
def draw_settings(cls, context, layout, ws_tool):
|
||||||
|
BimToolUI.draw(context, layout, ifc_element_type=cls.ifc_element_type)
|
||||||
|
|
||||||
|
|
||||||
class DuctTool(BimTool):
|
class DuctTool(BimTool):
|
||||||
@@ -156,9 +168,11 @@ class DuctTool(BimTool):
|
|||||||
bl_description = "Create and edit ducks" # No, not a typo.
|
bl_description = "Create and edit ducks" # No, not a typo.
|
||||||
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.duct")
|
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.duct")
|
||||||
bl_widget = None
|
bl_widget = None
|
||||||
|
ifc_element_type = "IfcDuctSegmentType"
|
||||||
|
|
||||||
def draw_settings(context, layout, ws_tool):
|
@classmethod
|
||||||
BimToolUI.draw(context, layout, ifc_element_type="IfcDuctSegmentType")
|
def draw_settings(cls, context, layout, ws_tool):
|
||||||
|
BimToolUI.draw(context, layout, ifc_element_type=cls.ifc_element_type)
|
||||||
|
|
||||||
|
|
||||||
class PipeTool(BimTool):
|
class PipeTool(BimTool):
|
||||||
@@ -169,9 +183,11 @@ class PipeTool(BimTool):
|
|||||||
bl_description = "Create and edit pipes"
|
bl_description = "Create and edit pipes"
|
||||||
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.pipe")
|
bl_icon = os.path.join(os.path.dirname(__file__), "ops.authoring.pipe")
|
||||||
bl_widget = None
|
bl_widget = None
|
||||||
|
ifc_element_type = "IfcPipeSegmentType"
|
||||||
|
|
||||||
def draw_settings(context, layout, ws_tool):
|
@classmethod
|
||||||
BimToolUI.draw(context, layout, ifc_element_type="IfcPipeSegmentType")
|
def draw_settings(cls, context, layout, ws_tool):
|
||||||
|
BimToolUI.draw(context, layout, ifc_element_type=cls.ifc_element_type)
|
||||||
|
|
||||||
|
|
||||||
def add_layout_hotkey_operator(layout, text, hotkey, description):
|
def add_layout_hotkey_operator(layout, text, hotkey, description):
|
||||||
@@ -394,9 +410,7 @@ class BimToolUI:
|
|||||||
else:
|
else:
|
||||||
row.operator("bim.show_openings", icon="HIDE_OFF", text="")
|
row.operator("bim.show_openings", icon="HIDE_OFF", text="")
|
||||||
|
|
||||||
if AuthoringData.data["active_class"] in (
|
if AuthoringData.data["active_class"] in ("IfcOpeningElement",):
|
||||||
"IfcOpeningElement",
|
|
||||||
):
|
|
||||||
if len(context.selected_objects) == 2:
|
if len(context.selected_objects) == 2:
|
||||||
row = cls.layout.row(align=True)
|
row = cls.layout.row(align=True)
|
||||||
row.label(text="", icon="EVENT_SHIFT")
|
row.label(text="", icon="EVENT_SHIFT")
|
||||||
@@ -737,9 +751,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
self.props.z = self.z
|
self.props.z = self.z
|
||||||
|
|
||||||
def hotkey_S_L(self):
|
def hotkey_S_L(self):
|
||||||
if AuthoringData.data["active_class"] in (
|
if AuthoringData.data["active_class"] in ("IfcOpeningElement",):
|
||||||
"IfcOpeningElement",
|
|
||||||
):
|
|
||||||
if len(bpy.context.selected_objects) == 2:
|
if len(bpy.context.selected_objects) == 2:
|
||||||
bpy.ops.bim.clone_opening()
|
bpy.ops.bim.clone_opening()
|
||||||
|
|
||||||
@@ -764,3 +776,4 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
|
|
||||||
LIST_OF_TOOLS = [cls.bl_idname for cls in (BimTool.__subclasses__() + [BimTool])]
|
LIST_OF_TOOLS = [cls.bl_idname for cls in (BimTool.__subclasses__() + [BimTool])]
|
||||||
|
TOOLS_TO_CLASSES_MAP = {cls.bl_idname: cls.ifc_element_type for cls in BimTool.__subclasses__()}
|
||||||
|
|||||||
Reference in New Issue
Block a user