Exemplo n.º 1
0
def from_disk_iter_3D_model():
    from ezdxf.addons.iterdxf import opendxf
    count = 0
    doc = opendxf(_3D_MODEL)
    for e in doc.modelspace():
        e.dxftype()
        count += 1
    doc.close()
    print(f'Iterated  {count} entities in modelspace (fanuc-430-arm.dxf).')
Exemplo n.º 2
0
# Copyright (c) 2020, Manfred Moitzi
# License: MIT License
import time
from pathlib import Path
import ezdxf
from ezdxf.addons import iterdxf

BIGFILE = Path(ezdxf.EZDXF_TEST_FILES) / "GKB-R2010.dxf"
# BIGFILE = Path(ezdxf.EZDXF_TEST_FILES) / 'ACAD_R2000.dxf'
OUTDIR = Path("~/Desktop/Outbox").expanduser()

t0 = time.perf_counter()
doc = iterdxf.opendxf(BIGFILE)
line_exporter = doc.export(OUTDIR / "lines.dxf")
text_exporter = doc.export(OUTDIR / "text.dxf")
polyline_exporter = doc.export(OUTDIR / "polyline.dxf")
lwpolyline_exporter = doc.export(OUTDIR / "lwpolyline.dxf")
try:
    for entity in doc.modelspace():
        if entity.dxftype() == "LINE":
            line_exporter.write(entity)
        elif entity.dxftype() == "TEXT":
            text_exporter.write(entity)
        elif entity.dxftype() == "POLYLINE":
            polyline_exporter.write(entity)
        elif entity.dxftype() == "LWPOLYLINE":
            lwpolyline_exporter.write(entity)
finally:
    line_exporter.close()
    text_exporter.close()
    polyline_exporter.close()
Exemplo n.º 3
0
def entities3(filename):
    print('using opendxf()')
    doc = opendxf(filename)
    yield from doc.modelspace()
    doc.close()