[Qgis-user] 3D dxf files

Siki Zoltan siki at agt.bme.hu
Thu Dec 12 11:57:17 PST 2013


Dear Matt,

I've written an awk script to convert 3DFACE-s form dxf to a delimited 
text file. Please find attached.
If you use Linux, start it in the shell like:
gawk -f 3dface2csv.awk Otway_Basin_Granites-gravity.dxf > result.csv

You can load the result.csv into QGIS az a delimited text layer with WKT 
column.

Regards,
Zoltan

On Wed, 11 Dec 2013, Siki Zoltan wrote:

> Dear Matt,
>
> I've tested your dxf files in QGIS 2.0
> Otway_Basin_curves.dxf loaded successfully (2D polylines)
> Otway_Basin_Faults-basin.dxf not loaded, 3D faces are not suported by GDAL 
> DXF driver
> Otway_Basin_Faults-shallow.dxf not loaded 3D faces
> Otway_Basin_Granites-magnetics.dxf not loaded 3D faces
> Otway_Basin_Granites-gravity.dxf not loaded 3D faces
>
> You should find another way to import 3D faces from a dxf file.
>
> Regards,
> Zoltan
>
> On Wed, 11 Dec 2013, Matt Boyd wrote:
>
>> I'll give ogr2ogr a shot.
>> woops, sorry wrong link I meant this one
>> http://er-info.dpi.vic.gov.au/cgi-bin/download.pl?ID=3D_models/t009_OtwayBasin_3D_dxf.zip
>> 
>> 
>> 
>> On Tue, Dec 10, 2013 at 6:02 PM, Siki Zoltan <siki at agt.bme.hu> wrote:
>> 
>>> Dear Matt,
>>> 
>>> which version did you try?
>>> What type of entites your dxf file(s) contains? Are them supported by ogr
>>> DXF driver? Check http://www.gdal.org/ogr/drv_dxf.html
>>> Try to check entities with ogrinfo.
>>> I had trouble with 1.8 (exspecially on Windows) to load dxf.
>>> I used ogr2ogr instead QGIS, because you can set more options.
>>> 
>>> I cannot find any DXf file in the zip file you specify.
>>> 
>>> Best regards,
>>> Zoltan
>>> 
>>> 
>>> On Tue, 10 Dec 2013, Matt Boyd wrote:
>>>
>>>  Hi group,
>>>> I'm trying to make sense of some DXF files.
>>>> these ones in particular
>>>> http://er-info.dpi.vic.gov.au/cgi-bin/download.pl?ID=3D_
>>>> models/3D_model_attributes.zip
>>>> there's also a 3D pdf model here..
>>>> http://er-info.dpi.vic.gov.au/cgi-bin/download.pl?ID=3D_
>>>> models/t009_OtwayBasin_3D.pdf
>>>> 
>>>> QGIS isn't able to open the dxf files, or it does but all I see is an 
>>>> icon
>>>> called "entities" with no attributes. Ideally I'd be able to load these 
>>>> as
>>>> rasters and make a few maps.
>>>> 
>>>> Any ideas?
>>>> 
>>>> thanks
>>>> matt
>>>> 
>>>> 
>> 
>
-------------- next part --------------
BEGIN { entity = ""; i = 0;
		printf "id;layer;wkt\n";
}
/ENTITIES/,/EOF/ { if ($0 ~ "^ *0$") {
	if (entity == "3DFACE") {
		i++;
		printf "%d;\"%s\";", i, layer;
		printf "POLYGON ((%f %f %f, %f %f %f, %f %f %f, %f %f %f))\n", x1, y1, z1, x2, y2, z2, x3, y3, z3, x1, y1, z1;
		entity = "";
	}
}
	if (last ~ "^ *0$") { entity = $1; }
	if (last ~ "^ *8$") { layer = $1; }
	if (last ~ "^ *10$") { x1 = $1; }
	if (last ~ "^ *11$") { x2 = $1; }
	if (last ~ "^ *12$") { x3 = $1; }
	if (last ~ "^ *13$") { x4 = $1; }
	if (last ~ "^ *20$") { y1 = $1; }
	if (last ~ "^ *21$") { y2 = $1; }
	if (last ~ "^ *22$") { y3 = $1; }
	if (last ~ "^ *23$") { y4 = $1; }
	if (last ~ "^ *30$") { z1 = $1; }
	if (last ~ "^ *31$") { z2 = $1; }
	if (last ~ "^ *32$") { z3 = $1; }
	if (last ~ "^ *33$") { z4 = $1; }
	last = $0;
}


More information about the Qgis-user mailing list