(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance)
| 256 | |
| 257 | |
| 258 | def get_contact_data(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance) -> dict[str, Any]: |
| 259 | the_actor = element.TheActor |
| 260 | |
| 261 | if the_actor.is_a("IfcPerson"): |
| 262 | pao = None |
| 263 | person = the_actor |
| 264 | organization = None |
| 265 | elif the_actor.is_a("IfcOrganization"): |
| 266 | pao = None |
| 267 | person = None |
| 268 | organization = the_actor |
| 269 | elif the_actor.is_a("IfcPersonAndOrganization"): |
| 270 | pao = the_actor |
| 271 | person = the_actor.ThePerson |
| 272 | organization = the_actor.TheOrganization |
| 273 | |
| 274 | email = get_email_from_pao(person, organization) |
| 275 | |
| 276 | roles = set() |
| 277 | for actor in [pao, person, organization]: |
| 278 | if not actor: |
| 279 | continue |
| 280 | for role in actor.Roles or []: |
| 281 | if role.Role == "USERDEFINED": |
| 282 | if role.UserDefinedRole: |
| 283 | roles.add(role.UserDefinedRole) |
| 284 | else: |
| 285 | roles.add(role.Role) |
| 286 | |
| 287 | return { |
| 288 | "Email": email, |
| 289 | "CreatedBy": get_created_by(element), |
| 290 | "CreatedOn": get_created_on(element), |
| 291 | "Category": ",".join(roles), |
| 292 | "Company": getattr(organization, "Name", None), |
| 293 | "Phone": get_pao_address(person, organization, "TelephoneNumbers"), |
| 294 | "ExternalSystem": get_external_system(element), |
| 295 | "ExternalObject": element.is_a(), |
| 296 | "ExternalIdentifier": element.GlobalId, |
| 297 | "Department": get_pao_address(person, organization, "InternalLocation"), |
| 298 | "OrganizationCode": getattr(organization, "Id", getattr(organization, "Identification", None)), |
| 299 | "GivenName": getattr(person, "GivenName", None), |
| 300 | "FamilyName": getattr(person, "FamilyName", None), |
| 301 | "Street": get_pao_address(person, organization, "AddressLines"), |
| 302 | "PostalBox": get_pao_address(person, organization, "PostalBox"), |
| 303 | "Town": get_pao_address(person, organization, "Town"), |
| 304 | "StateRegion": get_pao_address(person, organization, "Region"), |
| 305 | "PostalCode": get_pao_address(person, organization, "PostalCode"), |
| 306 | "Country": get_pao_address(person, organization, "Country"), |
| 307 | } |
| 308 | |
| 309 | |
| 310 | def get_facility_data(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance) -> dict[str, Any]: |
nothing calls this directly
no test coverage detected