I want to import simple blocks (rectangles with a "Value", that is a text string) from a DXF to QGIS. I want to keep that value so it shows up as an attribute in the corresponding layer in QGIS. I have tried Importing from the File-menu, and importing as a single vector layer.

I have tried importing from DWG, different versions, and DXF, different versions. The closest I come is that QGIS create a point that origins from a blocks text components insertion (text placement) point. But I want this text to be an attribute in the imported block object (a point in QGIS) instead.

enter image description here

  • Try exporting the data from ACAD using the spatial manager to create a .shp.
    – Erik
    Jun 11, 2020 at 11:28
  • 1
    Try AnotherDXFImporter Plugin: plugins.qgis.org/plugins/AnotherDXF2Shape Jun 11, 2020 at 15:07
  • @Erik I tried the spatial manager but the result is the same - it doesn't seem to be able to read the "Value" field that I want.
    – Andreas
    Jun 12, 2020 at 12:35
  • @HeikkiVesantoI tried this before, the same result unfortunately.
    – Andreas
    Jun 12, 2020 at 12:36
  • @Erik Update: I actually found the info embedded in a long text string in the field "ExtendedEntity", perhaps I can extract that using Excel. I will try it, thanks.
    – Andreas
    Jun 12, 2020 at 12:43

1 Answer 1


I wrote a small gawk script to collect attributes from DXF file into a CSV file, what you can load as delimited text (Point) layer into QGIS. See: https://github.com/zsiki/dxf_utils (dxf_attr2csv.awk).

Simple docs are available on GitHub.

  • Wow, that worked exactly as I wanted. Thank you very much!
    – Andreas
    Jun 12, 2020 at 12:59
  • It seems that the script creates the coordinates from the insertion point of the text included in the block, rather than get the coordinates of the center point of the block symbol, is that correct? I guess there is no way to adjust this?
    – Andreas
    Jun 23, 2020 at 7:18
  • You are right, the position of the attribute is sent to the output, not the insertion point of the block. You should move two lines: if (last == " 10") { x = $0; } if (last == " 20") { y = $0; } into the previous conditional block. I uploaded the code variant to github as dxf2atr.awk
    – Zoltan
    Jun 23, 2020 at 19:20
  • It works just as I hoped, thank you very much for your help and quick response!
    – Andreas
    Jun 25, 2020 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.