Search code examples
phpexportautocadellipsedxf

Exporting a dxf file with a ellipse in php


for a project we need to export some shapes as a .dxf file using the php DXFwriter (https://github.com/digitalfotografen/DXFwriter) which sadly does not include ellipses. We've used polylines instead by now but with hundreds of single points it was not good for our purpose.

We now wanted to use the ellipse entity but if we just add a ellipse to our entities section AutoCAD is not able to open the .dxf file. Do we have to add some lines to one of the other sections to bring ellipses to work or do you have some other ideas how to solve this problem?

The entities section:

  0
SECTION
  2
ENTITIES
  0
ELLIPSE
  5
262
330
1F
100
AcDbEntity
  8
0
100
AcDbEllipse
 10
1927.933413526791
 20
2355.552659681358
 30
0.0
 11
1694.611795869434
 21
-112.6281645577583
 31
0.0
210
0.0
220
0.0
230
1.0
 40
0.2345744769758316
 41
0.0
 42
6.283185307179586
  0
ENDSEC

Greetings Joe

Solution: In the end we've decided to write our own DXF export library which is able to export valid R13 DXF files. It's open source so if anyone will have similar problems maybe https://github.com/enjoping/DXFighter is something for you.


Solution

  • A DXF file with only an ENTITIES section is considered by AutoCAD to be a R12 format file and cannot contains entity type added after this release, like ELLIPSE and LWPOLYLINE. You cannot omit other sections, because for R13 and newest files, there is an audit step which check if the file is valid.

    From my experiments, it seems to be very difficult to build a valid post R12 DXF file.