Opened 3 years ago

Closed 17 months ago

#5705 closed defect (fixed)

[AutoCAD DXF] Incorrect processing of Ellipses with negative extrusion

Reported by: ju420xt5z Owned by: warmerdam
Priority: normal Milestone: 2.1.0
Component: OGR_SF Version: 1.11.0
Severity: normal Keywords: dxf
Cc:

Description (last modified by ju420xt5z)

I have 2 partial ellipses (i.e. ellipses with start and end angles) inside a DXF (attached file "sampleb_input.dxf"). The ellipses come from a much bigger DXF but the issue can be seen from just this sample. The ellipses are at the correct position when looked at with AutoCAD.

I am running the following command: ogr2ogr -f "DXF" sampleb_output.dxf sampleb_input.dxf

The result I obtain is wrong (attached file "sampleb_output.dxf"), as can be verified in AutoCAD. Basically, one of the ellipses in the output has a wrong angle and its X coordinates are wrong. I would expect the same visual result as the input. The issue can also be seen when converting to a format other than DXF (for example SHP).

Doing some investigation inside the input DXF using a text editor, I saw that the ellipse that converts correctly has a Z extrusion axis value (group code 230) of 1.0, whereas the ellipse that was not converted correctly has a Z extrusion axis value of -1.0. I have then done a test when I reversed its Z extrusion axis (from -1.0 to 1.0) and switched+reversed the start and end angles (group codes 41 and 42) in attached file "sampleb_input-mod.dxf". Then the conversion of the previously incorrect ellipse is done correctly (attached file "sampleb_output-mod.dxf"). Visually, the input and ouput are the same, as well as identical to the original input DXF file.

So it seems that, when the Z direction is -1, on top of having to rotate the points of the ellipse to align with the direction of major axis, the Y axis must also be reversed. Maybe a transformation to the new coordinate system :

Direction of new X axis = endpoint of major axis Direction of new Z axis = extrusion direction Direction of new Y axis = [new Z axis] cross product [new X axis]

(if Z is 1, then no reversion of the Y axis)

And there seems to be no OCS transformation to apply (the default 0,0,1 extrusion axis results in the identity OCS transformation).

Attachments (4)

sampleb_input.dxf (52.0 KB) - added by ju420xt5z 3 years ago.
sampleb_input
sampleb_output.dxf (22.8 KB) - added by ju420xt5z 3 years ago.
sampleb_output
sampleb_input-mod.dxf (52.0 KB) - added by ju420xt5z 3 years ago.
sampleb_input-mod
sampleb_output-mod.dxf (22.8 KB) - added by ju420xt5z 3 years ago.
sampleb_output-mod

Download all attachments as: .zip

Change History (8)

Changed 3 years ago by ju420xt5z

Attachment: sampleb_input.dxf added

sampleb_input

Changed 3 years ago by ju420xt5z

Attachment: sampleb_output.dxf added

sampleb_output

Changed 3 years ago by ju420xt5z

Attachment: sampleb_input-mod.dxf added

sampleb_input-mod

Changed 3 years ago by ju420xt5z

Attachment: sampleb_output-mod.dxf added

sampleb_output-mod

comment:1 Changed 3 years ago by ju420xt5z

Description: modified (diff)

comment:2 Changed 3 years ago by ju420xt5z

Description: modified (diff)
Summary: [AutoCAD DXF] Processing of Ellipses with negative extrusion[AutoCAD DXF] Incorrect processing of Ellipses with negative extrusion

comment:3 Changed 3 years ago by ju420xt5z

Description: modified (diff)

comment:4 Changed 17 months ago by Even Rouault

Component: defaultOGR_SF
Keywords: dxf added
Milestone: 2.1.0
Resolution: fixed
Status: newclosed

trunk r33770 "DXF: fix handling of ELLIPSE with Z extrusion axis = -1 (patch by Pero Brbora, #5705. Test added by myself from ticket sample)"

Note: See TracTickets for help on using tickets.