mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 08:35:14 +00:00
Fixed most issues with IDS auditing
This commit is contained in:
committed by
Dion Moult
parent
e4bfb05875
commit
2661999f3e
@@ -286,7 +286,7 @@ class Attribute(Facet):
|
|||||||
|
|
||||||
|
|
||||||
class Classification(Facet):
|
class Classification(Facet):
|
||||||
def __init__(self, value=None, system=None, uri=None, minOccurs=None, maxOccurs=None, instructions=None):
|
def __init__(self, value=None, system=None, uri=None, minOccurs=None, maxOccurs="unbounded", instructions=None):
|
||||||
self.parameters = ["value", "system", "@uri", "@minOccurs", "@maxOccurs", "@instructions"]
|
self.parameters = ["value", "system", "@uri", "@minOccurs", "@maxOccurs", "@instructions"]
|
||||||
self.applicability_templates = [
|
self.applicability_templates = [
|
||||||
"Data having a {system} reference of {value}",
|
"Data having a {system} reference of {value}",
|
||||||
@@ -347,7 +347,7 @@ class PartOf(Facet):
|
|||||||
predefinedType=None,
|
predefinedType=None,
|
||||||
relation=None,
|
relation=None,
|
||||||
minOccurs=None,
|
minOccurs=None,
|
||||||
maxOccurs=None,
|
maxOccurs="unbounded",
|
||||||
instructions=None,
|
instructions=None,
|
||||||
):
|
):
|
||||||
self.parameters = ["entity", "predefinedType", "@relation", "@minOccurs", "@maxOccurs", "@instructions"]
|
self.parameters = ["entity", "predefinedType", "@relation", "@minOccurs", "@maxOccurs", "@instructions"]
|
||||||
@@ -552,7 +552,7 @@ class Property(Facet):
|
|||||||
datatype=None,
|
datatype=None,
|
||||||
uri=None,
|
uri=None,
|
||||||
minOccurs=None,
|
minOccurs=None,
|
||||||
maxOccurs=None,
|
maxOccurs="unbounded",
|
||||||
instructions=None,
|
instructions=None,
|
||||||
):
|
):
|
||||||
self.parameters = [
|
self.parameters = [
|
||||||
@@ -824,7 +824,7 @@ class Property(Facet):
|
|||||||
|
|
||||||
|
|
||||||
class Material(Facet):
|
class Material(Facet):
|
||||||
def __init__(self, value=None, uri=None, minOccurs=None, maxOccurs=None, instructions=None):
|
def __init__(self, value=None, uri=None, minOccurs=None, maxOccurs="unbounded", instructions=None):
|
||||||
self.parameters = ["value", "@uri", "@minOccurs", "@maxOccurs", "@instructions"]
|
self.parameters = ["value", "@uri", "@minOccurs", "@maxOccurs", "@instructions"]
|
||||||
self.applicability_templates = [
|
self.applicability_templates = [
|
||||||
"All data with a {value} material",
|
"All data with a {value} material",
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ class FacetDocGenerator:
|
|||||||
# Create an IDS with the applicability selecting exactly
|
# Create an IDS with the applicability selecting exactly
|
||||||
# the entity type passed to us in `inst`.
|
# the entity type passed to us in `inst`.
|
||||||
specs = ids.Ids(title=name)
|
specs = ids.Ids(title=name)
|
||||||
spec = ids.Specification(name=name, minOccurs=1)
|
|
||||||
|
# todo: to resume IFC2X3 we need to ensure that entities and attributes are consistent with that schema in order to pass audit
|
||||||
|
spec = ids.Specification(name=name, minOccurs=1, ifcVersion=["IFC4"])
|
||||||
spec.applicability.append(ids.Entity(name=inst.is_a().upper()))
|
spec.applicability.append(ids.Entity(name=inst.is_a().upper()))
|
||||||
spec.requirements.append(facet)
|
spec.requirements.append(facet)
|
||||||
specs.specifications.append(spec)
|
specs.specifications.append(spec)
|
||||||
|
|||||||
@@ -667,9 +667,11 @@ class TestAttribute:
|
|||||||
class TestClassification:
|
class TestClassification:
|
||||||
def test_creating_a_classification_facet(self):
|
def test_creating_a_classification_facet(self):
|
||||||
facet = Classification()
|
facet = Classification()
|
||||||
assert facet.asdict() == {}
|
assert facet.asdict() == {
|
||||||
|
"@maxOccurs": "unbounded"
|
||||||
|
}
|
||||||
facet = Classification(value="value", system="system")
|
facet = Classification(value="value", system="system")
|
||||||
assert facet.asdict() == {"value": {"simpleValue": "value"}, "system": {"simpleValue": "system"}}
|
assert facet.asdict() == {"value": {"simpleValue": "value"}, "system": {"simpleValue": "system"}, "@maxOccurs": "unbounded" }
|
||||||
facet = Classification(
|
facet = Classification(
|
||||||
value="value",
|
value="value",
|
||||||
system="system",
|
system="system",
|
||||||
@@ -834,6 +836,7 @@ class TestProperty:
|
|||||||
assert facet.asdict() == {
|
assert facet.asdict() == {
|
||||||
"propertySet": {"simpleValue": "Property_Set"},
|
"propertySet": {"simpleValue": "Property_Set"},
|
||||||
"name": {"simpleValue": "PropertyName"},
|
"name": {"simpleValue": "PropertyName"},
|
||||||
|
"@maxOccurs": "unbounded"
|
||||||
}
|
}
|
||||||
facet = Property(
|
facet = Property(
|
||||||
propertySet="propertySet",
|
propertySet="propertySet",
|
||||||
@@ -861,7 +864,7 @@ class TestProperty:
|
|||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
|
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCLABEL")
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
run("Elements with no properties always fail", facet=facet, inst=element, expected=False)
|
run("Elements with no properties always fail", facet=facet, inst=element, expected=False)
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
||||||
@@ -873,27 +876,27 @@ class TestProperty:
|
|||||||
run("A name check will match any property with any string value", facet=facet, inst=element, expected=True)
|
run("A name check will match any property with any string value", facet=facet, inst=element, expected=True)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCLABEL")
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"})
|
||||||
run("A required facet checks all parameters as normal", facet=facet, inst=element, expected=True)
|
run("A required facet checks all parameters as normal", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel", minOccurs=0, maxOccurs=0)
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCLABEL", minOccurs=0, maxOccurs=0)
|
||||||
run("A prohibited facet returns the opposite of a required facet", facet=facet, inst=element, expected=False)
|
run("A prohibited facet returns the opposite of a required facet", facet=facet, inst=element, expected=False)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel", minOccurs=0)
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCLABEL", minOccurs=0)
|
||||||
run("An optional facet always passes regardless of outcome 1/2", facet=facet, inst=element, expected=True)
|
run("An optional facet always passes regardless of outcome 1/2", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Bar", datatype="IfcLabel", minOccurs=0)
|
facet = Property(propertySet="Foo_Bar", name="Bar", datatype="IFCLABEL", minOccurs=0)
|
||||||
run("An optional facet always passes regardless of outcome 2/2", facet=facet, inst=element, expected=True)
|
run("An optional facet always passes regardless of outcome 2/2", facet=facet, inst=element, expected=True)
|
||||||
|
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ""})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ""})
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLogical")
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCLOGICAL")
|
||||||
run("An empty string is considered falsey and will not pass", facet=facet, inst=element, expected=False)
|
run("An empty string is considered falsey and will not pass", facet=facet, inst=element, expected=False)
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcLogical("UNKNOWN")})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcLogical("UNKNOWN")})
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcDuration")
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCDURATION")
|
||||||
run("A logical unknown is considered falsey and will not pass", facet=facet, inst=element, expected=False)
|
run("A logical unknown is considered falsey and will not pass", facet=facet, inst=element, expected=False)
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDuration("P0D")})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDuration("P0D")})
|
||||||
run("A zero duration will pass", facet=facet, inst=element, expected=True)
|
run("A zero duration will pass", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcBoolean")
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCBOOLEAN")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcBoolean(True)})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcBoolean(True)})
|
||||||
run("A property set to true will pass a name check", facet=facet, inst=element, expected=True)
|
run("A property set to true will pass a name check", facet=facet, inst=element, expected=True)
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": False})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": False})
|
||||||
@@ -905,7 +908,7 @@ class TestProperty:
|
|||||||
)
|
)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="Bar", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="Bar", datatype="IFCLABEL")
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"})
|
||||||
@@ -915,55 +918,55 @@ class TestProperty:
|
|||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Baz"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Baz"})
|
||||||
run("Specifying a value fails against different values", facet=facet, inst=element, expected=False)
|
run("Specifying a value fails against different values", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="♫Don'tÄrgerhôtelЊет", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="♫Don'tÄrgerhôtelЊет", datatype="IFCLABEL")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "♫Don'tÄrgerhôtelЊет"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "♫Don'tÄrgerhôtelЊет"})
|
||||||
run("Non-ascii characters are treated without encoding", facet=facet, inst=element, expected=True)
|
run("Non-ascii characters are treated without encoding", facet=facet, inst=element, expected=True)
|
||||||
|
|
||||||
identifier = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"
|
identifier = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"
|
||||||
facet = Property(
|
facet = Property(
|
||||||
propertySet="Foo_Bar", name="Foo", value=identifier + "_extra_characters", datatype="IfcIdentifier"
|
propertySet="Foo_Bar", name="Foo", value=identifier + "_extra_characters", datatype="IFCIDENTIFIER"
|
||||||
)
|
)
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcIdentifier(identifier)})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcIdentifier(identifier)})
|
||||||
run("IDS does not handle string truncation such as for identifiers", facet=facet, inst=element, expected=False)
|
run("IDS does not handle string truncation such as for identifiers", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="1", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="1", datatype="IFCLABEL")
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "1"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "1"})
|
||||||
run("A number specified as a string is treated as a string", facet=facet, inst=element, expected=True)
|
run("A number specified as a string is treated as a string", facet=facet, inst=element, expected=True)
|
||||||
|
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="42", datatype="IfcInteger")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="42", datatype="IFCINTEGER")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcInteger(42)})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcInteger(42)})
|
||||||
run("Integer values are checked using type casting 1/4", facet=facet, inst=element, expected=True)
|
run("Integer values are checked using type casting 1/4", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.", datatype="IfcInteger")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.", datatype="IFCINTEGER")
|
||||||
run("Integer values are checked using type casting 2/4", facet=facet, inst=element, expected=True)
|
run("Integer values are checked using type casting 2/4", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.0", datatype="IfcInteger")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.0", datatype="IFCINTEGER")
|
||||||
run("Integer values are checked using type casting 3/4", facet=facet, inst=element, expected=True)
|
run("Integer values are checked using type casting 3/4", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.3", datatype="IfcInteger")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.3", datatype="IFCINTEGER")
|
||||||
run("Integer values are checked using type casting 4/4", facet=facet, inst=element, expected=False)
|
run("Integer values are checked using type casting 4/4", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="42", datatype="IfcReal")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="42", datatype="IFCREAL")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.0)})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.0)})
|
||||||
run("Real values are checked using type casting 1/3", facet=facet, inst=element, expected=True)
|
run("Real values are checked using type casting 1/3", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.0", datatype="IfcReal")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.0", datatype="IFCREAL")
|
||||||
run("Real values are checked using type casting 2/3", facet=facet, inst=element, expected=True)
|
run("Real values are checked using type casting 2/3", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.3", datatype="IfcReal")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.3", datatype="IFCREAL")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.3)})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.3)})
|
||||||
run("Real values are checked using type casting 3/3", facet=facet, inst=element, expected=True)
|
run("Real values are checked using type casting 3/3", facet=facet, inst=element, expected=True)
|
||||||
|
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="42,3", datatype="IfcReal")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="42,3", datatype="IFCREAL")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.3)})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.3)})
|
||||||
run("Only specifically formatted numbers are allowed 1/4", facet=facet, inst=element, expected=False)
|
run("Only specifically formatted numbers are allowed 1/4", facet=facet, inst=element, expected=False)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="123,4.5", datatype="IfcReal")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="123,4.5", datatype="IFCREAL")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(1234.5)})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(1234.5)})
|
||||||
run("Only specifically formatted numbers are allowed 2/4", facet=facet, inst=element, expected=False)
|
run("Only specifically formatted numbers are allowed 2/4", facet=facet, inst=element, expected=False)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="1.2345e3", datatype="IfcReal")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="1.2345e3", datatype="IFCREAL")
|
||||||
run("Only specifically formatted numbers are allowed 3/4", facet=facet, inst=element, expected=True)
|
run("Only specifically formatted numbers are allowed 3/4", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="1.2345E3", datatype="IfcReal")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="1.2345E3", datatype="IFCREAL")
|
||||||
run("Only specifically formatted numbers are allowed 4/4", facet=facet, inst=element, expected=True)
|
run("Only specifically formatted numbers are allowed 4/4", facet=facet, inst=element, expected=True)
|
||||||
|
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.", datatype="IfcReal")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="42.", datatype="IFCREAL")
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.0 * (1.0 + 1e-6))}
|
"pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcReal(42.0 * (1.0 + 1e-6))}
|
||||||
)
|
)
|
||||||
@@ -981,15 +984,15 @@ class TestProperty:
|
|||||||
)
|
)
|
||||||
run("Floating point numbers are compared with a 1e-6 tolerance 4/4", facet=facet, inst=element, expected=False)
|
run("Floating point numbers are compared with a 1e-6 tolerance 4/4", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="TRUE", datatype="IfcBoolean")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="TRUE", datatype="IFCBOOLEAN")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcBoolean(False)})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcBoolean(False)})
|
||||||
run("Booleans must be specified as uppercase strings 1/3", facet=facet, inst=element, expected=False)
|
run("Booleans must be specified as uppercase strings 1/3", facet=facet, inst=element, expected=False)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="FALSE", datatype="IfcBoolean")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="FALSE", datatype="IFCBOOLEAN")
|
||||||
run("Booleans must be specified as uppercase strings 2/3", facet=facet, inst=element, expected=True)
|
run("Booleans must be specified as uppercase strings 2/3", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="False", datatype="IfcBoolean")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="False", datatype="IFCBOOLEAN")
|
||||||
run("Booleans must be specified as uppercase strings 3/3", facet=facet, inst=element, expected=False)
|
run("Booleans must be specified as uppercase strings 3/3", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="2022-01-01", datatype="IfcDate")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="2022-01-01", datatype="IFCDATE")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDate("2022-01-01")})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDate("2022-01-01")})
|
||||||
run("Dates are treated as strings 1/2", facet=facet, inst=element, expected=True)
|
run("Dates are treated as strings 1/2", facet=facet, inst=element, expected=True)
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
@@ -997,7 +1000,7 @@ class TestProperty:
|
|||||||
)
|
)
|
||||||
run("Dates are treated as strings 2/2", facet=facet, inst=element, expected=False)
|
run("Dates are treated as strings 2/2", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="PT16H", datatype="IfcDuration")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="PT16H", datatype="IFCDURATION")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDuration("PT16H")})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDuration("PT16H")})
|
||||||
run("Durations are treated as strings 1/2", facet=facet, inst=element, expected=True)
|
run("Durations are treated as strings 1/2", facet=facet, inst=element, expected=True)
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDuration("P2D")})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcDuration("P2D")})
|
||||||
@@ -1014,11 +1017,11 @@ class TestProperty:
|
|||||||
properties={"Status": ["EXISTING", "DEMOLISH"]},
|
properties={"Status": ["EXISTING", "DEMOLISH"]},
|
||||||
pset_template=pset_template,
|
pset_template=pset_template,
|
||||||
)
|
)
|
||||||
facet = Property(propertySet="Pset_WallCommon", name="Status", value="EXISTING", datatype="IfcLabel")
|
facet = Property(propertySet="Pset_WallCommon", name="Status", value="EXISTING", datatype="IFCLABEL")
|
||||||
run("Any matching value in an enumerated property will pass 1/3", facet=facet, inst=element, expected=True)
|
run("Any matching value in an enumerated property will pass 1/3", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Pset_WallCommon", name="Status", value="DEMOLISH", datatype="IfcLabel")
|
facet = Property(propertySet="Pset_WallCommon", name="Status", value="DEMOLISH", datatype="IFCLABEL")
|
||||||
run("Any matching value in an enumerated property will pass 2/3", facet=facet, inst=element, expected=True)
|
run("Any matching value in an enumerated property will pass 2/3", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Pset_WallCommon", name="Status", value="NEW", datatype="IfcLabel")
|
facet = Property(propertySet="Pset_WallCommon", name="Status", value="NEW", datatype="IFCLABEL")
|
||||||
run("Any matching value in an enumerated property will pass 3/3", facet=facet, inst=element, expected=False)
|
run("Any matching value in an enumerated property will pass 3/3", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
@@ -1028,11 +1031,11 @@ class TestProperty:
|
|||||||
Name="Foo", ListValues=[ifc.createIfcLabel("X"), ifc.createIfcLabel("Y")]
|
Name="Foo", ListValues=[ifc.createIfcLabel("X"), ifc.createIfcLabel("Y")]
|
||||||
)
|
)
|
||||||
pset.HasProperties = [list_property]
|
pset.HasProperties = [list_property]
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="X", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="X", datatype="IFCLABEL")
|
||||||
run("Any matching value in a list property will pass 1/3", facet=facet, inst=element, expected=True)
|
run("Any matching value in a list property will pass 1/3", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="Y", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="Y", datatype="IFCLABEL")
|
||||||
run("Any matching value in a list property will pass 2/3", facet=facet, inst=element, expected=True)
|
run("Any matching value in a list property will pass 2/3", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="Z", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="Z", datatype="IFCLABEL")
|
||||||
run("Any matching value in a list property will pass 3/3", facet=facet, inst=element, expected=False)
|
run("Any matching value in a list property will pass 3/3", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
@@ -1045,13 +1048,13 @@ class TestProperty:
|
|||||||
SetPointValue=ifc.createIfcLengthMeasure(3000),
|
SetPointValue=ifc.createIfcLengthMeasure(3000),
|
||||||
)
|
)
|
||||||
pset.HasProperties = [bounded_property]
|
pset.HasProperties = [bounded_property]
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="1", datatype="IfcLengthMeasure")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="1", datatype="IFCLENGTHMEASURE")
|
||||||
run("Any matching value in a bounded property will pass 1/4", facet=facet, inst=element, expected=True)
|
run("Any matching value in a bounded property will pass 1/4", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="5", datatype="IfcLengthMeasure")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="5", datatype="IFCLENGTHMEASURE")
|
||||||
run("Any matching value in a bounded property will pass 2/4", facet=facet, inst=element, expected=True)
|
run("Any matching value in a bounded property will pass 2/4", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="3", datatype="IfcLengthMeasure")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="3", datatype="IFCLENGTHMEASURE")
|
||||||
run("Any matching value in a bounded property will pass 3/4", facet=facet, inst=element, expected=True)
|
run("Any matching value in a bounded property will pass 3/4", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="2", datatype="IfcLengthMeasure")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="2", datatype="IFCLENGTHMEASURE")
|
||||||
run("Any matching value in a bounded property will pass 4/4", facet=facet, inst=element, expected=False)
|
run("Any matching value in a bounded property will pass 4/4", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
@@ -1061,18 +1064,18 @@ class TestProperty:
|
|||||||
Name="Foo", DefiningValues=[ifc.createIfcLabel("X")], DefinedValues=[ifc.createIfcLengthMeasure(1000)]
|
Name="Foo", DefiningValues=[ifc.createIfcLabel("X")], DefinedValues=[ifc.createIfcLengthMeasure(1000)]
|
||||||
)
|
)
|
||||||
pset.HasProperties = [table_property]
|
pset.HasProperties = [table_property]
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="X", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="X", datatype="IFCLABEL")
|
||||||
run("Any matching value in a table property will pass 1/3", facet=facet, inst=element, expected=True)
|
run("Any matching value in a table property will pass 1/3", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="1", datatype="IfcLengthMeasure")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="1", datatype="IFCLENGTHMEASURE")
|
||||||
run("Any matching value in a table property will pass 2/3", facet=facet, inst=element, expected=True)
|
run("Any matching value in a table property will pass 2/3", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="Y", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="Y", datatype="IFCLABEL")
|
||||||
run("Any matching value in a table property will pass 3/3", facet=facet, inst=element, expected=False)
|
run("Any matching value in a table property will pass 3/3", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
||||||
pset.HasProperties = [ifc.createIfcPropertyReferenceValue(Name="Foo")]
|
pset.HasProperties = [ifc.createIfcPropertyReferenceValue(Name="Foo")]
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCLABEL")
|
||||||
run("Reference properties are treated as objects and not supported", facet=facet, inst=element, expected=False)
|
run("Reference properties are treated as objects and not supported", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
@@ -1091,21 +1094,21 @@ class TestProperty:
|
|||||||
RelatingPropertyDefinition=pset,
|
RelatingPropertyDefinition=pset,
|
||||||
)
|
)
|
||||||
facet = Property(
|
facet = Property(
|
||||||
propertySet="Foo_Bar", name="PanelOperation", value="SWINGING", datatype="IfcDoorPanelOperationEnum"
|
propertySet="Foo_Bar", name="PanelOperation", value="SWINGING", datatype="IFCDOORPANELOPERATIONENUM"
|
||||||
)
|
)
|
||||||
run("Predefined properties are supported but discouraged 1/2", facet=facet, inst=element, expected=True)
|
run("Predefined properties are supported but discouraged 1/2", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(
|
facet = Property(
|
||||||
propertySet="Foo_Bar", name="PanelOperation", value="SWONGING", datatype="IfcDoorPanelOperationEnum"
|
propertySet="Foo_Bar", name="PanelOperation", value="SWONGING", datatype="IFCDOORPANELOPERATIONENUM"
|
||||||
)
|
)
|
||||||
run("Predefined properties are supported but discouraged 2/2", facet=facet, inst=element, expected=False)
|
run("Predefined properties are supported but discouraged 2/2", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLengthMeasure")
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCLENGTHMEASURE")
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
qto = ifcopenshell.api.run("pset.add_qto", ifc, product=element, name="Foo_Bar")
|
qto = ifcopenshell.api.run("pset.add_qto", ifc, product=element, name="Foo_Bar")
|
||||||
ifcopenshell.api.run("pset.edit_qto", ifc, qto=qto, properties={"Foo": ifc.createIfcLengthMeasure(42)})
|
ifcopenshell.api.run("pset.edit_qto", ifc, qto=qto, properties={"Foo": ifc.createIfcLengthMeasure(42)})
|
||||||
run("A name check will match any quantity with any value", facet=facet, inst=element, expected=True)
|
run("A name check will match any quantity with any value", facet=facet, inst=element, expected=True)
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcAreaMeasure")
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCAREAMEASURE")
|
||||||
run("Quantities must also match the appropriate measure", facet=facet, inst=element, expected=False)
|
run("Quantities must also match the appropriate measure", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
@@ -1114,9 +1117,9 @@ class TestProperty:
|
|||||||
complex_property = ifc.createIfcComplexProperty(Name="Foo", UsageName="RabbitAgilityTraining")
|
complex_property = ifc.createIfcComplexProperty(Name="Foo", UsageName="RabbitAgilityTraining")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=complex_property, properties={"Rabbits": "Awesome"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=complex_property, properties={"Rabbits": "Awesome"})
|
||||||
pset.HasProperties = [complex_property]
|
pset.HasProperties = [complex_property]
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCLABEL")
|
||||||
run("Complex properties are not supported 1/2", facet=facet, inst=element, expected=False)
|
run("Complex properties are not supported 1/2", facet=facet, inst=element, expected=False)
|
||||||
facet = Property(propertySet="Foo", name="Rabbits", datatype="IfcLabel")
|
facet = Property(propertySet="Foo", name="Rabbits", datatype="IFCLABEL")
|
||||||
run("Complex properties are not supported 2/2", facet=facet, inst=element, expected=False)
|
run("Complex properties are not supported 2/2", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
@@ -1127,14 +1130,14 @@ class TestProperty:
|
|||||||
"pset.edit_qto", ifc, qto=complex_quantity, properties={"MyLength": ifc.createIfcLengthMeasure(42)}
|
"pset.edit_qto", ifc, qto=complex_quantity, properties={"MyLength": ifc.createIfcLengthMeasure(42)}
|
||||||
)
|
)
|
||||||
qto.Quantities = [complex_quantity]
|
qto.Quantities = [complex_quantity]
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLengthMeasure")
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCLENGTHMEASURE")
|
||||||
run("Complex properties are not supported 1/2", facet=facet, inst=element, expected=False)
|
run("Complex properties are not supported 1/2", facet=facet, inst=element, expected=False)
|
||||||
facet = Property(propertySet="Foo", name="MyLength", datatype="IfcLengthMeasure")
|
facet = Property(propertySet="Foo", name="MyLength", datatype="IFCLENGTHMEASURE")
|
||||||
run("Complex properties are not supported 2/2", facet=facet, inst=element, expected=False)
|
run("Complex properties are not supported 2/2", facet=facet, inst=element, expected=False)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
restriction = Restriction(options={"pattern": "Foo_.*"})
|
restriction = Restriction(options={"pattern": "Foo_.*"})
|
||||||
facet = Property(propertySet=restriction, name="Foo", datatype="IfcLabel")
|
facet = Property(propertySet=restriction, name="Foo", datatype="IFCLABEL")
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"})
|
||||||
@@ -1147,7 +1150,7 @@ class TestProperty:
|
|||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
restriction = Restriction(options={"pattern": "Foo.*"})
|
restriction = Restriction(options={"pattern": "Foo.*"})
|
||||||
facet = Property(propertySet="Foo_Bar", name=restriction, value="x", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name=restriction, value="x", datatype="IFCLABEL")
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foobar": "x"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foobar": "x"})
|
||||||
@@ -1160,7 +1163,7 @@ class TestProperty:
|
|||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
restriction1 = Restriction(options={"pattern": "Foo.*"})
|
restriction1 = Restriction(options={"pattern": "Foo.*"})
|
||||||
restriction2 = Restriction(options={"enumeration": ["x", "y"]})
|
restriction2 = Restriction(options={"enumeration": ["x", "y"]})
|
||||||
facet = Property(propertySet="Foo_Bar", name=restriction1, value=restriction2, datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name=restriction1, value=restriction2, datatype="IFCLABEL")
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foobar": "x", "Foobaz": "y"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foobar": "x", "Foobaz": "y"})
|
||||||
@@ -1179,7 +1182,7 @@ class TestProperty:
|
|||||||
)
|
)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="2", datatype="IfcTimeMeasure")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="2", datatype="IFCTIMEMEASURE")
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcMassMeasure(2)})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcMassMeasure(2)})
|
||||||
@@ -1188,7 +1191,7 @@ class TestProperty:
|
|||||||
run("Measures are used to specify an IFC data type 2/2", facet=facet, inst=element, expected=True)
|
run("Measures are used to specify an IFC data type 2/2", facet=facet, inst=element, expected=True)
|
||||||
|
|
||||||
ifc = self.setup_ifc()
|
ifc = self.setup_ifc()
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="2", datatype="IfcLengthMeasure")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="2", datatype="IFCLENGTHMEASURE")
|
||||||
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=element, name="Foo_Bar")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcLengthMeasure(2)})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": ifc.createIfcLengthMeasure(2)})
|
||||||
@@ -1212,7 +1215,7 @@ class TestProperty:
|
|||||||
ifcopenshell.api.run("type.assign_type", ifc, related_object=wall, relating_type=wall_type)
|
ifcopenshell.api.run("type.assign_type", ifc, related_object=wall, relating_type=wall_type)
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=wall_type, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=wall_type, name="Foo_Bar")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"})
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", datatype="IFCLABEL")
|
||||||
run("Properties can be inherited from the type 1/2", facet=facet, inst=wall, expected=True)
|
run("Properties can be inherited from the type 1/2", facet=facet, inst=wall, expected=True)
|
||||||
run("Properties can be inherited from the type 2/2", facet=facet, inst=wall_type, expected=True)
|
run("Properties can be inherited from the type 2/2", facet=facet, inst=wall_type, expected=True)
|
||||||
|
|
||||||
@@ -1224,7 +1227,7 @@ class TestProperty:
|
|||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Baz"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Baz"})
|
||||||
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=wall, name="Foo_Bar")
|
pset = ifcopenshell.api.run("pset.add_pset", ifc, product=wall, name="Foo_Bar")
|
||||||
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"})
|
ifcopenshell.api.run("pset.edit_pset", ifc, pset=pset, properties={"Foo": "Bar"})
|
||||||
facet = Property(propertySet="Foo_Bar", name="Foo", value="Bar", datatype="IfcLabel")
|
facet = Property(propertySet="Foo_Bar", name="Foo", value="Bar", datatype="IFCLABEL")
|
||||||
run("Properties can be overriden by an occurrence 1/2", facet=facet, inst=wall, expected=True)
|
run("Properties can be overriden by an occurrence 1/2", facet=facet, inst=wall, expected=True)
|
||||||
run("Properties can be overriden by an occurrence 2/2", facet=facet, inst=wall_type, expected=False)
|
run("Properties can be overriden by an occurrence 2/2", facet=facet, inst=wall_type, expected=False)
|
||||||
|
|
||||||
@@ -1243,7 +1246,7 @@ class TestProperty:
|
|||||||
class TestMaterial:
|
class TestMaterial:
|
||||||
def test_creating_a_material_facet(self):
|
def test_creating_a_material_facet(self):
|
||||||
facet = Material()
|
facet = Material()
|
||||||
assert facet.asdict() == {}
|
assert facet.asdict() == {"@maxOccurs": "unbounded"}
|
||||||
facet = Material(
|
facet = Material(
|
||||||
value="value", uri="https://test.com", minOccurs="0", maxOccurs="unbounded", instructions="instructions"
|
value="value", uri="https://test.com", minOccurs="0", maxOccurs="unbounded", instructions="instructions"
|
||||||
)
|
)
|
||||||
@@ -1401,9 +1404,9 @@ class TestMaterial:
|
|||||||
class TestPartOf:
|
class TestPartOf:
|
||||||
def test_creating_a_partof_facet(self):
|
def test_creating_a_partof_facet(self):
|
||||||
facet = PartOf()
|
facet = PartOf()
|
||||||
assert facet.asdict() == {"entity": {"name": {"simpleValue": "IFCWALL"}}}
|
assert facet.asdict() == {"entity": {"name": {"simpleValue": "IFCWALL"}}, "@maxOccurs": "unbounded" }
|
||||||
facet = PartOf(
|
facet = PartOf(
|
||||||
entity="IfcGroup",
|
entity="IFCGROUP",
|
||||||
predefinedType="predefinedType",
|
predefinedType="predefinedType",
|
||||||
relation="IFCRELASSIGNSTOGROUP",
|
relation="IFCRELASSIGNSTOGROUP",
|
||||||
minOccurs="0",
|
minOccurs="0",
|
||||||
@@ -1412,7 +1415,7 @@ class TestPartOf:
|
|||||||
)
|
)
|
||||||
assert facet.asdict() == {
|
assert facet.asdict() == {
|
||||||
"entity": {
|
"entity": {
|
||||||
"name": {"simpleValue": "IfcGroup"},
|
"name": {"simpleValue": "IFCGROUP"},
|
||||||
"predefinedType": {"simpleValue": "predefinedType"},
|
"predefinedType": {"simpleValue": "predefinedType"},
|
||||||
},
|
},
|
||||||
"@relation": "IFCRELASSIGNSTOGROUP",
|
"@relation": "IFCRELASSIGNSTOGROUP",
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class TestIds:
|
|||||||
run("Prohibited specifications fail if at least one entity passes all requirements 1/3", specs, model, True)
|
run("Prohibited specifications fail if at least one entity passes all requirements 1/3", specs, model, True)
|
||||||
model = ifcopenshell.file()
|
model = ifcopenshell.file()
|
||||||
wall = model.createIfcWall(Name="Wally")
|
wall = model.createIfcWall(Name="Wally")
|
||||||
run("Prohibited specifications fail if at least one entity passes all requirements 2/3", specs, model, True, [wall], [wall])
|
run("Prohibited specifications fail if at least one entity passes all requirements 2/3", specs, model, False, [wall], [wall])
|
||||||
model = ifcopenshell.file()
|
model = ifcopenshell.file()
|
||||||
wall = model.createIfcWall(Name="Waldo")
|
wall = model.createIfcWall(Name="Waldo")
|
||||||
run("Prohibited specifications fail if at least one entity passes all requirements 3/3", specs, model, False, [wall])
|
run("Prohibited specifications fail if at least one entity passes all requirements 3/3", specs, model, False, [wall])
|
||||||
|
|||||||
Reference in New Issue
Block a user