Exemplo n.º 1
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)
Exemplo n.º 2
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)
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
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)
Exemplo n.º 7
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)
Exemplo n.º 8
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)
Exemplo n.º 9
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)