mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-01 20:49:44 +00:00
fixed typos
changed all 'applicabiliy' to 'applicability'
This commit is contained in:
@@ -79,6 +79,8 @@ class entity(facet):
|
|||||||
parameters = ["name"]
|
parameters = ["name"]
|
||||||
message = "an entity name '%(name)s'"
|
message = "an entity name '%(name)s'"
|
||||||
|
|
||||||
|
# @todo predefinedtype
|
||||||
|
|
||||||
def __call__(self, inst, logger):
|
def __call__(self, inst, logger):
|
||||||
logger.debug("Testing %s == %s", inst.is_a(), self.name)
|
logger.debug("Testing %s == %s", inst.is_a(), self.name)
|
||||||
# @nb with inheritance
|
# @nb with inheritance
|
||||||
@@ -134,7 +136,7 @@ class property(facet):
|
|||||||
msg = self.message % di
|
msg = self.message % di
|
||||||
else:
|
else:
|
||||||
if pset:
|
if pset:
|
||||||
msg = "a set '%(propertyset)s', but no property '%(name)'" % di
|
msg = "a set '%(propertyset)s', but no property '%(name)s'" % di
|
||||||
else:
|
else:
|
||||||
msg = "no set '%(propertyset)s'" % di
|
msg = "no set '%(propertyset)s'" % di
|
||||||
|
|
||||||
@@ -152,6 +154,7 @@ class material(facet):
|
|||||||
material_relations = [rel for rel in inst.HasAssociations if rel.is_a("IfcRelAssociatesMaterial")]
|
material_relations = [rel for rel in inst.HasAssociations if rel.is_a("IfcRelAssociatesMaterial")]
|
||||||
names = []
|
names = []
|
||||||
for rel in material_relations:
|
for rel in material_relations:
|
||||||
|
# @todo not all subtypes of IfcMaterial handled
|
||||||
if rel.RelatingMaterial.is_a() == "IfcMaterialLayerSetUsage":
|
if rel.RelatingMaterial.is_a() == "IfcMaterialLayerSetUsage":
|
||||||
layers = rel.RelatingMaterial.ForLayerSet.MaterialLayers
|
layers = rel.RelatingMaterial.ForLayerSet.MaterialLayers
|
||||||
names = [layer.Material.Name for layer in layers]
|
names = [layer.Material.Name for layer in layers]
|
||||||
@@ -214,9 +217,10 @@ class restriction:
|
|||||||
self.type = "length"
|
self.type = "length"
|
||||||
elif n.nodeType == n.ELEMENT_NODE and n.tagName.endswith("pattern"):
|
elif n.nodeType == n.ELEMENT_NODE and n.tagName.endswith("pattern"):
|
||||||
self.options.append(n.getAttribute("value"))
|
self.options.append(n.getAttribute("value"))
|
||||||
self.type = "pattern"
|
self.type = "pattern"
|
||||||
|
|
||||||
# "Given an instance with %(applicabiliy)s\nWe expect %(requirements)s" % self.__dict__
|
# "Given an instance with %(applicability)s\nWe expect %(requirements)s" % self.__dict__
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return other in self.options
|
return other in self.options
|
||||||
|
|
||||||
@@ -250,10 +254,10 @@ class specification:
|
|||||||
phrases[0].tagName == "applicability" or error("expected <applicability>")
|
phrases[0].tagName == "applicability" or error("expected <applicability>")
|
||||||
phrases[1].tagName == "requirements" or error("expected <requirements>")
|
phrases[1].tagName == "requirements" or error("expected <requirements>")
|
||||||
|
|
||||||
self.applicabiliy, self.requirements = (boolean_and(parse_rules(phrase)) for phrase in phrases)
|
self.applicability, self.requirements = (boolean_and(parse_rules(phrase)) for phrase in phrases)
|
||||||
|
|
||||||
def __call__(self, inst, logger):
|
def __call__(self, inst, logger):
|
||||||
if self.applicabiliy(inst, logger):
|
if self.applicability(inst, logger):
|
||||||
valid = self.requirements(inst, logger)
|
valid = self.requirements(inst, logger)
|
||||||
|
|
||||||
if valid:
|
if valid:
|
||||||
@@ -262,7 +266,7 @@ class specification:
|
|||||||
logger.error({'guid':inst.GlobalId, 'result':valid.success, 'sentence':str(self) + "\n%s has" % inst + " " + str(valid) + " so is not compliant"})
|
logger.error({'guid':inst.GlobalId, 'result':valid.success, 'sentence':str(self) + "\n%s has" % inst + " " + str(valid) + " so is not compliant"})
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Given an instance with %(applicabiliy)s\nWe expect %(requirements)s" % self.__dict__
|
return "Given an instance with %(applicability)s\nWe expect %(requirements)s" % self.__dict__
|
||||||
|
|
||||||
|
|
||||||
class ids:
|
class ids:
|
||||||
@@ -292,9 +296,23 @@ if __name__ == "__main__":
|
|||||||
filename = os.path.join(os.getcwd(), "ids.txt")
|
filename = os.path.join(os.getcwd(), "ids.txt")
|
||||||
|
|
||||||
logger = logging.getLogger("IDS")
|
logger = logging.getLogger("IDS")
|
||||||
logging.basicConfig(filename=filename, level=logging.INFO, format="%(message)s")
|
#TEMP logging.basicConfig(filename=filename, level=logging.INFO, format="%(message)s")
|
||||||
|
logging.basicConfig(filename=filename, level=logging.INFO, format="%(levelname)s - %(message)s")
|
||||||
|
#TEMP logging.basicConfig(level=logging.INFO, format="%(message)s")
|
||||||
|
logging.basicConfig(level=logging.DEBUG, format="%(message)s")
|
||||||
logging.FileHandler(filename, mode='w')
|
logging.FileHandler(filename, mode='w')
|
||||||
|
|
||||||
ids_file = ids(sys.argv[1])
|
# ids_file = ids(sys.argv[1])
|
||||||
ifc_file = ifcopenshell.open(sys.argv[2])
|
ids_file = ids(r"C:\Users\artom\Desktop\Code\IFC sandbox\IDS, MVDxml samples\IDS_test_1.xml")
|
||||||
|
# ifc_file = ifcopenshell.open(sys.argv[2])
|
||||||
|
ifc_file = ifcopenshell.open(r"C:\Users\artom\Desktop\Code\IFC sandbox\IFC samples\IFC Artur.ifc")
|
||||||
|
# ifc_file = ifcopenshell.open(r"C:\Users\artom\Desktop\Code\IFC sandbox\IFC samples\IFC Schependomlaan.ifc")
|
||||||
|
|
||||||
|
#applicability = ids_file.specifications[0].applicability
|
||||||
|
requirements = ids_file.specifications[0].requirements
|
||||||
|
# print(len(applicability))
|
||||||
|
# print(requirements)
|
||||||
|
products = ifc_file.by_type('IfcProduct')
|
||||||
|
print(f"IFC file contains {len(products)} elements")
|
||||||
|
|
||||||
ids_file.validate(ifc_file, logger)
|
ids_file.validate(ifc_file, logger)
|
||||||
|
|||||||
Reference in New Issue
Block a user