diff --git a/src/ifcblenderexport/blenderbim/bim/__init__.py b/src/ifcblenderexport/blenderbim/bim/__init__.py index 34d96b2131..6f57a856fe 100644 --- a/src/ifcblenderexport/blenderbim/bim/__init__.py +++ b/src/ifcblenderexport/blenderbim/bim/__init__.py @@ -172,6 +172,7 @@ if bpy is not None: operator.CalculateEdgeLengths, operator.CalculateFaceAreas, operator.CalculateObjectVolumes, + operator.AddOpening, prop.StrProperty, prop.Variable, prop.Role, @@ -216,7 +217,6 @@ if bpy is not None: ui.BIM_PT_documentation, ui.BIM_PT_bim, ui.BIM_PT_psets, - ui.BIM_PT_qto, ui.BIM_PT_classifications, ui.BIM_PT_document_information, ui.BIM_PT_constraints, @@ -247,6 +247,8 @@ if bpy is not None: ui.BIM_PT_object_structural, ui.BIM_PT_camera, ui.BIM_PT_text, + ui.BIM_PT_modeling_utilities, + ui.BIM_PT_qto_utilities, ui.BIM_UL_generic, ui.BIM_UL_clash_sets, ui.BIM_UL_constraints, @@ -298,6 +300,7 @@ if bpy is not None: bpy.types.Camera.BIMCameraProperties = bpy.props.PointerProperty(type=prop.BIMCameraProperties) bpy.types.TextCurve.BIMTextProperties = bpy.props.PointerProperty(type=prop.BIMTextProperties) bpy.types.Scene.CoveToolProperties = bpy.props.PointerProperty(type=covetool_prop.CoveToolProperties) + bpy.types.SCENE_PT_unit.append(ui.ifc_units) def unregister(): for cls in reversed(classes): @@ -316,3 +319,4 @@ if bpy is not None: del(bpy.types.Mesh.BIMMeshProperties) del(bpy.types.Camera.BIMCameraProperties) del(bpy.types.Camera.BIMTextProperties) + bpy.types.SCENE_PT_unit.remove(ui.ifc_units) diff --git a/src/ifcblenderexport/blenderbim/bim/operator.py b/src/ifcblenderexport/blenderbim/bim/operator.py index 9c7de14615..cfa042b6d6 100644 --- a/src/ifcblenderexport/blenderbim/bim/operator.py +++ b/src/ifcblenderexport/blenderbim/bim/operator.py @@ -3394,3 +3394,19 @@ class CalculateObjectVolumes(bpy.types.Operator): result += qto_calculator.get_volume(obj) bpy.context.scene.BIMProperties.qto_result = str(round(result, 3)) return {'FINISHED'} + + +class AddOpening(bpy.types.Operator): + bl_idname = 'bim.add_opening' + bl_label = 'Add Opening' + + def execute(self, context): + opening = context.active_object + if context.selected_objects[0] != context.active_object: + obj = context.selected_objects[0] + else: + obj = context.selected_objects[1] + modifier = obj.modifiers.new('IfcOpeningElement', 'BOOLEAN') + modifier.operation = 'DIFFERENCE' + modifier.object = opening + return {'FINISHED'} diff --git a/src/ifcblenderexport/blenderbim/bim/prop.py b/src/ifcblenderexport/blenderbim/bim/prop.py index 3021142234..3406f2ddd2 100644 --- a/src/ifcblenderexport/blenderbim/bim/prop.py +++ b/src/ifcblenderexport/blenderbim/bim/prop.py @@ -1088,8 +1088,8 @@ class BIMProperties(PropertyGroup): ifc_patch_output: StringProperty(default='', name='IFC Patch Output IFC') ifc_patch_args: StringProperty(default='', name='Arguments') qto_result: StringProperty(default='', name='Qto Result') - area_unit: StringProperty(default='', name='Area Unit') - volume_unit: StringProperty(default='', name='Volume Unit') + area_unit: StringProperty(default='', name='IFC Area Unit') + volume_unit: StringProperty(default='', name='IFC Volume Unit') class BCFProperties(PropertyGroup): diff --git a/src/ifcblenderexport/blenderbim/bim/ui.py b/src/ifcblenderexport/blenderbim/bim/ui.py index 9305c23d78..486190d2f8 100644 --- a/src/ifcblenderexport/blenderbim/bim/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/ui.py @@ -498,39 +498,6 @@ class BIM_PT_psets(Panel): row.operator('bim.remove_property_template', icon='X', text='').index = index -class BIM_PT_qto(Panel): - bl_label = 'IFC Quantity Take-off' - bl_idname = 'BIM_PT_qto' - bl_options = {'DEFAULT_CLOSED'} - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = 'scene' - - def draw(self, context): - layout = self.layout - layout.use_property_split = True - props = context.scene.BIMProperties - - row = layout.row() - layout.label(text="Units:") - row = layout.row() - row.prop(props, 'area_unit') - row = layout.row() - row.prop(props, 'volume_unit') - - row = layout.row() - layout.label(text="Results:") - row = layout.row() - row.prop(props, 'qto_result', text='') - - row = layout.row(align=True) - row.operator("bim.calculate_edge_lengths") - row = layout.row(align=True) - row.operator("bim.calculate_face_areas") - row = layout.row(align=True) - row.operator("bim.calculate_object_volumes") - - class BIM_PT_classifications(Panel): bl_label = 'IFC Classifications References' bl_idname = 'BIM_PT_classifications' @@ -1839,3 +1806,53 @@ class BIM_PT_ifcclash(Panel): row = layout.row() row.operator('bim.select_ifc_clash_results') + + +class BIM_PT_modeling_utilities(Panel): + bl_idname = "BIM_PT_modeling_utilities" + bl_label = "Architectural" + bl_space_type = 'VIEW_3D' + bl_region_type = "UI" + bl_category = 'BlenderBIM' + + def draw(self, context): + layout = self.layout + + row = layout.row(align=True) + row.operator("bim.add_opening") + + +class BIM_PT_qto_utilities(Panel): + bl_idname = "BIM_PT_qto_utilities" + bl_label = "Quantity Take-off" + bl_space_type = 'VIEW_3D' + bl_region_type = "UI" + bl_category = 'BlenderBIM' + + def draw(self, context): + layout = self.layout + props = context.scene.BIMProperties + + row = layout.row() + layout.label(text="Results:") + row = layout.row() + row.prop(props, 'qto_result', text='') + + row = layout.row(align=True) + row.operator("bim.calculate_edge_lengths") + row = layout.row(align=True) + row.operator("bim.calculate_face_areas") + row = layout.row(align=True) + row.operator("bim.calculate_object_volumes") + + +def ifc_units(self, context): + scene = context.scene + props = context.scene.BIMProperties + layout = self.layout + layout.use_property_decorate = False + layout.use_property_split = True + row = layout.row() + row.prop(props, 'area_unit') + row = layout.row() + row.prop(props, 'volume_unit')