# DXF: Cannot import hatches with boundaries that contain elliptical arcs

Reported by: Owned by: Alan Thomas warmerdam normal OGR_SF unspecified normal dxf

### Description

The importation of hatch entities with elliptical arcs in their boundaries is completely broken:

• The ratio of minor axis to major axis is incorrectly interpreted by OGR as a percentage between 0 and 100, where it is actually a ratio between 0 and 1.
• In AutoCAD, "start angle" and "end angle" refer to circular angles. OGR is incorrectly interpreting these values as elliptical angles, or parameters.

Given the common code, it's possible that the DWG format also has these issues (although I haven't tested that).

The specification (http://images.autodesk.com/adsk/files/autocad_2014_pdf_dxf_reference_enu.pdf, PDF page 111, numbered 103 in document) is admittedly vague, but the problems are obvious when you export a DXF from AutoCAD and try reading it into OGR.

### Changed 17 months ago by Alan Thomas

Screenshot of the example DXF file

### Changed 17 months ago by Alan Thomas

Sample DXF file with elliptical arc on hatch boundary

Patch

### comment:1 Changed 17 months ago by Even Rouault

@atlight What is the rationale for the "180.0 * floor ( ( dfStartAngle + 90 ) / 180 )" term in the formula that converts from circular to elliptical angles ?

### comment:2 Changed 16 months ago by Alan Thomas

@Even: This part of the formula:

atan( ( 1.0 / dfRatio ) * tan( dfEndAngle * M_PI / 180 ) )

always returns an angle between -90 and 90 degrees. The term

180.0 * floor ( ( dfStartAngle + 90 ) / 180 )

returns a multiple of 180, which is added on in order to give the correct result.

If you know a clearer formula to convert circular to elliptical angles, please feel free to substitute that :)

### comment:3 Changed 16 months ago by Even Rouault

Resolution: → fixed new → closed

In 39826:

DXF: fix reading of hatches with boundaries that contain elliptical arcs (patch by atlight, fixes #6971)

Note: See TracTickets for help on using tickets.