def run_test_section():
    section = model.Section()
    test_dir = os.path.dirname(__file__)
    data_dir = os.path.abspath(os.path.join(test_dir,
                                            "../../../../tests/data"))
    model.load_section(section, os.path.join(data_dir, "test_v5.og_sctn"))
    model.convert_section_surface_meshes_into_triangulated_surfaces(section)

    file_io = "test_triangulated_surfaces." + section.native_extension()
    model.save_section(section, file_io)
    section2 = model.Section()
    model.load_section(section2, file_io)
예제 #2
0
def test_clone(section):
    section2 = model.Section()
    builder = model.SectionBuilder(section2)
    builder.copy(section)
    if section2.nb_corners() != 5:
        raise ValueError("[Test] Section should have 5 corners")
    if section2.nb_lines() != 6:
        raise ValueError("[Test] Section should have 6 lines")
    if section2.nb_surfaces() != 2:
        raise ValueError("[Test] Section should have 2 surfaces")
    if section2.nb_model_boundaries() != 2:
        raise ValueError("[Test] Section should have 2 model boundaries")
예제 #3
0
def test_clone(section):
    section2 = model.Section()
    builder = model.SectionBuilder(section2)
    builder.copy(section)
    if section2.nb_corners() != 5:
        raise ValueError("[Test] Section should have 5 corners")
    if section2.nb_lines() != 6:
        raise ValueError("[Test] Section should have 6 lines")
    if section2.nb_surfaces() != 2:
        raise ValueError("[Test] Section should have 2 surfaces")
    if section2.nb_model_boundaries() != 2:
        raise ValueError("[Test] Section should have 2 model boundaries")


if __name__ == '__main__':
    section = model.Section()
    builder = model.SectionBuilder(section)

    # This Section represents a house (with one triangle and one square as in children sketches)
    corner_uuids = add_corners(section, builder)
    line_uuids = add_lines(section, builder)
    surface_uuids = add_surfaces(section, builder)
    model_boundary_uuids = add_model_boundaries(section, builder)

    add_corner_line_boundary_relation(section, builder, corner_uuids,
                                      line_uuids)
    add_line_surface_boundary_relation(section, builder, line_uuids,
                                       surface_uuids)
    add_lines_in_model_boundaries(section, builder, line_uuids,
                                  model_boundary_uuids)
    add_internal_corner_relations(section, builder, corner_uuids,
예제 #4
0
def test_clone( section ):
    section2 = model.Section()
    builder = model.SectionBuilder( section2 )
    builder.copy( section )
    if section2.nb_corners() != 5: 
        raise ValueError( "[Test] Section should have 5 corners" )
    if section2.nb_lines() != 6: 
        raise ValueError( "[Test] Section should have 6 lines" )
    if section2.nb_surfaces() != 2: 
        raise ValueError( "[Test] Section should have 2 surfaces" )
    if section2.nb_model_boundaries() != 2:
        raise ValueError( "[Test] Section should have 2 model boundaries" )

if __name__ == '__main__':
    section = model.Section()
    builder = model.SectionBuilder( section )
    
    # This Section represents a house (with one triangle and one square as in children sketches)
    corner_uuids = add_corners( section, builder )
    line_uuids = add_lines( section, builder )
    surface_uuids = add_surfaces( section, builder )
    model_boundary_uuids = add_model_boundaries( section, builder )
    
    add_corner_line_boundary_relation( section, builder, corner_uuids, line_uuids )
    add_line_surface_boundary_relation( section, builder, line_uuids, surface_uuids )
    add_lines_in_model_boundaries( section, builder, line_uuids, model_boundary_uuids )
    add_internal_corner_relations( section, builder, corner_uuids, surface_uuids )
    add_internal_line_relations( section, builder, line_uuids, surface_uuids )
    if section.nb_internals( surface_uuids[0] ) != len( corner_uuids ) + len( line_uuids ):
        raise ValueError( "[Test] The Surface should embed all Corners & Lines (that are internal to the Surface)" )