mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
New UI to add structural boundary condition data. See #756.
This commit is contained in:
@@ -100,6 +100,7 @@ if bpy is not None:
|
||||
prop.MapConversion,
|
||||
prop.TargetCRS,
|
||||
prop.Attribute,
|
||||
prop.BoundaryCondition,
|
||||
prop.Pset,
|
||||
prop.Document,
|
||||
prop.Classification,
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user