mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-20 20:22:09 +00:00
Complex properties and quantities are not supported in IDS
This commit is contained in:
@@ -460,10 +460,12 @@ class Property(Facet):
|
||||
|
||||
pset_entity = inst.wrapped_data.file.by_id(pset_props["id"])
|
||||
|
||||
is_property_supported_class = False
|
||||
for prop_entity in self.get_properties(pset_entity):
|
||||
if prop_entity.is_a("IfcPropertySingleValue"):
|
||||
if prop_entity.Name not in props[pset_name].keys() or prop_entity.NominalValue is None:
|
||||
continue
|
||||
is_property_supported_class = True
|
||||
|
||||
data_type = prop_entity.NominalValue.is_a()
|
||||
|
||||
@@ -484,6 +486,7 @@ class Property(Facet):
|
||||
elif prop_entity.is_a("IfcPhysicalSimpleQuantity"):
|
||||
if prop_entity.Name not in props[pset_name].keys():
|
||||
continue
|
||||
is_property_supported_class = True
|
||||
|
||||
prop_schema = prop_entity.wrapped_data.declaration().as_entity()
|
||||
data_type = prop_schema.attribute_by_index(3).type_of_attribute().declared_type().name()
|
||||
@@ -503,6 +506,10 @@ class Property(Facet):
|
||||
ifcopenshell.util.unit.si_type_names[unit.UnitType],
|
||||
)
|
||||
|
||||
if not is_property_supported_class:
|
||||
is_pass = False
|
||||
reason = {"type": "NOVALUE"}
|
||||
|
||||
if not is_pass:
|
||||
break
|
||||
|
||||
|
||||
@@ -1017,6 +1017,28 @@ class TestProperty:
|
||||
facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcAreaMeasure")
|
||||
run("Quantities must also match the appropriate measure", facet=facet, inst=element, expected=False)
|
||||
|
||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
||||
complex_property = ifc.createIfcComplexProperty(Name="Foo", UsageName="RabbitAgilityTraining")
|
||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=complex_property, properties={"Rabbits": "Awesome"})
|
||||
pset.HasProperties = [complex_property]
|
||||
facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLabel")
|
||||
run("Complex properties are not supported 1/2", facet=facet, inst=element, expected=False)
|
||||
facet = Property(propertySet="Foo", name="Rabbits", measure="IfcLabel")
|
||||
run("Complex properties are not supported 2/2", facet=facet, inst=element, expected=False)
|
||||
|
||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||
qto = ifcopenshell.api.run("pset.add_qto", ifc, product=element, name="Foo_Bar")
|
||||
complex_quantity = ifc.createIfcPhysicalComplexQuantity(Name="Foo", Discrimination="FurThickness")
|
||||
ifcopenshell.api.run(
|
||||
"pset.edit_qto", ifc, qto=complex_quantity, properties={"MyLength": ifc.createIfcLengthMeasure(42)}
|
||||
)
|
||||
qto.Quantities = [complex_quantity]
|
||||
facet = Property(propertySet="Foo_Bar", name="Foo", measure="IfcLengthMeasure")
|
||||
run("Complex properties are not supported 1/2", facet=facet, inst=element, expected=False)
|
||||
facet = Property(propertySet="Foo", name="MyLength", measure="IfcLengthMeasure")
|
||||
run("Complex properties are not supported 2/2", facet=facet, inst=element, expected=False)
|
||||
|
||||
restriction = Restriction(options="Foo_.*", type="pattern")
|
||||
facet = Property(propertySet=restriction, name="Foo", measure="IfcLabel")
|
||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||
|
||||
Reference in New Issue
Block a user