qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.35k stars 2.98k forks source link

DWG/DXF Import does not work correctly in newer versions (ex: LTR 3.22.6, 3.24.2, 3.24.3) #48637

Open micdeluca opened 2 years ago

micdeluca commented 2 years ago

What is the bug or the crash?

I noticed that in newer versions of QGIS (ex: LTR 3.22.6, 3.24.2, 3.24.3) compiled with GDAL/OGR 3.4.2 the DWG/DXF import is not done correctly (see attached examples). DWG/DWX import still works correctly in old versions with GDAL/OGR 3.4.1 (ex: 3.24.1, 3.22.3). TEST_DXF_Import.zip

Steps to reproduce the issue

Try to import any DWG/DXF file.

Versions

LTR 3.22.6 3.24.2 3.24.3

Supported QGIS version

New profile

Additional context

No response

rouault commented 2 years ago

can you describe precisely what is wrong in newer versions ? I opened your projects and this wasn't obvious to me. I'd note tat the GDAL version is unrelated as ths DWG/DXF functionality doesn't use it, and there was no change in GDAL in the DXF driver between 3.4.1 and 3.4.2

micdeluca commented 2 years ago

You are right, the projects I attached show no significant differences except the appearance of the polylines, point and inserts entities in projects 3.24.2 and 3.22.6 and the non-assignment of the reference system to the texts, points and inserts entities. TEST

It is my mistake not to have reopened the projects after creating them. However, when I created the projects with versions 3.24.2 and 3.22.6, the numbers were not visible, as in the following image.

TEST_QGIS_3 24 2

The numbers "reappeared" after saving, closing and reopening projects.

kadarivan commented 1 year ago

It looks like there is an indexing error in the gpkg loading function. 3.28.6-Firenze - Win10 I made example dwg files with 1-1 elements, and with combinations. The result depends on what elements are in the file:

line: QGIS line polyline: QGIS polyline text: QGIS text hatch: QGIS hatch polyline+line: QGIS polyline+line polyline+text: QGIS polyline+text polyline+line+text: QGIS polyline+line+text QGIS hatch+line: QGIS hatch+line QGIS hatch+text: QGIS hatch+text

Test files (dwg+gpkg+png) QGIS3.28 dwg import test.zip

kadarivan commented 1 year ago

I found some pattern: The order of layers (objects' type) are fix. If the dwg file contains an object of a certain type, QGIS loads all other layers after that.

QGIS always load correctly the first and second layer, but the others are wrong (whether the layer contains an object or not).

she-weeds commented 9 months ago

Any update on this issue? It appears that the only fix right now is to import, save project, close and re-open. It does make writing how-to documentation a bit tedious :-) ....

I have observed the same pattern as @kadarivan even in 3.34.1

edit: If you look at the improperly loaded layers' attribute tables, the row count is correct but no attributes/fields are loaded.

polyline_empty