I made a plugin to quickly analyse dxf files for work. It works fine on most .dxf files, but for some reason it does not work on all. The ones that do not work properly are imported as an "image" of some sorts. They do contain attribute values but do not poses any lines.
However, when I import those files with the "add vector layer" tool the lines do show up! I did discover that the .dxf files that do not work also contain point data, while the files that do work only contain line data.
I use the following code to import .dxf files. I am only interested in the line data of the .dxf files. Is it possible that there is something wrong with the code?
dxf_path = self.dlg.lineEdit_dxf.text() dxf_info = "|layername = entities|geometryType=LineString" dxf_output_filename = os.path.splitext(os.path.basename(dxf_path)) dxf_vl = QgsVectorLayer(dxf_path + dxf_info, dxf_output_filename + ".dxf", 'ogr') if dxf_vl.isValid() == True: QgsMapLayerRegistry.instance().addMapLayer(dxf_vl)