(self)
| 43 | ) |
| 44 | |
| 45 | def process(self): |
| 46 | self.sv_input_names = ["entity"] |
| 47 | entity_id = flatten_data(self.inputs["entity"].sv_get(), target_level=1) |
| 48 | if not entity_id[0]: |
| 49 | return |
| 50 | if len(entity_id) > 1: |
| 51 | raise Exception("Only one entity can be read at a time") |
| 52 | self.file = SvIfcStore.get_file() |
| 53 | try: |
| 54 | entity = self.file.by_id(entity_id[0]) |
| 55 | except Exception as e: |
| 56 | raise Exception("Instance with id {} not found".format(entity_id), e) |
| 57 | |
| 58 | if entity: |
| 59 | ifc_class = entity.is_a() |
| 60 | file = SvIfcStore.get_file() |
| 61 | if file: |
| 62 | schema_name = file.schema_identifier |
| 63 | else: |
| 64 | schema_name = "IFC4" |
| 65 | self.schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema_name) |
| 66 | self.entity_schema = self.schema.declaration_by_name(ifc_class) |
| 67 | |
| 68 | if ifc_class != self.current_ifc_class: |
| 69 | self.generate_outputs(ifc_class) |
| 70 | |
| 71 | self.outputs["id"].sv_set([entity.id()]) |
| 72 | self.outputs["is_a"].sv_set([entity.is_a()]) |
| 73 | for i in range(0, self.entity_schema.attribute_count()): |
| 74 | name = self.entity_schema.attribute_by_index(i).name() |
| 75 | self.outputs[name].sv_set([entity[i]]) |
| 76 | |
| 77 | def generate_outputs(self, ifc_class): |
| 78 | while len(self.outputs) > 2: |
nothing calls this directly
no test coverage detected