コード例 #1
0
ファイル: test-py-section.py プロジェクト: Algiane/OpenGeode
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")
コード例 #2
0
ファイル: test-py-brep.py プロジェクト: Co1dCoder/OpenGeode
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")
コード例 #3
0
ファイル: test-py-brep.py プロジェクト: Co1dCoder/OpenGeode
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")