def run_test_brep():
    test_dir = os.path.dirname(__file__)
    data_dir = os.path.abspath(os.path.join(test_dir,
                                            "../../../../tests/data"))
    brep = model.load_brep(os.path.join(data_dir, "layers.og_brep"))
    model.triangulate_brep_surface_meshes(brep)
    model.convert_brep_surface_meshes_into_triangulated_surfaces(brep)
    model.convert_brep_block_meshes_into_tetrahedral_solids(brep)

    file_io = "test_triangulated_surfaces." + brep.native_extension()
    model.save_brep(brep, file_io)
    brep2 = model.load_brep(file_io)
示例#2
0
    add_corner_line_boundary_relation(brep, builder, corner_uuids, line_uuids)
    add_line_surface_boundary_relation(brep, builder, line_uuids,
                                       surface_uuids)
    add_surface_block_relation(brep, builder, surface_uuids, block_uuids)
    add_surfaces_in_model_boundaries(brep, builder, surface_uuids,
                                     model_boundary_uuids)
    add_internal_corner_relations(brep, builder, corner_uuids, surface_uuids,
                                  block_uuids)
    add_internal_line_relations(brep, builder, line_uuids, surface_uuids,
                                block_uuids)
    add_internal_surface_relations(brep, builder, surface_uuids, block_uuids)
    if brep.nb_internals(
            block_uuids[0]
    ) != len(corner_uuids) + len(line_uuids) + len(surface_uuids):
        raise ValueError(
            "[Test] The Block should embed all Corners & Lines & Surfaces (that are internal to the Block)"
        )
    test_boundary_ranges(brep, corner_uuids, line_uuids, surface_uuids,
                         block_uuids)
    test_incidence_ranges(brep, corner_uuids, line_uuids, surface_uuids,
                          block_uuids)
    test_item_ranges(brep, surface_uuids, model_boundary_uuids)
    test_clone(brep)

    file_io = "test." + brep.native_extension()
    model.save_brep(brep, file_io)

    brep2 = model.BRep()
    model.load_brep(brep2, file_io)
    test_reloaded_brep(brep2)
示例#3
0
                                   corner_mapping.in2out(line_corners[1].id()))
            line_mapping.map(line.id(), line_id)
    for surface in brep1.surfaces():
        if not surface_mapping.has_mapping_input(surface.id()):
            mapped_corners = []
            for v in range(surface.mesh().nb_vertices()):
                corner_id = _corner_from_surface_vertex(brep1, surface, v)
                mapped_corners.append(corner_mapping.in2out(corner_id))
            mapped_lines = []
            for surface_line in brep1.boundary_lines(surface):
                mapped_lines.append(line_mapping.in2out(surface_line.id()))
            surface_id = _create_surface(brep, builder, mapped_corners,
                                         mapped_lines)
            surface_mapping.map(surface.id(), surface_id)
    block_mapping = basic.BijectiveMappinguuid()
    for block in brep1.blocks():
        mapped_surfaces = []
        for block_surface in brep1.boundary_surfaces(block):
            mapped_surfaces.append(surface_mapping.in2out(block_surface.id()))
        block_id = _create_block(brep, builder, mapped_surfaces)
        block_mapping.map(block.id(), block_id)


if __name__ == '__main__':
    result = create_cube(0, 0, 0, 1, 1, 1)
    cube1 = create_cube(0, 0, 1, 1, 1, 2)
    glue_model_surfaces(result, cube1)
    cube2 = create_cube(0, 0, 2, 1, 1, 3)
    glue_model_surfaces(result, cube2)
    model.save_brep(result, "result." + result.native_extension())