Add generate space button in UI in N-Panel -> BlenderBim -> Architectural

This commit is contained in:
Massimo Fabbro
2023-04-23 08:21:20 +02:00
committed by Massimo Fabbro
parent 8ee0a1611d
commit 9118e529e6
2 changed files with 16 additions and 1 deletions
@@ -33,6 +33,13 @@ class GenerateSpace(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.generate_space"
bl_label = "Generate Space"
bl_options = {"REGISTER"}
bl_description = "Create a space from the cursor position. Move the cursor position into the desired position, select the right space collection and run the operator"
@classmethod
def poll(cls, context):
collection = context.view_layer.active_layer_collection.collection
collection_obj = bpy.data.objects.get(collection.name)
return tool.Ifc.get_entity(collection_obj)
def _execute(self, context):
# This only works based on a 2D plan only considering the standard
@@ -177,9 +184,15 @@ class GenerateSpacesFromWalls(bpy.types.Operator, tool.Ifc.Operator):
@classmethod
def poll(cls, context):
return context.selected_objects
active_obj = bpy.context.active_object
element = tool.Ifc.get_entity(active_obj)
return context.selected_objects and element.is_a("IfcWall")
def _execute(self, context):
# This only works based on a 2D plan only considering the standard
# walls (i.e. prismatic) in the active object storey.
# In order to run, the active objct must be a wall and
# have to be selected walls
props = context.scene.BIMModelProperties
active_obj = bpy.context.active_object
@@ -136,6 +136,8 @@ class BIM_PT_authoring(Panel):
row.operator("bim.align_wall", icon="ANCHOR_CENTER", text="C/L").align_type = "CENTERLINE"
row.operator("bim.align_wall", icon="ANCHOR_BOTTOM", text="Int.").align_type = "INTERIOR"
row = self.layout.row(align=True)
row.operator("bim.generate_space")
row = self.layout.row(align=True)
row.operator("bim.generate_spaces_from_walls")