1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
# Copyright (c) 2020-2022, Manfred Moitzi
# License: MIT License
import os
from collections import Counter
import time
import ezdxf
CADKIT = "CADKitSamples"
CADKIT_FILES = [
"A_000217.dxf", # 0
"AEC Plan Elev Sample.dxf", # 1
"backhoe.dxf", # 2
"BIKE.DXF", # 3
"cnc machine.dxf", # 4
"Controller-M128-top.dxf", # 5
"drilling_machine.dxf", # 6
"fanuc-430-arm.dxf", # 7
"Floor plan.dxf", # 8
"gekko.DXF", # 9
"house design for two family with comman staircasedwg.dxf", # 10
"house design.dxf", # 11
"kit-dev-coldfire-xilinx_5213.dxf", # 12
"Laurana50k.dxf", # 13
"Lock-Off.dxf", # 14
"Mc Cormik-D3262.DXF", # 15
"Mechanical Sample.dxf", # 16
"Nikon_D90_Camera.DXF", # 17
"pic_programmer.dxf", # 18
"Proposed Townhouse.dxf", # 19
"Shapefont.dxf", # 20
"SMA-Controller.dxf", # 21
"Tamiya TT-01.DXF", # 22
"torso_uniform.dxf", # 23
"Tyrannosaurus.DXF", # 24
"WOOD DETAILS.dxf", # 25
]
STD_FILES = [
CADKIT_FILES[1],
CADKIT_FILES[23],
]
def count_entities(msp):
counter = Counter()
for entity in msp:
counter[entity.dxftype()] += 1
return counter
for _name in CADKIT_FILES:
filename = ezdxf.options.test_files_path / CADKIT / _name
print(f"reading file: {filename}")
start_reading = time.perf_counter()
doc = ezdxf.readfile(filename)
msp = doc.modelspace()
new_entities = count_entities(msp)
new_count = len(msp)
new_timing = time.perf_counter() - start_reading
print(f"loaded {new_count} entities in {new_timing:.3f} sec")
|