Пример #1
0
def step_impl(context, number):
    number = util.assert_number(number)
    if IfcStore.file.schema == "IFC2X3":
        for site in IfcStore.file.by_type("IfcSite"):
            util.assert_pset(site, "EPset_MapConversion", "Scale", number)
        return
    check_ifc4_geolocation("IfcMapConversion", "Scale", number)
Пример #2
0
def step_impl(context, coordinate_reference_name):
    if IfcStore.file.schema == "IFC2X3":
        for site in IfcStore.file.by_type("IfcSite"):
            util.assert_pset(site, "EPset_ProjectedCRS", "Name",
                             coordinate_reference_name)
        return
    check_ifc4_geolocation("IfcProjectedCRS", "Name",
                           coordinate_reference_name)
Пример #3
0
def step_impl(context, unit):
    if IfcStore.file.schema == "IFC2X3":
        for site in IfcStore.file.by_type("IfcSite"):
            util.assert_pset(site, "EPset_ProjectedCRS", "MapUnit", unit)
        return
    actual_value = check_ifc4_geolocation("IfcProjectedCRS",
                                          "MapUnit",
                                          should_assert=False)
    if not actual_value:
        assert False, _("A unit was not provided in the projected CRS")
    if actual_value.is_a("IfcSIUnit"):
        prefix = actual_value.Prefix if actual_value.Prefix else ""
        actual_value = prefix + actual_value.Name
    elif actual_value.is_a("IfcConversionBasedUnit"):
        actual_value = actual_value.Name
    assert actual_value == unit, _(
        'We expected a value of "{}" but instead got "{}"').format(
            unit, actual_value)
Пример #4
0
def step_impl(context, guid, easting, northing, elevation):
    if IfcStore.file.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 = util.assert_pset(site, "EPset_MapConversion")
    else:
        map_conversion = IfcStore.file.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 = util.assert_guid(IfcStore.file, guid)
    if not element.ObjectPlacement:
        assert False, _("The element does not have an object placement: {}"
                        ).format(element)
    m = ifcopenshell.util.placement.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 = (util.assert_number(easting),
                          util.assert_number(northing),
                          util.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))
Пример #5
0
def step_impl(context, value):
    if IfcStore.file.schema == "IFC2X3":
        for site in IfcStore.file.by_type("IfcSite"):
            util.assert_pset(site, "EPset_ProjectedCRS", "Description", value)
        return
    check_ifc4_geolocation("IfcProjectedCRS", "Description", value)
Пример #6
0
def step_impl(context):
    if IfcStore.file.schema == "IFC2X3":
        for site in IfcStore.file.by_type("IfcSite"):
            util.assert_pset(site, "EPset_MapConversion")
    check_ifc4_geolocation("IfcMapConversion")