def step_impl(context, guid, number): number = assert_number(number) site = IfcFile.by_guid(guid) if not site.is_a("IfcSite"): assert False, "The element {} is not an IfcSite".format(site) ref = assert_attribute(site, "RefLatitude") number = ifcopenshell.util.geolocation.dd2dms(number, use_ms=(len(ref) == 4)) assert_attribute(site, "RefLatitude", number)
def check_geocode_address(guid, spatial_type, name, value): element = IfcFile.by_guid(guid) ifc_class = get_ifc_class_from_spatial_type(spatial_type) assert_type(element, ifc_class) if ifc_class == "IfcSite": address_name = "SiteAddress" elif ifc_class == "IfcBuilding": address_name = "BuildingAddress" assert_attribute(element, address_name) assert_attribute(getattr(element, address_name), name, value)
def step_impl(context, guid, predefined_type): element = IfcFile.by_guid(guid) if hasattr(element, 'PredefinedType') \ and element.PredefinedType == 'USERDEFINED' \ and hasattr(element,'ObjectType'): assert_attribute(element, 'ObjectType', predefined_type) elif hasattr(element, 'PredefinedType'): assert_attribute(element, 'PredefinedType', predefined_type) else: assert False, 'The element {} does not have a PredefinedType or ObjectType attribute'.format( element)
def step_impl(context, guid, predefined_type): element = IfcFile.by_guid(guid) if (hasattr(element, "PredefinedType") and element.PredefinedType == "USERDEFINED" and hasattr(element, "ObjectType")): assert_attribute(element, "ObjectType", predefined_type) elif hasattr(element, "PredefinedType"): assert_attribute(element, "PredefinedType", predefined_type) else: assert False, "The element {} does not have a PredefinedType or ObjectType attribute".format( element)
def step_impl(context, guid, identification, reference_name): element = IfcFile.by_guid(guid) if not hasattr(element, 'HasAssociations') or not element.HasAssociations: assert False, f'The element {element} has no associations.' references = [ a.RelatingClassification for a in element.HasAssociations if a.is_a('IfcRelAssociatesClassification') ] if not references: assert False, f'The element {element} has no associated classification references.' is_success = False for reference in references: try: assert_attribute(reference, 'Identification', identification) assert_attribute(reference, 'Name', reference_name) is_success = True except: pass if not is_success: assert False, 'No classification references met the requirement for an identification {} and name {} for the element {}. The references we found were: {}'.format( identification, reference_name, element, references)
def step_impl(context, guid, number): number = assert_number(number) site = IfcFile.by_guid(guid) if not site.is_a('IfcSite'): assert False, 'The element {} is not an IfcSite'.format(site) assert_attribute(site, 'RefElevation', number)
def check_geocode_attribute(guid, spatial_type, name, value): element = IfcFile.by_guid(guid) assert_type(element, get_ifc_class_from_spatial_type(spatial_type)) assert_attribute(element, name, value)
def step_impl(context, value): assert_attribute(IfcFile.get().by_type("IfcProject")[0], "Phase", value)
def step_impl(context, guid): assert_attribute(IfcFile.get().by_type("IfcProject")[0], "GlobalId", guid)
def step_impl(context, name, tokens): try: tokens = json.loads(tokens) except: assert False, f'Tokens {tokens} are not specified as a JSON list' assert_attribute(get_classification(name), 'ReferenceTokens', tokens)
def step_impl(context, name, location): assert_attribute(get_classification(name), 'Location', location)
def step_impl(context, name, description): assert_attribute(get_classification(name), 'Description', description)
def step_impl(context, name, edition, edition_date): element = get_classification(name) assert_attribute(element, 'Edition', edition) assert_attribute(element, 'EditionDate', edition_date)
def step_impl(context, name, source): assert_attribute(get_classification(name), 'Source', source)
def step_impl(context, value): assert_attribute(IfcFile.get().by_type('IfcProject')[0], 'Phase', value)
def step_impl(context, guid): assert_attribute(IfcFile.get().by_type('IfcProject')[0], 'GlobalId', guid)