Exemple #1
0
def test_layer_entry():
    from ezdxf.entities.layer import Layer
    layer = Layer.new('LAYER', dxfattribs={'name': 'TestTest', 'color': 3})
    code = table_entries_to_code([layer], drawing='doc')
    exec(str(code), globals())
    layer = doc.layers.get('TestTest')
    assert layer.dxf.color == 3
Exemple #2
0
def test_layer_entry():
    from ezdxf.entities.layer import Layer

    layer = Layer.new("LAYER", dxfattribs={"name": "TestTest", "color": 3})
    code = table_entries_to_code([layer], drawing="doc")
    exec(str(code), globals())
    layer = doc.layers.get("TestTest")
    assert layer.dxf.color == 3
Exemple #3
0
def test_ltype_entry():
    from ezdxf.entities.ltype import Linetype

    ltype = Linetype.new('FFFF', dxfattribs={
        'name': 'TEST',
        'description': 'TESTDESC',
    })
    ltype.setup_pattern([0.2, 0.1, -0.1])
    code = table_entries_to_code([ltype], drawing='doc')
    exec(str(code), globals())
    new_ltype = doc.linetypes.get('TEST')
    assert new_ltype.dxf.description == ltype.dxf.description
    assert new_ltype.pattern_tags.tags == ltype.pattern_tags.tags
    # all imports added
    assert any(line.endswith('Tags') for line in code.imports)
    assert any(line.endswith('dxftag') for line in code.imports)
    assert any(line.endswith('LinetypePattern') for line in code.imports)
Exemple #4
0
def test_ltype_entry():
    from ezdxf.entities.ltype import Linetype

    ltype = Linetype.new(
        "FFFF",
        dxfattribs={
            "name": "TEST",
            "description": "TESTDESC",
        },
    )
    ltype.setup_pattern([0.2, 0.1, -0.1])
    code = table_entries_to_code([ltype], drawing="doc")
    exec(str(code), globals())
    new_ltype = doc.linetypes.get("TEST")
    assert new_ltype.dxf.description == ltype.dxf.description
    assert new_ltype.pattern_tags.tags == ltype.pattern_tags.tags
    # all imports added
    assert any(line.endswith("Tags") for line in code.imports)
    assert any(line.endswith("dxftag") for line in code.imports)
    assert any(line.endswith("LinetypePattern") for line in code.imports)