| 632 | |
| 633 | |
| 634 | class Property(Facet): |
| 635 | def __init__( |
| 636 | self, |
| 637 | propertySet="Property_Set", |
| 638 | baseName="PropertyName", |
| 639 | value=None, |
| 640 | dataType=None, |
| 641 | uri=None, |
| 642 | cardinality: Cardinality = "required", |
| 643 | instructions=None, |
| 644 | ): |
| 645 | self.parameters = [ |
| 646 | "propertySet", |
| 647 | "baseName", |
| 648 | "value", |
| 649 | "@dataType", |
| 650 | "@uri", |
| 651 | "@cardinality", |
| 652 | "@instructions", |
| 653 | ] |
| 654 | self.applicability_templates = [ |
| 655 | "Elements with {baseName} data of {value} in the dataset {propertySet}", |
| 656 | "Elements with {baseName} data in the dataset {propertySet}", |
| 657 | ] |
| 658 | self.requirement_templates = [ |
| 659 | "{baseName} data shall be {value} and in the dataset {propertySet}", |
| 660 | "{baseName} data shall be provided in the dataset {propertySet}", |
| 661 | ] |
| 662 | self.prohibited_templates = [ |
| 663 | "{baseName} data shall not be {value} and in the dataset {propertySet}", |
| 664 | "{baseName} data shall not be provided in the dataset {propertySet}", |
| 665 | ] |
| 666 | super().__init__(propertySet, baseName, value, dataType, uri, cardinality, instructions) |
| 667 | |
| 668 | def filter( |
| 669 | self, ifc_file: ifcopenshell.file, elements: Optional[list[ifcopenshell.entity_instance]] |
| 670 | ) -> list[ifcopenshell.entity_instance]: |
| 671 | if isinstance(elements, list): |
| 672 | return super().filter(ifc_file, elements) |
| 673 | if ifc_file.schema == "IFC2X3": |
| 674 | return ifc_file.by_type("IfcObjectDefinition") |
| 675 | return ( |
| 676 | ifc_file.by_type("IfcObjectDefinition") |
| 677 | + ifc_file.by_type("IfcMaterialDefinition") |
| 678 | + ifc_file.by_type("IfcProfileDef") |
| 679 | ) |
| 680 | |
| 681 | def __call__(self, inst: ifcopenshell.entity_instance, logger: Optional[Logger] = None) -> PropertyResult: |
| 682 | if isinstance(self.propertySet, str): |
| 683 | pset = get_pset(inst, self.propertySet) |
| 684 | psets = {self.propertySet: pset} if pset else {} |
| 685 | else: |
| 686 | all_psets = get_psets(inst) |
| 687 | psets = {k: v for k, v in all_psets.items() if k == self.propertySet} |
| 688 | |
| 689 | is_pass = bool(psets) |
| 690 | reason = None |
| 691 |
no outgoing calls