示例#1
0
def test_get_edge_sum_of_converted():
    path_original_geo = './dxf/original_input.GEO'
    path_converted = './dxf/converted_result.dxf'
    path_original = './dxf/original.dxf'

    to_dxf_file(path_original_geo, path_converted)

    msp_converted = get_dxf_model_space(path_converted)
    msp_original = get_dxf_model_space(path_original)

    sum_converted = get_edge_sum(msp_converted)
    sum_original = get_edge_sum(msp_original)

    assert sum_original == sum_converted
示例#2
0
def test_get_min_square_circle_diamond_with_text():
    path = './dxf/circled_diamond_with_text.dxf'
    msp = get_dxf_model_space(path)
    a, b, area = get_min_square(msp, offset=0)

    # text must be ignored
    assert (a, b, area) == (12.0, 10.0, 120.0)
示例#3
0
def test_get_min_square_diamond():
    path = './dxf/diamond.dxf'
    msp = get_dxf_model_space(path)
    a, b, area = get_min_square(msp, offset=0)

    # diamond: (0, 5), (5, 0), (10, 5), (5, 10)
    assert (a, b, area) == (10.0, 10.0, 100.0)
示例#4
0
def test_get_min_square_triangle_offset():
    path = './dxf/triangle.dxf'
    msp = get_dxf_model_space(path)

    a, b, area = get_min_square(msp, offset=1)

    assert (a, b, area) == (12.0, 7.0, 84.0)
示例#5
0
def test_get_length_simple_polyline():
    path = './dxf/simple_polyline.dxf'
    msp = get_dxf_model_space(path)

    polyline = msp[0]
    length = round(get_polyline_length(polyline), 7)

    assert length == 12.3851648
示例#6
0
def test_get_length_complex_polyline():
    path = './dxf/complex_polyline.dxf'
    msp = get_dxf_model_space(path)

    polyline = msp[0]
    length = round(get_polyline_length(polyline), 7)

    assert length == 17.9955743
示例#7
0
def test_get_min_square_negative_offset():
    path = './dxf/triangle.dxf'
    msp = get_dxf_model_space(path)

    # negative offsets must be ignored
    a, b, area = get_min_square(msp, offset=-3)

    assert (a, b, area) == (10.0, 5.0, 50.0)
示例#8
0
def test_get_min_square_arc():
    path = './dxf/UM00056770-20mm-S235JR.DXF'
    msp = get_dxf_model_space(path)
    a, b, area = get_min_square(msp, offset=0)
    a = round(a, 1)
    b = round(b, 1)

    assert (a, b, area) == (97.0, 85.0, 8245.0)
示例#9
0
def test_get_min_square_square():
    path = './dxf/square.dxf'
    msp = get_dxf_model_space(path)

    # a = 10.0, b = 5.0 -> expected 50.0
    a, b, area = get_min_square(msp, offset=0)

    assert (a, b, area) == (10.0, 5.0, 50.0)
示例#10
0
def test_get_min_square_unknown_element():
    path = './dxf/cube_mesh.dxf'
    with pytest.raises(ValueError):
        msp = get_dxf_model_space(path)
        get_min_square(msp, offset=0)
示例#11
0
def test_get_min_square_circle_diamond():
    path = './dxf/circled_diamond.dxf'
    msp = get_dxf_model_space(path)
    a, b, area = get_min_square(msp, offset=0)

    assert (a, b, area) == (12.0, 10.0, 120.0)
示例#12
0
def test_get_min_square_circle():
    path = './dxf/circle.dxf'
    msp = get_dxf_model_space(path)
    a, b, area = get_min_square(msp, offset=0)

    assert (a, b, area) == (8.0, 8.0, 64.0)