<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi,</p>
<p>with ezdxf you can do the job. The following snippet shows how it
works:</p>
<p><i>...... <br>
</i></p>
<p><i>#Reading the dxf and get the modelspace<br>
dwg = ezdxf.readfile(filepath)<br>
msp = dwg.modelspace()<br>
<br>
#loop through all Polylines of the DXF<br>
polylines = msp.query('POLYLINE')<br>
for polyline in polylines:</i></p>
<p><i> # for example converts a dxf Polyline to a QgsGeometry
(Polygon)<br>
points = []<br>
for i, location in enumerate(polyline.points()):<br>
points.append(QgsPointXY(location[0],location[1]))<br>
polygon = QgsGeometry.fromPolygonXY([points])</i></p>
<p><i>.....<br>
</i></p>
<p>hope this will be a starting point for you...<br>
</p>
<pre class="moz-signature" cols="72">Mit freundlichen Grüßen
Stefan Giese
Projektleiter/Consultant
---------------------------------------------
Aufwind durch Wissen!
Web-Seminare und Online-Schulungen
bei der <a class="moz-txt-link-abbreviated" href="http://www.foss-academy.com">www.foss-academy.com</a>
---------------------------------------------
WhereGroup GmbH
Schwimmbadstr. 2
79100 Freiburg
Germany
Tel.: +49 (0)761 / 519 102 - 61
Fax: +49 (0)761 / 519 102 - 11
<a class="moz-txt-link-abbreviated" href="mailto:stefan.giese@wheregroup.com">stefan.giese@wheregroup.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.wheregroup.com">www.wheregroup.com</a>
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885</pre>
<p></p>
<div class="moz-cite-prefix">Am 03.10.2023 um 00:47 schrieb Catania,
Luke A ERDC-RDE-GRL-VA CIV via QGIS-Developer:<br>
</div>
<blockquote type="cite"
cite="mid:451a2c04fca84d44980ad3867195859c@erdc.dren.mil">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator"
content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">I have a DXF in both AC1027 and AC1032
format. Original file was a DWG. I converted to DXF using
ODA File Converter. I am trying to load in QGIS and dragging
and dropping or using the Data Source Manager results in a
layer with the name “entities appended to it and nothing shows
up. When looking at the properties there is not much there.
The layer type is a dataset. I am trying to display all the
lines of the dxf.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><img style="width:5.3416in;height:1.1916in"
id="Picture_x0020_3"
src="cid:part1.D0IlY4iE.nXiHNDRa@wheregroup.com" class=""
width="513" height="114"><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><img style="width:7.3416in;height:3.9833in"
id="Picture_x0020_1"
src="cid:part2.0AmOScq3.sN2BNvpL@wheregroup.com" class=""
width="705" height="382"><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><img style="width:9.3916in;height:3.4916in"
id="Picture_x0020_2"
src="cid:part3.8XpPkCa0.x4GXuSWu@wheregroup.com" class=""
width="902" height="335"><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Now I can use the
Project/Import/Export/Import Layers from DWG/DXF to import,
but I am looking to do this programmatically in python and I
am using ezdxf to assist.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Ideas?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
QGIS-Developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
</pre>
</body>
</html>