mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 11:43:53 +00:00
You can now manually set the length/height of profiled extrusions
This commit is contained in:
@@ -35,6 +35,7 @@ classes = (
|
||||
wall.RecalculateWall,
|
||||
wall.SplitWall,
|
||||
opening.AddElementOpening,
|
||||
profile.ChangeProfileDepth,
|
||||
profile.ExtendProfile,
|
||||
profile.RecalculateProfile,
|
||||
prop.BIMModelProperties,
|
||||
|
||||
@@ -319,6 +319,23 @@ class DumbProfileJoiner:
|
||||
body[1 if connection == "ATEND" else 0] = intersect
|
||||
self.recreate_profile(element1, profile1, axis, body)
|
||||
|
||||
def set_depth(self, profile1, length):
|
||||
element1 = tool.Ifc.get_entity(profile1)
|
||||
if not element1:
|
||||
return
|
||||
|
||||
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)
|
||||
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
si_length = unit_scale * length
|
||||
end = profile1.matrix_world @ Vector((si_length, 0, 0))
|
||||
axis[1] = end
|
||||
body[1] = end
|
||||
self.recreate_profile(element1, profile1, axis, body)
|
||||
|
||||
def join_T(self, profile1, profile2):
|
||||
element1 = tool.Ifc.get_entity(profile1)
|
||||
element2 = tool.Ifc.get_entity(profile2)
|
||||
@@ -893,3 +910,20 @@ class DumbProfileRecalculator:
|
||||
for element, profile in queue:
|
||||
if element.is_a() in ("IfcColumn", "IfcBeam", "IfcMember") and profile:
|
||||
joiner.recreate_profile(element, profile)
|
||||
|
||||
|
||||
class ChangeProfileDepth(bpy.types.Operator):
|
||||
bl_idname = "bim.change_profile_depth"
|
||||
bl_label = "Change Profile Length"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
depth: bpy.props.FloatProperty()
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.selected_objects
|
||||
|
||||
def execute(self, context):
|
||||
joiner = DumbProfileJoiner()
|
||||
for obj in context.selected_objects:
|
||||
joiner.set_depth(obj, self.depth)
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -226,6 +226,7 @@ class ChangeExtrusionDepth(bpy.types.Operator):
|
||||
return context.selected_objects
|
||||
|
||||
def execute(self, context):
|
||||
wall_objs = []
|
||||
for obj in context.selected_objects:
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
if not element:
|
||||
@@ -237,7 +238,10 @@ class ChangeExtrusionDepth(bpy.types.Operator):
|
||||
if not extrusion:
|
||||
return
|
||||
extrusion.Depth = self.depth
|
||||
DumbWallRecalculator().recalculate(context.selected_objects)
|
||||
if element.is_a("IfcWall"):
|
||||
wall_objs.append(obj)
|
||||
if wall_objs:
|
||||
DumbWallRecalculator().recalculate(wall_objs)
|
||||
return {"FINISHED"}
|
||||
|
||||
def get_extrusion(self, representation):
|
||||
|
||||
@@ -147,23 +147,23 @@ class BimTool(WorkSpaceTool):
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="", icon="EVENT_E")
|
||||
row.operator("bim.hotkey", text="Extend").hotkey="S_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.operator("bim.hotkey", text="Butt").hotkey = "S_T"
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="", icon="EVENT_Y")
|
||||
row.operator("bim.hotkey", text="Mitre").hotkey="S_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.operator("bim.hotkey", text="Regen Connections").hotkey = "S_G"
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="", icon="EVENT_M")
|
||||
row.operator("bim.hotkey", text="Merge").hotkey="S_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 = ""
|
||||
|
||||
@@ -172,31 +172,37 @@ class BimTool(WorkSpaceTool):
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="", icon="EVENT_F")
|
||||
row.operator("bim.hotkey", text="Flip").hotkey="S_F"
|
||||
row.operator("bim.hotkey", text="Flip").hotkey = "S_F"
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="", icon="EVENT_S")
|
||||
row.operator("bim.hotkey", text="Split").hotkey="S_S"
|
||||
row.operator("bim.hotkey", text="Split").hotkey = "S_S"
|
||||
|
||||
if ifc_class in ("IfcColumnType", "IfcBeamType", "IfcMemberType"):
|
||||
row = layout.row(align=True)
|
||||
label = "Height" if ifc_class == "IfcColumnType" else "Length"
|
||||
row.prop(data=props, property="extrusion_depth", text=label)
|
||||
op = row.operator("bim.change_profile_depth", icon="FILE_REFRESH", text="")
|
||||
op.depth = props.extrusion_depth
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="Join")
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="", icon="EVENT_E")
|
||||
row.operator("bim.hotkey", text="Extend").hotkey="S_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.operator("bim.hotkey", text="Butt").hotkey = "S_T"
|
||||
row = layout.row(align=True)
|
||||
row.label(text="", icon="EVENT_SHIFT")
|
||||
row.label(text="", icon="EVENT_Y")
|
||||
row.operator("bim.hotkey", text="Mitre").hotkey="S_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.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 = ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user