mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 01:50:01 +00:00
Fix #7186. Support upgrading IFC2X3 IfcExtendedMaterialProperties to IFC4
This commit is contained in:
@@ -173,7 +173,7 @@
|
|||||||
"Identification": "ItemReference"
|
"Identification": "ItemReference"
|
||||||
},
|
},
|
||||||
"IfcMaterialProperties": {
|
"IfcMaterialProperties": {
|
||||||
"Name": "Material"
|
"Properties": "ExtendedProperties"
|
||||||
},
|
},
|
||||||
"IfcBlobTexture": {
|
"IfcBlobTexture": {
|
||||||
"Mode": "TextureType",
|
"Mode": "TextureType",
|
||||||
|
|||||||
@@ -5,4 +5,5 @@
|
|||||||
, "IfcAnnotationSurfaceOccurrence": "IfcStyledItem"
|
, "IfcAnnotationSurfaceOccurrence": "IfcStyledItem"
|
||||||
, "IfcAnnotationSymbolOccurrence": "IfcStyledItem"
|
, "IfcAnnotationSymbolOccurrence": "IfcStyledItem"
|
||||||
, "IfcAnnotationTextOccurrence": "IfcStyledItem"
|
, "IfcAnnotationTextOccurrence": "IfcStyledItem"
|
||||||
|
, "IfcExtendedMaterialProperties": "IfcMaterialProperties"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,3 +118,20 @@ END-ISO-10303-21;
|
|||||||
assert qt_float_count_measure_ifc4x3.is_a("IfcQuantityNumber")
|
assert qt_float_count_measure_ifc4x3.is_a("IfcQuantityNumber")
|
||||||
assert isinstance(qt_float_count_measure_ifc4x3[3], float)
|
assert isinstance(qt_float_count_measure_ifc4x3[3], float)
|
||||||
assert qt_float_count_measure_ifc4x3[3] == 723.0
|
assert qt_float_count_measure_ifc4x3[3] == 723.0
|
||||||
|
|
||||||
|
def test_migrate_extended_material_properties_ifc2x3_ifc4(self):
|
||||||
|
ifc2x3_file = ifcopenshell.api.project.create_file(version="IFC2X3")
|
||||||
|
material = ifc2x3_file.createIfcMaterial(Name="Material")
|
||||||
|
props = [ifc2x3_file.createIfcPropertySingleValue(Name="Foo")]
|
||||||
|
original_element = ifc2x3_file.createIfcExtendedMaterialProperties(Material=material, ExtendedProperties=props)
|
||||||
|
ifc4_file = ifcopenshell.api.project.create_file()
|
||||||
|
|
||||||
|
migrator = subject.Migrator()
|
||||||
|
for element in ifc2x3_file:
|
||||||
|
migrator.migrate(element, ifc4_file)
|
||||||
|
|
||||||
|
new_element = ifc4_file.by_type("IfcMaterialProperties")[0]
|
||||||
|
assert new_element.Material.is_a("IfcMaterial")
|
||||||
|
assert new_element.Material.Name == "Material"
|
||||||
|
assert new_element.Properties[0].is_a("IfcPropertySingleValue")
|
||||||
|
assert new_element.Properties[0].Name == "Foo"
|
||||||
|
|||||||
Reference in New Issue
Block a user