Exemple #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")
Exemple #2
0
def add_surfaces(model, builder):
    nb = 5
    uuids = []
    for i in range(nb):
        uuids.append(builder.add_surface())
        builder.set_surface_name(uuids[-1], "surface" + str(len(uuids)))

    temp_surface = model.surface(builder.add_surface())
    builder.remove_surface(temp_surface)
    if model.nb_surfaces() != nb:
        raise ValueError("[Test] BRep should have 5 surfaces")
    if model.surface(uuids[1]).name() != "surface2":
        raise ValueError("[Test] Wrong Surface name")
    return uuids
Exemple #3
0
def test_incidence_ranges(model, corner_uuids, line_uuids, surface_uuids,
                          block_uuids):
    corner_incidence_count = 0
    for corner_incidence in model.incident_lines(model.corner(
            corner_uuids[0])):
        corner_incidence_count += 1
        if corner_incidence.id().string() != line_uuids[0].string(
        ) and corner_incidence.id().string() != line_uuids[2].string(
        ) and corner_incidence.id().string() != line_uuids[5].string():
            raise ValueError(
                "[Test] IncidentLineRange iteration result is not correct")
    if corner_incidence_count != 3:
        raise ValueError("[Test] IncidentLineRange should iterates on 3 Lines")

    line_incidence_count = 0
    for line_incidence in model.incident_surfaces(model.line(line_uuids[0])):
        line_incidence_count += 1
        if line_incidence.id().string() != surface_uuids[0].string(
        ) and line_incidence.id().string() != surface_uuids[1].string():
            raise ValueError(
                "[Test] IncidentSurfaceRange iteration result is not correct")
    if line_incidence_count != 2:
        raise ValueError(
            "[Test] IncidentSurfaceRange should iterates on 2 Surfaces")

    surface_incidence_count = 0
    for surface_incidence in model.incident_blocks(
            model.surface(surface_uuids[0])):
        surface_incidence_count += 1
        if surface_incidence.id().string() != block_uuids[0].string():
            raise ValueError(
                "[Test] IncidentBlockRange iteration result is not correct")
    if surface_incidence_count != 1:
        raise ValueError(
            "[Test] IncidentBlockRange should iterates on 1 Block")
Exemple #4
0
def add_internal_line_relations(model, builder, line_uuids, surface_uuids,
                                block_uuids):
    for line_id in line_uuids:
        builder.add_line_surface_internal_relationship(
            model.line(line_id), model.surface(surface_uuids[0]))
        builder.add_line_block_internal_relationship(
            model.line(line_id), model.block(block_uuids[0]))

    for line_id in line_uuids:
        for embedding in model.embedding_surfaces_of_line(model.line(line_id)):
            if surface_uuids[0].string() != embedding.id().string():
                raise ValueError(
                    "[Test] All Line embedded surfaces should be Surfaces")
            if model.nb_internal_lines_of_surface(embedding) != len(
                    line_uuids):
                raise ValueError("[Test] Surface should embed all Lines")
        for embedding in model.embedding_blocks_of_line(model.line(line_id)):
            if block_uuids[0].string() != embedding.id().string():
                raise ValueError(
                    "[Test] All Lines embedded blocks should be Blocks")
            if model.nb_internal_lines_of_block(embedding) != len(line_uuids):
                raise ValueError("[Test] Block should embed all Lines")
        if model.nb_embeddings(line_id) != 2:
            raise ValueError(
                "[Test] All Surfaces should be embedded to 1 Block and 1 Surface"
            )
        if model.nb_embedding_surfaces_of_line(model.line(line_id)) != 1:
            raise ValueError(
                "[Test] All Surfaces should be embedded to 1 Surface")
        if model.nb_embedding_blocks_of_line(model.line(line_id)) != 1:
            raise ValueError(
                "[Test] All Surfaces should be embedded to 1 Block")
Exemple #5
0
def add_surface_block_relation(model, builder, surface_uuids, block_uuids):
    for surface_id in surface_uuids:
        builder.add_surface_block_boundary_relationship(
            model.surface(surface_id), model.block(block_uuids[0]))

    for surface_id in surface_uuids:
        for incidence in model.incident_blocks(model.surface(surface_id)):
            if block_uuids[0].string() != incidence.id().string():
                raise ValueError(
                    "[Test] All Surfaces incidences should be Blocks")
        if model.nb_incidences(surface_id) != 1:
            raise ValueError(
                "[Test] All Surfaces should be connected to 1 Block")

    if model.nb_boundaries(block_uuids[0]) != len(surface_uuids):
        raise ValueError(
            "[Test] The Block should be connected to all Surfaces")
