mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
You can now recalculate connections manually for profiles
This commit is contained in:
@@ -36,6 +36,7 @@ classes = (
|
||||
wall.SplitWall,
|
||||
opening.AddElementOpening,
|
||||
profile.ExtendProfile,
|
||||
profile.RecalculateProfile,
|
||||
prop.BIMModelProperties,
|
||||
prop.ConstrTypeInfo,
|
||||
ui.BIM_PT_authoring,
|
||||
|
||||
@@ -863,3 +863,33 @@ class DumbProfileJoiner:
|
||||
final = {"contact": contact, "distance": distance, "end": result[2], "direction": result[3]}
|
||||
|
||||
return final
|
||||
|
||||
|
||||
class RecalculateProfile(bpy.types.Operator):
|
||||
bl_idname = "bim.recalculate_profile"
|
||||
bl_label = "Recalculate Profile"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.selected_objects
|
||||
|
||||
def execute(self, context):
|
||||
DumbProfileRecalculator().recalculate(context.selected_objects)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class DumbProfileRecalculator:
|
||||
def recalculate(self, profiles):
|
||||
queue = set()
|
||||
for profile in profiles:
|
||||
element = tool.Ifc.get_entity(profile)
|
||||
queue.add((element, profile))
|
||||
for rel in getattr(element, "ConnectedTo", []):
|
||||
queue.add((rel.RelatedElement, tool.Ifc.get_object(rel.RelatedElement)))
|
||||
for rel in getattr(element, "ConnectedFrom", []):
|
||||
queue.add((rel.RelatingElement, tool.Ifc.get_object(rel.RelatingElement)))
|
||||
joiner = DumbProfileJoiner()
|
||||
for element, profile in queue:
|
||||
if element.is_a() in ("IfcColumn", "IfcBeam", "IfcMember") and profile:
|
||||
joiner.recreate_profile(element, profile)
|
||||
|
||||
@@ -194,6 +194,10 @@ class BimTool(WorkSpaceTool):
|
||||
row.label(text="", icon="EVENT_Y")
|
||||
row.operator("bim.hotkey", text="Mitre").hotkey="S_Y"
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="", icon="EVENT_G")
|
||||
row.operator("bim.hotkey", text="Regen Connections").hotkey="S_G"
|
||||
row = layout.row(align=True)
|
||||
row.operator("bim.extend_profile", icon="X", text="Disconnect").join_type = ""
|
||||
|
||||
if props.ifc_class in (
|
||||
@@ -280,6 +284,8 @@ class Hotkey(bpy.types.Operator):
|
||||
def hotkey_S_G(self):
|
||||
if self.has_ifc_class and self.props.ifc_class == "IfcWallType":
|
||||
bpy.ops.bim.recalculate_wall()
|
||||
elif self.props.ifc_class in ["IfcColumnType", "IfcBeamType", "IfcMemberType"]:
|
||||
bpy.ops.bim.recalculate_profile()
|
||||
|
||||
def hotkey_S_T(self):
|
||||
if not self.has_ifc_class:
|
||||
|
||||
Reference in New Issue
Block a user