MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / get_contact_data

Function get_contact_data

src/ifcfm/ifcfm/cobie24.py:258–307  ·  view source on GitHub ↗
(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance)

Source from the content-addressed store, hash-verified

256
257
258def 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
310def get_facility_data(ifc_file: ifcopenshell.file, element: ifcopenshell.entity_instance) -> dict[str, Any]:

Callers

nothing calls this directly

Calls 9

get_email_from_paoFunction · 0.70
get_created_byFunction · 0.70
get_created_onFunction · 0.70
get_pao_addressFunction · 0.70
get_external_systemFunction · 0.70
setFunction · 0.50
is_aMethod · 0.45
addMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected