mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
You can now set an exact wall length
This commit is contained in:
@@ -28,6 +28,7 @@ classes = (
|
||||
workspace.Hotkey,
|
||||
wall.AlignWall,
|
||||
wall.ChangeExtrusionDepth,
|
||||
wall.ChangeLayerLength,
|
||||
wall.FlipWall,
|
||||
wall.JoinWall,
|
||||
wall.MergeWall,
|
||||
|
||||
@@ -121,6 +121,7 @@ class BIMModelProperties(PropertyGroup):
|
||||
occurrence_name_function: bpy.props.StringProperty(name="Occurrence Name Function")
|
||||
getter_enum = {"ifc_class": get_ifc_class, "relating_type": get_relating_type}
|
||||
extrusion_depth: bpy.props.FloatProperty(default=42.0)
|
||||
length: bpy.props.FloatProperty(default=42.0)
|
||||
|
||||
|
||||
def get_relating_type_info(self, context):
|
||||
|
||||
@@ -250,6 +250,24 @@ class ChangeExtrusionDepth(bpy.types.Operator):
|
||||
else:
|
||||
break
|
||||
|
||||
|
||||
class ChangeLayerLength(bpy.types.Operator):
|
||||
bl_idname = "bim.change_layer_length"
|
||||
bl_label = "Change Layer Length"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
length: bpy.props.FloatProperty()
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.selected_objects
|
||||
|
||||
def execute(self, context):
|
||||
joiner = DumbWallJoiner()
|
||||
for obj in context.selected_objects:
|
||||
joiner.set_length(obj, self.length)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
def recalculate_dumb_wall_origin(wall, new_origin=None):
|
||||
if new_origin is None:
|
||||
new_origin = wall.matrix_world @ Vector(wall.bound_box[0])
|
||||
@@ -911,6 +929,23 @@ class DumbWallJoiner:
|
||||
body[1 if connection == "ATEND" else 0] = intersect
|
||||
self.recreate_wall(element1, wall1, axis, body)
|
||||
|
||||
def set_length(self, wall1, length):
|
||||
element1 = tool.Ifc.get_entity(wall1)
|
||||
if not element1:
|
||||
return
|
||||
|
||||
ifcopenshell.api.run("geometry.disconnect_path", tool.Ifc.get(), element=element1, connection_type="ATEND")
|
||||
|
||||
axis1 = self.get_wall_axis(wall1)
|
||||
axis = copy.deepcopy(axis1["reference"])
|
||||
body = copy.deepcopy(axis1["reference"])
|
||||
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
si_length = unit_scale * length
|
||||
end = (wall1.matrix_world @ Vector((si_length, 0, 0))).to_2d()
|
||||
axis[1] = end
|
||||
body[1] = end
|
||||
self.recreate_wall(element1, wall1, axis, body)
|
||||
|
||||
def join_T(self, wall1, wall2):
|
||||
element1 = tool.Ifc.get_entity(wall1)
|
||||
element2 = tool.Ifc.get_entity(wall2)
|
||||
|
||||
@@ -136,6 +136,11 @@ class BimTool(WorkSpaceTool):
|
||||
op = row.operator("bim.change_extrusion_depth", icon="FILE_REFRESH", text="")
|
||||
op.depth = props.extrusion_depth
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(data=props, property="length", text="Length")
|
||||
op = row.operator("bim.change_layer_length", icon="FILE_REFRESH", text="")
|
||||
op.length = props.length
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="Join")
|
||||
row = layout.row(align=True)
|
||||
|
||||
Reference in New Issue
Block a user