diff --git a/src/ifcblenderexport/blenderbim/__init__.py b/src/ifcblenderexport/blenderbim/__init__.py index 6a668e7c2f..e1a5418e2f 100644 --- a/src/ifcblenderexport/blenderbim/__init__.py +++ b/src/ifcblenderexport/blenderbim/__init__.py @@ -100,6 +100,7 @@ if bpy is not None: prop.MapConversion, prop.TargetCRS, prop.Attribute, + prop.BoundaryCondition, prop.Pset, prop.Document, prop.Classification, diff --git a/src/ifcblenderexport/blenderbim/prop.py b/src/ifcblenderexport/blenderbim/prop.py index 9eaa6a3921..f049335d1e 100644 --- a/src/ifcblenderexport/blenderbim/prop.py +++ b/src/ifcblenderexport/blenderbim/prop.py @@ -8,6 +8,7 @@ import bpy from bpy.types import PropertyGroup from bpy.app.handlers import persistent from bpy.props import ( + PointerProperty, StringProperty, EnumProperty, BoolProperty, @@ -93,6 +94,20 @@ def getDiagramScales(self, context): return diagram_scales_enum +def getBoundaryConditionClasses(self, context): + return [(c, c, '') for c in + ['IfcBoundaryEdgeCondition', 'IfcBoundaryFaceCondition', + 'IfcBoundaryNodeCondition', 'IfcBoundaryNodeConditionWarping']] + + +def refreshBoundaryConditionAttributes(self, context): + while len(context.active_object.BIMObjectProperties.boundary_condition.attributes) > 0: + context.active_object.BIMObjectProperties.boundary_condition.attributes.remove(0) + for attribute in schema.ifc.elements[context.active_object.BIMObjectProperties.boundary_condition.name]['complex_attributes']: + new_attribute = context.active_object.BIMObjectProperties.boundary_condition.attributes.add() + new_attribute.name = attribute['name'] + + def getIfcProducts(self, context): global products_enum if len(products_enum) < 1: @@ -396,6 +411,11 @@ class GlobalId(PropertyGroup): name: StringProperty(name="Name") +class BoundaryCondition(PropertyGroup): + name: EnumProperty(items=getBoundaryConditionClasses, name='Boundary Type', update=refreshBoundaryConditionAttributes) + attributes: CollectionProperty(name="Attributes", type=Attribute) + + class BIMObjectProperties(PropertyGroup): global_ids: CollectionProperty(name="GlobalIds", type=GlobalId) attributes: CollectionProperty(name="Attributes", type=Attribute) @@ -407,6 +427,8 @@ class BIMObjectProperties(PropertyGroup): material_type: EnumProperty(items=getMaterialTypes, name="Material Type") override_psets: CollectionProperty(name="Override Psets", type=Pset) override_pset_name: StringProperty(name="Override Pset Name") + has_boundary_condition: BoolProperty(name='Has Boundary Condition') + boundary_condition: PointerProperty(name='Boundary Condition', type=BoundaryCondition) class BIMMaterialProperties(PropertyGroup): diff --git a/src/ifcblenderexport/blenderbim/schema.py b/src/ifcblenderexport/blenderbim/schema.py index a17a39f607..b23b7a2f35 100644 --- a/src/ifcblenderexport/blenderbim/schema.py +++ b/src/ifcblenderexport/blenderbim/schema.py @@ -8,12 +8,14 @@ cwd = os.path.dirname(os.path.realpath(__file__)) class IfcSchema(): def __init__(self): self.schema_dir = os.path.join(cwd, 'schema') # TODO: make configurable + # TODO: Make it less troublesome self.products = [ 'IfcElement', 'IfcSpatialStructureElement', 'IfcStructural', 'IfcMaterialDefinition', - 'IfcParameterizedProfileDef' + 'IfcParameterizedProfileDef', + 'IfcBoundaryCondition' ] self.elements = {} self.property_files = [] diff --git a/src/ifcblenderexport/blenderbim/schema/IfcBoundaryCondition_IFC4.json b/src/ifcblenderexport/blenderbim/schema/IfcBoundaryCondition_IFC4.json new file mode 100644 index 0000000000..79c69771ac --- /dev/null +++ b/src/ifcblenderexport/blenderbim/schema/IfcBoundaryCondition_IFC4.json @@ -0,0 +1,256 @@ +{ + "IfcBoundaryEdgeCondition": { + "is_abstract": false, + "parent": "IfcBoundaryCondition", + "attributes": [ + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "TranslationalStiffnessByLengthX", + "type": "IfcModulusOfTranslationalSubgradeReactionSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcModulusOfLinearSubgradeReactionMeasure-wrapper" + ] + }, + { + "name": "TranslationalStiffnessByLengthY", + "type": "IfcModulusOfTranslationalSubgradeReactionSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcModulusOfLinearSubgradeReactionMeasure-wrapper" + ] + }, + { + "name": "TranslationalStiffnessByLengthZ", + "type": "IfcModulusOfTranslationalSubgradeReactionSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcModulusOfLinearSubgradeReactionMeasure-wrapper" + ] + }, + { + "name": "RotationalStiffnessByLengthX", + "type": "IfcModulusOfRotationalSubgradeReactionSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcModulusOfRotationalSubgradeReactionMeasure-wrapper" + ] + }, + { + "name": "RotationalStiffnessByLengthY", + "type": "IfcModulusOfRotationalSubgradeReactionSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcModulusOfRotationalSubgradeReactionMeasure-wrapper" + ] + }, + { + "name": "RotationalStiffnessByLengthZ", + "type": "IfcModulusOfRotationalSubgradeReactionSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcModulusOfRotationalSubgradeReactionMeasure-wrapper" + ] + } + ] + }, + "IfcBoundaryFaceCondition": { + "is_abstract": false, + "parent": "IfcBoundaryCondition", + "attributes": [ + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "TranslationalStiffnessByAreaX", + "type": "IfcModulusOfSubgradeReactionSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcModulusOfSubgradeReactionMeasure-wrapper" + ] + }, + { + "name": "TranslationalStiffnessByAreaY", + "type": "IfcModulusOfSubgradeReactionSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcModulusOfSubgradeReactionMeasure-wrapper" + ] + }, + { + "name": "TranslationalStiffnessByAreaZ", + "type": "IfcModulusOfSubgradeReactionSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcModulusOfSubgradeReactionMeasure-wrapper" + ] + } + ] + }, + "IfcBoundaryNodeCondition": { + "is_abstract": false, + "parent": "IfcBoundaryCondition", + "attributes": [ + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "TranslationalStiffnessX", + "type": "IfcTranslationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcLinearStiffnessMeasure-wrapper" + ] + }, + { + "name": "TranslationalStiffnessY", + "type": "IfcTranslationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcLinearStiffnessMeasure-wrapper" + ] + }, + { + "name": "TranslationalStiffnessZ", + "type": "IfcTranslationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcLinearStiffnessMeasure-wrapper" + ] + }, + { + "name": "RotationalStiffnessX", + "type": "IfcRotationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcRotationalStiffnessMeasure-wrapper" + ] + }, + { + "name": "RotationalStiffnessY", + "type": "IfcRotationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcRotationalStiffnessMeasure-wrapper" + ] + }, + { + "name": "RotationalStiffnessZ", + "type": "IfcRotationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcRotationalStiffnessMeasure-wrapper" + ] + } + ] + }, + "IfcBoundaryNodeConditionWarping": { + "is_abstract": false, + "parent": "IfcBoundaryNodeCondition", + "attributes": [ + { + "name": "Name", + "type": "IfcLabel", + "is_enum": false, + "enum_values": [] + } + ], + "complex_attributes": [ + { + "name": "TranslationalStiffnessX", + "type": "IfcTranslationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcLinearStiffnessMeasure-wrapper" + ] + }, + { + "name": "TranslationalStiffnessY", + "type": "IfcTranslationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcLinearStiffnessMeasure-wrapper" + ] + }, + { + "name": "TranslationalStiffnessZ", + "type": "IfcTranslationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcLinearStiffnessMeasure-wrapper" + ] + }, + { + "name": "RotationalStiffnessX", + "type": "IfcRotationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcRotationalStiffnessMeasure-wrapper" + ] + }, + { + "name": "RotationalStiffnessY", + "type": "IfcRotationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcRotationalStiffnessMeasure-wrapper" + ] + }, + { + "name": "RotationalStiffnessZ", + "type": "IfcRotationalStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcRotationalStiffnessMeasure-wrapper" + ] + }, + { + "name": "WarpingStiffness", + "type": "IfcWarpingStiffnessSelect", + "is_select": true, + "select_types": [ + "IfcBoolean-wrapper", + "IfcWarpingMomentMeasure-wrapper" + ] + } + ] + } +} \ No newline at end of file diff --git a/src/ifcblenderexport/blenderbim/ui.py b/src/ifcblenderexport/blenderbim/ui.py index 8f0fdc0a0f..5d991cd12c 100644 --- a/src/ifcblenderexport/blenderbim/ui.py +++ b/src/ifcblenderexport/blenderbim/ui.py @@ -97,6 +97,19 @@ class BIM_PT_object(Panel): row = layout.row() row.prop(props, 'material_type') + layout.label(text='Structural Boundary Condition:') + + row = layout.row() + row.prop(props, 'has_boundary_condition') + + if bpy.context.active_object.BIMObjectProperties.has_boundary_condition: + row = layout.row() + row.prop(props.boundary_condition, 'name') + for index, attribute in enumerate(props.boundary_condition.attributes): + row = layout.row(align=True) + row.prop(attribute, 'name', text='') + row.prop(attribute, 'string_value', text='') + class BIM_PT_mesh(Panel): bl_label = 'IFC Representations'