Skip to content

Commit 48eb6b7

Browse files
committed
You can now manually set the length/height of profiled extrusions
1 parent 5f2acb4 commit 48eb6b7

4 files changed

Lines changed: 57 additions & 12 deletions

File tree

src/blenderbim/blenderbim/bim/module/model/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
wall.RecalculateWall,
3636
wall.SplitWall,
3737
opening.AddElementOpening,
38+
profile.ChangeProfileDepth,
3839
profile.ExtendProfile,
3940
profile.RecalculateProfile,
4041
prop.BIMModelProperties,

src/blenderbim/blenderbim/bim/module/model/profile.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,23 @@ def join_E(self, profile1, target):
319319
body[1 if connection == "ATEND" else 0] = intersect
320320
self.recreate_profile(element1, profile1, axis, body)
321321

322+
def set_depth(self, profile1, length):
323+
element1 = tool.Ifc.get_entity(profile1)
324+
if not element1:
325+
return
326+
327+
ifcopenshell.api.run("geometry.disconnect_path", tool.Ifc.get(), element=element1, connection_type="ATEND")
328+
329+
axis1 = self.get_profile_axis(profile1)
330+
axis = copy.deepcopy(axis1)
331+
body = copy.deepcopy(axis1)
332+
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
333+
si_length = unit_scale * length
334+
end = profile1.matrix_world @ Vector((si_length, 0, 0))
335+
axis[1] = end
336+
body[1] = end
337+
self.recreate_profile(element1, profile1, axis, body)
338+
322339
def join_T(self, profile1, profile2):
323340
element1 = tool.Ifc.get_entity(profile1)
324341
element2 = tool.Ifc.get_entity(profile2)
@@ -893,3 +910,20 @@ def recalculate(self, profiles):
893910
for element, profile in queue:
894911
if element.is_a() in ("IfcColumn", "IfcBeam", "IfcMember") and profile:
895912
joiner.recreate_profile(element, profile)
913+
914+
915+
class ChangeProfileDepth(bpy.types.Operator):
916+
bl_idname = "bim.change_profile_depth"
917+
bl_label = "Change Profile Length"
918+
bl_options = {"REGISTER", "UNDO"}
919+
depth: bpy.props.FloatProperty()
920+
921+
@classmethod
922+
def poll(cls, context):
923+
return context.selected_objects
924+
925+
def execute(self, context):
926+
joiner = DumbProfileJoiner()
927+
for obj in context.selected_objects:
928+
joiner.set_depth(obj, self.depth)
929+
return {"FINISHED"}

src/blenderbim/blenderbim/bim/module/model/wall.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ def poll(cls, context):
226226
return context.selected_objects
227227

228228
def execute(self, context):
229+
wall_objs = []
229230
for obj in context.selected_objects:
230231
element = tool.Ifc.get_entity(obj)
231232
if not element:
@@ -237,7 +238,10 @@ def execute(self, context):
237238
if not extrusion:
238239
return
239240
extrusion.Depth = self.depth
240-
DumbWallRecalculator().recalculate(context.selected_objects)
241+
if element.is_a("IfcWall"):
242+
wall_objs.append(obj)
243+
if wall_objs:
244+
DumbWallRecalculator().recalculate(wall_objs)
241245
return {"FINISHED"}
242246

243247
def get_extrusion(self, representation):

