Bug report #7455

Load dxf and apply query does not work

Added by Duarte Carreira almost 12 years ago. Updated over 11 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Vectors
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:16412

Description

When loading a dxf file, all content is loaded as a single layer named "entities".

To separate geometry types it is necessary to apply a query like this: "SubClasses" = 'AcDbEntity:AcDb2dPolyline'

After defining the query and closing the properties window of the layer qgis crashes.

A workaround is to create a .vrt by hand that filters the geometry type. This works fine, even with queries:

<OGRVRTDataSource>
<OGRVRTLayer name="dxf_lines">
<SrcDataSource relativeToVRT="1">T34834D01-01-R0.dxf</SrcDataSource>
<GeometryType>wkbLineString</GeometryType>
<LayerSRS>EPSG:27493</LayerSRS>
<SrcSQL>SELECT * FROM entities WHERE OGR_GEOMETRY='LINESTRING'</SrcSQL>
</OGRVRTLayer>
</OGRVRTDataSource>

T34834D01-02-R0.dxf (2.43 MB) Duarte Carreira, 2013-03-26 10:39 AM

History

#1 Updated by Giovanni Manghi almost 12 years ago

  • Category set to Vectors
  • Priority changed from Normal to High
  • Operating System deleted (Windows)
  • OS version deleted (7)

it affects also 1.8. On Linux the terminal message is just

Segmentation fault

#2 Updated by Giovanni Manghi over 11 years ago

  • Status changed from Open to Feedback

QGIS master seems not to crash under Linux, at least.

The error message is anyway not very comforting... just a

"Could not draw entities because:"

and nothing more.

Still crashes on Windows?

#3 Updated by Alessandro Ciali over 11 years ago

I made some test on win7 64bit (master 576102b).
I loaded a dxf with polylines and hatches.
I made the following queries on "Entities" layer:
"SubClasses" = 'AcDbEntity:AcDbHatch'
"SubClasses" = 'AcDbEntity:AcDbPolyline'
It seems to work for me, Qgis draws correctly polyline and polygons after closing the properties menu.
I tried to save and reopen the project too, no errors occurred.

I suggest it could depend on dxf: attemping to open T34834D01-02-R0.dxf with autocad LT 2009 produced the following error:
"Unknown value "AC1027" encountered in drawing version.
Invalid or incomplete DXF input -- drawing discarded."

#4 Updated by Giovanni Manghi over 11 years ago

  • Subject changed from Load dxf and apply query crashes qgis to Load dxf and apply query does not work
  • Crashes QGIS or corrupts data changed from Yes to No

I suggest it could depend on dxf: attemping to open T34834D01-02-R0.dxf with autocad LT 2009 produced the following error:
"Unknown value "AC1027" encountered in drawing version.
Invalid or incomplete DXF input -- drawing discarded."

But it opens ok with DWG TrueView 2014 and Librecad (2 beta).

Anyway doing the filter does not crash qgis anymore, so the subject of this ticket should be changed.

#5 Updated by Alessandro Ciali over 11 years ago

Maybe the DWG is saved in a new version and QGIS could not read it (as Autocad LT 2009)? Have uyo tried to save the dxf in an older version? (2004 for example?)

#6 Updated by Giovanni Manghi over 11 years ago

This should be fixed on master, someone can test?

#7 Updated by Giovanni Manghi over 11 years ago

  • Priority changed from High to Normal

#8 Updated by Duarte Carreira over 11 years ago

Works fantastic!!

#9 Updated by Giovanni Manghi over 11 years ago

  • Resolution set to fixed
  • Status changed from Feedback to Closed

Also available in: Atom PDF