I tried to extract the HATCH entities along with their pattern types which are inserted in drawings as BLOCK REFERENCES using INSERT tag. The dxf drawing is https://drive.google.com/open?id=1SnGDaIh8XiMe0QKAQy1RXzpT-rLNcLk7
I used the following code using updated package ezdxf-0.12 on python-3.6
import ezdxf
import argparse
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--input", required=True,
help="path to input dxf file")
args = vars(ap.parse_args())
file = args["input"]
doc = ezdxf.readfile(file)
msp = doc.modelspace()
for flag_ref in msp.query('INSERT'):
for entity in flag_ref.virtual_entities():
if entity.dxftype() == 'HATCH':
print("HATCH", entity.dxf.pattern_name)
The code did not print HATCH entities having ANSI31 patterns. There are 2 of them in the dxf file, which can be viewed in Autocad (or even looked up using regular text editors). It may be noted that the HATCH entities having SOLID patterns in the given dxf file were printed as usual.
Is there any bug in the code or the package update?