Beispiel #1
0
def test_3dface():
    face = Face3d()
    face.dxf.invisible = 2 + 8
    assert face.is_invisible_edge(0) is False
    assert face.is_invisible_edge(1) is True
    assert face.is_invisible_edge(2) is False
    assert face.is_invisible_edge(3) is True

    assert face.get_edges_visibility() == [True, False, True, False]

    face.dxf.vtx3 = (1, 2, 3)
    assert face.get_edges_visibility() == [True, False, True, False]

    face.dxf.invisible = 0
    face.set_edge_visibility(3, False)
    assert face.dxf.invisible == 8
    face.set_edge_visibility(1, False)
    assert face.dxf.invisible == 10
    face.set_edge_visibility(3, True)
    assert face.dxf.invisible == 2

    collector = TagCollector(dxfversion=DXF2000)
    face.export_dxf(collector)
    assert collector.tags[0] == (0, "3DFACE")
    assert collector.tags[5] == (100, "AcDbFace")
Beispiel #2
0
def test_3dface_quad_vertices():
    face = Face3d()
    for index, vertex in enumerate([(0, 0), (1, 0), (1, 1), (0, 1)]):
        face[index] = vertex
    # no weird vertex order:
    assert face.wcs_vertices() == [(0, 0), (1, 0), (1, 1), (0, 1)]
    assert face.wcs_vertices(close=True) == [(0, 0), (1, 0), (1, 1), (0, 1),
                                             (0, 0)]
Beispiel #3
0
def test_3dface_triangle_vertices():
    face = Face3d()
    for index, vertex in enumerate([(0, 0), (1, 0), (1, 1), (1, 1)]):
        face[index] = vertex
    assert face.get_edges_visibility() == [True, True, True, True]
    # changed in v0.17.2: do not return duplicated vertices at the end
    assert face.wcs_vertices() == [(0, 0), (1, 0), (1, 1)]
    assert face.wcs_vertices(close=True) == [
        (0, 0),
        (1, 0),
        (1, 1),
        (0, 0),
    ]
Beispiel #4
0
def test_3dface_quad_vertices():
    face = Face3d()
    for index, vertex in enumerate([(0, 0), (1, 0), (1, 1), (0, 1)]):
        face[index] = vertex
    assert face.get_edges_visibility() == [True, True, True, True]
    # no weird vertex order:
    assert face.wcs_vertices() == [(0, 0), (1, 0), (1, 1), (0, 1)]
    assert face.wcs_vertices(close=True) == [
        (0, 0),
        (1, 0),
        (1, 1),
        (0, 1),
        (0, 0),
    ]
Beispiel #5
0
def test_3dface():
    face = Face3d()
    face.dxf.invisible = 2 + 8
    assert face.is_invisible_edge(0) is False
    assert face.is_invisible_edge(1) is True
    assert face.is_invisible_edge(2) is False
    assert face.is_invisible_edge(3) is True

    face.dxf.invisible = 0
    face.set_edge_visibility(3, False)
    assert face.dxf.invisible == 8
    face.set_edge_visibility(1, False)
    assert face.dxf.invisible == 10
    face.set_edge_visibility(3, True)
    assert face.dxf.invisible == 2

    collector = TagCollector(dxfversion=DXF2000)
    face.export_dxf(collector)
    assert collector.tags[0] == (0, '3DFACE')
    assert collector.tags[5] == (100, 'AcDbFace')
Beispiel #6
0
def test_3dface_triangle_vertices():
    face = Face3d()
    for index, vertex in enumerate([(0, 0), (1, 0), (1, 1), (1, 1)]):
        face[index] = vertex
    assert face.wcs_vertices() == [(0, 0), (1, 0), (1, 1)]
    assert face.wcs_vertices(close=True) == [(0, 0), (1, 0), (1, 1), (0, 0)]
Beispiel #7
0
def test_trace_translate():
    face = Face3d()
    face.dxf.vtx1 = (3, 3, 0)
    face.translate(1, 1, 0)
    assert face.dxf.vtx1 == (4, 4, 0)