Exemplo n.º 1
0
def step_impl(context, guid, x, y, z):
    element = IfcFile.by_guid(guid)
    if not element.ObjectPlacement:
        assert False, 'The element does not have an object placement: {}'.format(
            element)
    m = get_local_placement(element.ObjectPlacement)
    element_x = round(m[0][3], get_decimal_points(x))
    element_y = round(m[1][3], get_decimal_points(y))
    element_z = round(m[2][3], get_decimal_points(z))
    expected_placement = (assert_number(x), assert_number(y), assert_number(z))
    if (element_x, element_y, element_z) != expected_placement:
        assert False, 'The element {} is meant to have a location of {} but instead we found {}'.format(
            element, expected_placement, (element_x, element_y, element_z))
Exemplo n.º 2
0
def step_impl(context, number):
    number = assert_number(number)
    if IfcFile.get().schema == 'IFC2X3':
        for site in IfcFile.get().by_type('IfcSite'):
            assert_pset(site, 'EPset_MapConversion', 'Scale', number)
        return
    check_ifc4_geolocation('IfcMapConversion', 'Scale', number)
Exemplo n.º 3
0
def step_impl(context, number):
    number = assert_number(number)
    if IfcFile.get().schema == "IFC2X3":
        for site in IfcFile.get().by_type("IfcSite"):
            assert_pset(site, "EPset_MapConversion", "Scale", number)
        return
    check_ifc4_geolocation("IfcMapConversion", "Scale", number)
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
def step_impl(context, guid, easting, northing, elevation):
    if IfcFile.get().schema == 'IFC2X3':
        if element.is_a('IfcSite'):
            site = element
        else:
            potential_sites = [
                s for s in get_containing_spatial_elements(element)
                if s.is_a('IfcSite')
            ]
            if potential_sites:
                site = potential_sites[0]
            else:
                assert False, 'The datum element does not belong to a geolocated site'
        map_conversion = assert_pset(site, 'EPset_MapConversion')
    else:
        map_conversion = IfcFile.get().by_type('IfcMapConversion')
        if map_conversion:
            map_conversion = map_conversion[0].get_info()
        else:
            assert False, 'No map conversion was found in the file'

    element = IfcFile.by_guid(guid)
    if not element.ObjectPlacement:
        assert False, 'The element does not have an object placement: {}'.format(
            element)
    m = get_local_placement(element.ObjectPlacement)
    e, n, h = ifcopenshell.util.geolocation.xyz2enh(
        m[0][3],
        m[1][3],
        m[2][3],
        float(map_conversion['Eastings']),
        float(map_conversion['Northings']),
        float(map_conversion['OrthogonalHeight']),
        float(map_conversion['XAxisAbscissa']),
        float(map_conversion['XAxisOrdinate']),
        float(map_conversion['Scale']),
    )
    element_x = round(e, get_decimal_points(easting))
    element_y = round(n, get_decimal_points(northing))
    element_z = round(h, get_decimal_points(elevation))
    expected_placement = (assert_number(easting), assert_number(northing),
                          assert_number(elevation))
    if (element_x, element_y, element_z) != expected_placement:
        assert False, 'The element {} is meant to have a location of {} but instead we found {}'.format(
            element, expected_placement, (element_x, element_y, element_z))
Exemplo n.º 6
0
def step_impl(context, number):
    number = assert_number(number)
    if IfcFile.get().schema == "IFC2X3":
        return check_ifc2x3_geolocation("EPset_MapConversion", "Height", number)
    abscissa = check_ifc4_geolocation("IfcMapConversion", "XAxisAbscissa", should_assert=False)
    ordinate = check_ifc4_geolocation("IfcMapConversion", "XAxisOrdinate", should_assert=False)
    actual_value = round(ifcopenshell.util.geolocation.xy2angle(abscissa, ordinate), 3)
    value = round(number, 3)
    assert actual_value == value, 'We expected a value of "{}" but instead got "{}"'.format(value, actual_value)
Exemplo n.º 7
0
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)