src/blenderbim/blenderbim/bim/module/model/workspace.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,23 @@ def draw_settings(context, layout, tool):
147147
row = layout.row(align=True)
148148
row.label(text="", icon="EVENT_SHIFT")
149149
row.label(text="", icon="EVENT_E")
150-
row.operator("bim.hotkey", text="Extend").hotkey="S_E"
150+
row.operator("bim.hotkey", text="Extend").hotkey = "S_E"
151151
row = layout.row(align=True)
152152
row.label(text="", icon="EVENT_SHIFT")
153153
row.label(text="", icon="EVENT_T")
154-
row.operator("bim.hotkey", text="Butt").hotkey="S_T"
154+
row.operator("bim.hotkey", text="Butt").hotkey = "S_T"
155155
row = layout.row(align=True)
156156
row.label(text="", icon="EVENT_SHIFT")
157157
row.label(text="", icon="EVENT_Y")
158-
row.operator("bim.hotkey", text="Mitre").hotkey="S_Y"
158+
row.operator("bim.hotkey", text="Mitre").hotkey = "S_Y"
159159
row = layout.row(align=True)
160160
row.label(text="", icon="EVENT_SHIFT")
161161
row.label(text="", icon="EVENT_G")
162-
row.operator("bim.hotkey", text="Regen Connections").hotkey="S_G"
162+
row.operator("bim.hotkey", text="Regen Connections").hotkey = "S_G"
163163
row = layout.row(align=True)
164164
row.label(text="", icon="EVENT_SHIFT")
165165
row.label(text="", icon="EVENT_M")
166-
row.operator("bim.hotkey", text="Merge").hotkey="S_M"
166+
row.operator("bim.hotkey", text="Merge").hotkey = "S_M"
167167
row = layout.row(align=True)
168168
row.operator("bim.join_wall", icon="X", text="Disconnect").join_type = ""
169169

@@ -172,31 +172,37 @@ def draw_settings(context, layout, tool):
172172
row = layout.row(align=True)
173173
row.label(text="", icon="EVENT_SHIFT")
174174
row.label(text="", icon="EVENT_F")
175-
row.operator("bim.hotkey", text="Flip").hotkey="S_F"
175+
row.operator("bim.hotkey", text="Flip").hotkey = "S_F"
176176
row = layout.row(align=True)
177177
row.label(text="", icon="EVENT_SHIFT")
178178
row.label(text="", icon="EVENT_S")
179-
row.operator("bim.hotkey", text="Split").hotkey="S_S"
179+
row.operator("bim.hotkey", text="Split").hotkey = "S_S"
180180

181181
if ifc_class in ("IfcColumnType", "IfcBeamType", "IfcMemberType"):
182+
row = layout.row(align=True)
183+
label = "Height" if ifc_class == "IfcColumnType" else "Length"
184+
row.prop(data=props, property="extrusion_depth", text=label)
185+
op = row.operator("bim.change_profile_depth", icon="FILE_REFRESH", text="")
186+
op.depth = props.extrusion_depth
187+
182188
row = layout.row()
183189
row.label(text="Join")
184190
row = layout.row(align=True)
185191
row.label(text="", icon="EVENT_SHIFT")
186192
row.label(text="", icon="EVENT_E")
187-
row.operator("bim.hotkey", text="Extend").hotkey="S_E"
193+
row.operator("bim.hotkey", text="Extend").hotkey = "S_E"
188194
row = layout.row(align=True)
189195
row.label(text="", icon="EVENT_SHIFT")
190196
row.label(text="", icon="EVENT_T")
191-
row.operator("bim.hotkey", text="Butt").hotkey="S_T"
197+
row.operator("bim.hotkey", text="Butt").hotkey = "S_T"
192198
row = layout.row(align=True)
193199
row.label(text="", icon="EVENT_SHIFT")
194200
row.label(text="", icon="EVENT_Y")
195-
row.operator("bim.hotkey", text="Mitre").hotkey="S_Y"
201+
row.operator("bim.hotkey", text="Mitre").hotkey = "S_Y"
196202
row = layout.row(align=True)
197203
row.label(text="", icon="EVENT_SHIFT")
198204
row.label(text="", icon="EVENT_G")
199-
row.operator("bim.hotkey", text="Regen Connections").hotkey="S_G"
205+
row.operator("bim.hotkey", text="Regen Connections").hotkey = "S_G"
200206
row = layout.row(align=True)
201207
row.operator("bim.extend_profile", icon="X", text="Disconnect").join_type = ""
202208

0 commit comments

Comments
 (0)