Ejemplo n.º 1
0
def test_boundary_ranges(model, corner_uuids, line_uuids, surface_uuids):
    line_boundary_count = 0
    for line_boundary in model.boundary_corners(model.line(line_uuids[0])):
        line_boundary_count += 1
        if line_boundary.id().string() != corner_uuids[0].string(
        ) and line_boundary.id().string() != corner_uuids[1].string():
            raise ValueError(
                "[Test] BoundaryCornerRange iteration result is not correct")
        if not model.is_line_boundary(line_boundary, model.line(
                line_uuids[0])):
            raise ValueError("[Test] Corner should be boundary of Line")
    if line_boundary_count != 2:
        raise ValueError(
            "[Test] BoundaryCornerRange should iterates on 2 Corners")

    surface_boundary_count = 0
    for surface_boundary in model.boundary_lines(
            model.surface(surface_uuids[0])):
        surface_boundary_count += 1
        if surface_boundary.id().string() != line_uuids[0].string(
        ) and surface_boundary.id().string() != line_uuids[1].string(
        ) and surface_boundary.id().string() != line_uuids[2].string():
            raise ValueError(
                "[Test] BoundaryLineRange iteration result is not correct")
        if not model.is_surface_boundary(surface_boundary,
                                         model.surface(surface_uuids[0])):
            raise ValueError("[Test] Line should be boundary of Surface")
    if surface_boundary_count != 3:
        raise ValueError("[Test] BoundaryLineRange should iterates on 3 Lines")
Ejemplo n.º 2
0
def add_corner_line_boundary_relation(model, builder, corner_uuids,
                                      line_uuids):
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[0]), model.line(line_uuids[0]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[0]), model.line(line_uuids[5]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[0]), model.line(line_uuids[2]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[1]), model.line(line_uuids[0]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[1]), model.line(line_uuids[1]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[1]), model.line(line_uuids[3]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[2]), model.line(line_uuids[1]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[2]), model.line(line_uuids[2]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[2]), model.line(line_uuids[4]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[3]), model.line(line_uuids[5]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[3]), model.line(line_uuids[6]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[3]), model.line(line_uuids[8]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[4]), model.line(line_uuids[3]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[4]), model.line(line_uuids[6]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[4]), model.line(line_uuids[7]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[5]), model.line(line_uuids[4]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[5]), model.line(line_uuids[7]))
    builder.add_corner_line_boundary_relationship(
        model.corner(corner_uuids[5]), model.line(line_uuids[8]))

    for corner_id in corner_uuids:
        for incidence in model.incident_lines(model.corner(corner_id)):
            if not find_uuid_in_list(line_uuids, incidence.id()):
                raise ValueError(
                    "[Test] All Corners incidences should be Lines")
        if model.nb_incidences(corner_id) != 3:
            raise ValueError(
                "[Test] All Corners should be connected to 3 Lines")

    for line_id in line_uuids:
        for boundary in model.boundary_corners(model.line(line_id)):
            if not find_uuid_in_list(corner_uuids, boundary.id()):
                raise ValueError(
                    "[Test] All Lines incidences should be Corners")
        if model.nb_boundaries(line_id) != 2:
            raise ValueError(
                "[Test] All Lines should be connected to 2 Corners")