Exemple #1
0
def test_new_style_polyface_face_count():
    doc = ezdxf.new()
    section = EntitySection(doc, load_entities(NEW_STYLE_POLYFACE, 'ENTITIES'))
    entities = list(section)
    polyface = entities[0]
    faces = list(polyface.faces())
    assert 6 == len(faces)
Exemple #2
0
def test_load_section():
    doc = ezdxf.new('R2000')
    ent = load_entities(TESTOBJECTS, 'OBJECTS')

    section = ObjectsSection(doc, ent)
    assert len(section) == 6
    assert section[0].dxftype() == 'DICTIONARY'
def test_load_section():
    doc = ezdxf.new("R2000")
    ent = load_entities(TESTOBJECTS, "OBJECTS")

    section = ObjectsSection(doc, ent)
    assert len(section) == 6
    assert section[0].dxftype() == "DICTIONARY"
Exemple #4
0
def test_load_table_with_invalid_table_entry():
    """This LAYERS table has an invalid APPID table entry, which should be
    ignored at the loading stage.
    """
    doc = ezdxf.new("R12")
    entities = list(load_entities(INVALID_TABLE_ENTRY, "TABLES"))
    table = Table()
    table.load(doc, iter(entities[1:-1]))  # without SECTION tags and ENDTAB
    assert len(table) == 0
Exemple #5
0
def test_load_section():
    doc = ezdxf.new()
    entities = load_entities(TEST_CLASSES, 'CLASSES', doc)
    classes = ClassesSection(doc, entities)
    assert len(classes.classes) == 3

    # this tests internals - use storage key is not exposed by API
    assert ('ACDBDICTIONARYWDFLT',
            'AcDbDictionaryWithDefault') in classes.classes
    assert ('DICTIONARYVAR', 'AcDbDictionaryVar') in classes.classes
    assert ('TABLESTYLE', 'AcDbTableStyle') in classes.classes
def test_load_section():
    doc = ezdxf.new()
    entities = load_entities(TEST_CLASSES, "CLASSES")
    classes = ClassesSection(doc, entities)
    assert len(classes.classes) == 3

    # this tests internals - use storage key is not exposed by API
    assert (
        "ACDBDICTIONARYWDFLT",
        "AcDbDictionaryWithDefault",
    ) in classes.classes
    assert ("DICTIONARYVAR", "AcDbDictionaryVar") in classes.classes
    assert ("TABLESTYLE", "AcDbTableStyle") in classes.classes
Exemple #7
0
def test_empty_section(dxf12):
    blocks = BlocksSection(dxf12, list(load_entities(EMPTYSEC, 'BLOCKS')))
    # the NES creates automatically *Model_Space and *Paper_Space blocks
    assert '*Model_Space' in blocks
    assert '*Paper_Space' in blocks

    collector = TagCollector(dxfversion=dxf12.dxfversion)
    blocks.export_dxf(collector)

    assert collector.tags[0] == (0, 'SECTION')
    assert collector.tags[1] == (2, 'BLOCKS')
    assert collector.tags[2] == (0, 'BLOCK')
    # tag[3] is a arbitrary handle
    assert collector.tags[3][0] == 5
    assert collector.tags[4] == (8, '0')  # default layer '0'
    assert collector.tags[5] == (
        2, '$Model_Space')  # export modelspace with leading '$' for R12
    assert collector.tags[-1] == (0, 'ENDSEC')
def bounded_blocks(dxf12):
    entities = list(load_entities(TESTBLOCKS, 'BLOCKS'))
    for entity in entities:
        factory.bind(entity, dxf12)
    return BlocksSection(dxf12, entities)
def blocks(dxf12):
    return BlocksSection(dxf12, list(load_entities(TESTBLOCKS, 'BLOCKS')))
Exemple #10
0
def test_ac1024_load_table():
    doc = ezdxf.new("R2010")
    entities = list(load_entities(AC1024TABLE, "TABLES"))
    table = AppIDTable()
    table.load(doc, iter(entities[1:-1]))  # without SECTION tags and ENDTAB
    assert 10 == len(table)
Exemple #11
0
def test_ac1024_load_table():
    doc = ezdxf.new('R2010')
    entities = list(load_entities(AC1024TABLE, 'TABLES', doc))
    table = Table(doc, entities[1:-1])  # without SECTION tags and ENDTAB
    assert 10 == len(table)