mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-14 03:14:23 +00:00
Implement profile unjoin and start cleaning up legacy architectural tools panel
This commit is contained in:
@@ -260,7 +260,9 @@ class ExtendProfile(bpy.types.Operator):
|
||||
for obj in selected_objs:
|
||||
bpy.ops.bim.dynamically_void_product(obj=obj.name)
|
||||
joiner = DumbProfileJoiner()
|
||||
if len(selected_objs) == 0:
|
||||
if not self.join_type:
|
||||
for obj in selected_objs:
|
||||
joiner.unjoin(obj)
|
||||
return {"FINISHED"}
|
||||
if not context.active_object:
|
||||
return {"FINISHED"}
|
||||
@@ -285,6 +287,19 @@ class DumbProfileJoiner:
|
||||
self.axis_context = ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Axis", "GRAPH_VIEW")
|
||||
self.body_context = ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Body", "MODEL_VIEW")
|
||||
|
||||
def unjoin(self, profile1):
|
||||
element1 = tool.Ifc.get_entity(profile1)
|
||||
if not element1:
|
||||
return
|
||||
|
||||
ifcopenshell.api.run("geometry.disconnect_path", tool.Ifc.get(), element=element1, connection_type="ATSTART")
|
||||
ifcopenshell.api.run("geometry.disconnect_path", tool.Ifc.get(), element=element1, connection_type="ATEND")
|
||||
|
||||
axis1 = self.get_profile_axis(profile1)
|
||||
axis = copy.deepcopy(axis1)
|
||||
body = copy.deepcopy(axis1)
|
||||
self.recreate_profile(element1, profile1, axis, body)
|
||||
|
||||
def join_E(self, profile1, target):
|
||||
element1 = tool.Ifc.get_entity(profile1)
|
||||
if not element1:
|
||||
|
||||
@@ -29,11 +29,6 @@ class BIM_PT_authoring(Panel):
|
||||
bl_category = "BlenderBIM"
|
||||
|
||||
def draw(self, context):
|
||||
row = self.layout.row(align=True)
|
||||
row.operator("bim.join_wall", icon="MOD_SKIN", text="T").join_type = "T"
|
||||
row.operator("bim.join_wall", icon="MOD_SKIN", text="L").join_type = "L"
|
||||
row.operator("bim.join_wall", icon="MOD_SKIN", text="V").join_type = "V"
|
||||
row.operator("bim.join_wall", icon="X", text="").join_type = ""
|
||||
row = self.layout.row(align=True)
|
||||
row.operator("bim.align_wall", icon="ANCHOR_TOP", text="Ext.").align_type = "EXTERIOR"
|
||||
row.operator("bim.align_wall", icon="ANCHOR_CENTER", text="C/L").align_type = "CENTERLINE"
|
||||
|
||||
@@ -40,18 +40,18 @@ class BimTool(WorkSpaceTool):
|
||||
# ("bim.wall_tool_op", {"type": 'MOUSEMOVE', "value": 'ANY'}, {"properties": []}),
|
||||
# ("mesh.add_wall", {"type": 'LEFTMOUSE', "value": 'PRESS'}, {"properties": []}),
|
||||
("bim.hotkey", {"type": "A", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_A")]}),
|
||||
("bim.hotkey", {"type": "E", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_E")]}),
|
||||
("bim.hotkey", {"type": "T", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_T")]}),
|
||||
("bim.recalculate_wall", {"type": "Y", "value": "PRESS", "shift": True}, {"properties": []}),
|
||||
("bim.merge_wall", {"type": "M", "value": "PRESS", "shift": True}, {"properties": []}),
|
||||
("bim.flip_wall", {"type": "F", "value": "PRESS", "shift": True}, {"properties": []}),
|
||||
("bim.split_wall", {"type": "S", "value": "PRESS", "shift": True}, {"properties": []}),
|
||||
("bim.hotkey", {"type": "X", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_X")]}),
|
||||
("bim.hotkey", {"type": "C", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_C")]}),
|
||||
("bim.hotkey", {"type": "V", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_V")]}),
|
||||
("bim.hotkey", {"type": "E", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_E")]}),
|
||||
("bim.hotkey", {"type": "F", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_F")]}),
|
||||
("bim.hotkey", {"type": "M", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_M")]}),
|
||||
("bim.hotkey", {"type": "O", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_O")]}),
|
||||
("bim.hotkey", {"type": "O", "value": "PRESS", "alt": True}, {"properties": [("hotkey", "A_O")]}),
|
||||
("bim.hotkey", {"type": "S", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_S")]}),
|
||||
("bim.hotkey", {"type": "T", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_T")]}),
|
||||
("bim.hotkey", {"type": "V", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_V")]}),
|
||||
("bim.hotkey", {"type": "X", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_X")]}),
|
||||
("bim.hotkey", {"type": "Y", "value": "PRESS", "shift": True}, {"properties": [("hotkey", "S_Y")]}),
|
||||
("bim.hotkey", {"type": "D", "value": "PRESS", "alt": True}, {"properties": [("hotkey", "A_D")]}),
|
||||
("bim.hotkey", {"type": "O", "value": "PRESS", "alt": True}, {"properties": [("hotkey", "A_O")]}),
|
||||
)
|
||||
|
||||
def draw_settings(context, layout, tool):
|
||||
@@ -145,32 +145,47 @@ class BimTool(WorkSpaceTool):
|
||||
row.label(text="Join")
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="Extend", icon="EVENT_E")
|
||||
row.label(text="", icon="EVENT_E")
|
||||
row.operator("bim.hotkey", text="Extend").hotkey="S_E"
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="Butt", icon="EVENT_T")
|
||||
row.label(text="", icon="EVENT_T")
|
||||
row.operator("bim.hotkey", text="Butt").hotkey="S_T"
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="Regen Connections", icon="EVENT_Y")
|
||||
row.label(text="", icon="EVENT_Y")
|
||||
row.operator("bim.hotkey", text="Regen Connections").hotkey="S_Y"
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="Merge", icon="EVENT_M")
|
||||
row.label(text="", icon="EVENT_M")
|
||||
row.operator("bim.hotkey", text="Merge").hotkey="S_M"
|
||||
row = layout.row(align=True)
|
||||
row.operator("bim.join_wall", icon="X", text="Disconnect").join_type = ""
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="Wall Tools")
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="Flip", icon="EVENT_F")
|
||||
row.label(text="", icon="EVENT_F")
|
||||
row.operator("bim.hotkey", text="Flip").hotkey="S_F"
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="Split", icon="EVENT_S")
|
||||
row.label(text="", icon="EVENT_S")
|
||||
row.operator("bim.hotkey", text="Split").hotkey="S_S"
|
||||
|
||||
if ifc_class in ("IfcColumnType", "IfcBeamType", "IfcMemberType"):
|
||||
row = layout.row()
|
||||
row.label(text="Join")
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="Extend", icon="EVENT_E")
|
||||
row.label(text="", icon="EVENT_E")
|
||||
row.operator("bim.hotkey", text="Extend").hotkey="S_E"
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="", icon="EVENT_T")
|
||||
row.operator("bim.hotkey", text="Butt").hotkey="S_T"
|
||||
row = layout.row(align=True)
|
||||
row.operator("bim.extend_profile", icon="X", text="Disconnect").join_type = ""
|
||||
|
||||
if props.ifc_class in (
|
||||
"IfcCableCarrierSegmentType",
|
||||
@@ -270,6 +285,22 @@ class Hotkey(bpy.types.Operator):
|
||||
else:
|
||||
bpy.ops.bim.align_product(align_type="NEGATIVE")
|
||||
|
||||
def hotkey_S_F(self):
|
||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
||||
bpy.ops.bim.flip_wall()
|
||||
|
||||
def hotkey_S_S(self):
|
||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
||||
bpy.ops.bim.split_wall()
|
||||
|
||||
def hotkey_S_M(self):
|
||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
||||
bpy.ops.bim.merge_wall()
|
||||
|
||||
def hotkey_S_Y(self):
|
||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
||||
bpy.ops.bim.recalculate_wall()
|
||||
|
||||
def hotkey_S_O(self):
|
||||
bpy.ops.bim.add_element_opening(voided_building_element="", filling_building_element="")
|
||||
|
||||
|
||||
@@ -83,17 +83,19 @@ class Cad:
|
||||
return math.degrees(a) if degrees else a
|
||||
|
||||
@classmethod
|
||||
def is_x(cls, value, x):
|
||||
def is_x(cls, value, x, tolerance=None):
|
||||
"""
|
||||
> takes a value and a target of x, either as a single value x or an interable of values
|
||||
< returns if the value is equivalent to x within a tolerance
|
||||
"""
|
||||
if tolerance is None:
|
||||
tolerance = VTX_PRECISION
|
||||
if isinstance(x, (list, tuple)):
|
||||
for y in x:
|
||||
if value > (y - VTX_PRECISION) and value < (y + VTX_PRECISION):
|
||||
if value > (y - tolerance) and value < (y + tolerance):
|
||||
return True
|
||||
return False
|
||||
return value > (x - VTX_PRECISION) and value < (x + VTX_PRECISION)
|
||||
return value > (x - tolerance) and value < (x + tolerance)
|
||||
|
||||
@classmethod
|
||||
def intersect_edges(cls, edge1, edge2):
|
||||
|
||||
Reference in New Issue
Block a user