Exemple #6
0
def add_line_surface_boundary_relation(model, builder, line_uuids,
                                       surface_uuids):
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[0]), model.surface(surface_uuids[0]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[1]), model.surface(surface_uuids[0]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[2]), model.surface(surface_uuids[0]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[2]), model.surface(surface_uuids[1]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[3]), model.surface(surface_uuids[1]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[4]), model.surface(surface_uuids[1]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[5]), model.surface(surface_uuids[1]))

    for line_id in line_uuids:
        for incidence in model.incident_surfaces(model.line(line_id)):
            if surface_uuids[0].string() != incidence.id().string(
            ) and surface_uuids[1].string() != incidence.id().string():
                raise ValueError(
                    "[Test] All Lines incidences should be Surfaces")
    if model.nb_boundaries(surface_uuids[0]) != 3:
        raise ValueError("[Test] Surface 0 should have 3 Lines as boundaries")
    if model.nb_boundaries(surface_uuids[1]) != 4:
        raise ValueError("[Test] Surface 1 should have 4 Lines as boundaries")
Exemple #7
0
def add_surfaces_in_model_boundaries(model, builder, surface_uuids,
                                     boundary_uuids):
    builder.add_surface_in_model_boundary(
        model.surface(surface_uuids[0]),
        model.model_boundary(boundary_uuids[0]))
    for i in range(1, 4):
        builder.add_surface_in_model_boundary(
            model.surface(surface_uuids[i]),
            model.model_boundary(boundary_uuids[1]))
    builder.add_surface_in_model_boundary(
        model.surface(surface_uuids[4]),
        model.model_boundary(boundary_uuids[2]))

    for surface_id in surface_uuids:
        if model.nb_collections(surface_id) != 1:
            raise ValueError(
                "[Test] All Surfaces should be in 1 collection (of type Boundary)"
            )
Exemple #8
0
def add_surfaces(model, builder):
    nb = 2
    uuids = []
    for i in range(nb):
        uuids.append(builder.add_surface())

    temp_surface = model.surface(builder.add_surface())
    builder.remove_surface(temp_surface)
    if model.nb_surfaces() != nb:
        raise ValueError("[Test] Section should have 2 surfaces")
    return uuids
Exemple #9
0
def add_internal_surface_relations(model, builder, surface_uuids, block_uuids):
    for surface_id in surface_uuids:
        builder.add_surface_block_internal_relationship(
            model.surface(surface_id), model.block(block_uuids[0]))

    for surface_id in surface_uuids:
        for embedding in model.embedding_blocks_of_surface(
                model.surface(surface_id)):
            if model.nb_internal_surfaces_of_block(embedding) != len(
                    surface_uuids):
                raise ValueError("[Test] Block should embed all Surfaces")
            if block_uuids[0].string() != embedding.id().string():
                raise ValueError(
                    "[Test] All Surfaces embeddings should be Blocks")
        if model.nb_embeddings(surface_id) != 1:
            raise ValueError(
                "[Test] All Surfaces should be embedded to 1 Block")
        if model.nb_embedding_blocks_of_surface(
                model.surface(surface_id)) != 1:
            raise ValueError(
                "[Test] All Surfaces should be embedded to 1 Block")
def add_internal_corner_relations( model, builder, corner_uuids, surface_uuids ):
    for corner_id in corner_uuids:
        builder.add_corner_surface_internal_relationship( model.corner( corner_id ), model.surface( surface_uuids[0] ) )

    for corner_id in corner_uuids:
        for embedding in model.embedding_surfaces_of_corner( model.corner( corner_id ) ):
            if surface_uuids[0].string() != embedding.id().string():
                raise ValueError( "[Test] All Corners embeddings should be Surfaces" )
            if model.nb_internal_corners_of_surface( embedding ) != len( corner_uuids ):
                raise ValueError( "[Test] Surface should embed all Corners" )
        if model.nb_embeddings( corner_id ) != 1:
            raise ValueError( "[Test] All Corners should be embedded to 1 Surface" )
        if model.nb_embedding_surfaces_of_corner( model.corner( corner_id ) ) != 1:
            raise ValueError( "[Test] All Corners should be embedded to 1 Surface" )
Exemple #11
0
def add_line_surface_boundary_relation(model, builder, line_uuids,
                                       surface_uuids):
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[0]), model.surface(surface_uuids[0]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[0]), model.surface(surface_uuids[1]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[1]), model.surface(surface_uuids[0]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[1]), model.surface(surface_uuids[2]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[2]), model.surface(surface_uuids[0]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[2]), model.surface(surface_uuids[3]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[3]), model.surface(surface_uuids[1]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[3]), model.surface(surface_uuids[2]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[4]), model.surface(surface_uuids[2]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[4]), model.surface(surface_uuids[3]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[5]), model.surface(surface_uuids[1]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[5]), model.surface(surface_uuids[3]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[6]), model.surface(surface_uuids[1]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[6]), model.surface(surface_uuids[4]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[7]), model.surface(surface_uuids[2]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[7]), model.surface(surface_uuids[4]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[8]), model.surface(surface_uuids[3]))
    builder.add_line_surface_boundary_relationship(
        model.line(line_uuids[8]), model.surface(surface_uuids[4]))

    for line_id in line_uuids:
        for incidence in model.incident_surfaces(model.line(line_id)):
            if not find_uuid_in_list(surface_uuids, incidence.id()):
                raise ValueError(
                    "[Test] All Lines incidences should be Surfaces")
        if model.nb_incidences(line_id) != 2:
            raise ValueError(
                "[Test] All Lines should be connected to 2 Surfaces")