.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DXF ellipse

4 REPLIES 4
Reply
Message 1 of 5
Moouunwalker
1920 Views, 4 Replies

DXF ellipse

Hi! I have a problem with dxf ellipse ( elliptical arc). I' ve taken the data but can't get correct start angle and end angle. These angles in dxf file are in radians, I convert them to degrees but they aren't correct if I rotate the ellipse. They are also incorrect then end paramater and maybe start parameter is > 2 Pi. There is a formula: p(u)=(Cx+a*cos(u))*i+(Cy+b*sin(u))*j but I couldn' t use it because I get incorrect results. I found a similar problem on this forum but that problem isn't solved. Please help me because I can't solve it for couple of days. Thanks. Here is code from my dxf file:

AcDbEllipse
10
4.515941105878361
20
1.260919452265277
30
0.0
11
0.2648636274097313
21
0.9206522013610863
31
0.0
210
0.0
220
0.0
230
0.9999999999999998
40
0.2244275091508654
41
2.520468679514136
42
7.16461989826817
0
ENDSEC
0
4 REPLIES 4
Message 2 of 5
BillZndl
in reply to: Moouunwalker

In .net,
you don't need any stinking formulas. :^)

You do however, have to take into account, any angle of "tilt" in your axis, from 0.

Bill
Message 3 of 5
_gile
in reply to: Moouunwalker

Hi,

I'm going to try an explaination with the ellipse you gave the DXF datas.

The ellipse parameters angles are measured about the 'X axis of the ellipse'.
This axis is given by the vector 0.2648636274097313, 0.9206522013610863, 0.0 (DXF codes 11, 21, 31) from the ellipse center.

StartParameter and EndParameter are different from StartAngle and EndAngle:
tan(StartAngle) = tan(StartParameter) * ratio
Where ratio = minor axis / major axis (DXF code 40 i.e. 0.2244275091508654)

Graphicaly (see attached), you can draw the parameters by drawing two circles concentric with the ellipse with radius equals to minor and major radius. The start parameter is given by the projection of the strat point on the major circle parallely to minor axis and the projection of the start point on the minor circle parallely to major axis.

On the attached picture, you can see the start parameter (2.5205) and the end parameter (0.8814). The DXF data for the end parameter is greater than 2 pi because, starting from the ellipse axis and going counter clockwise the angle is 2 pi + 0.8814 = 7.16461989826817


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 4 of 5
_gile
in reply to: Moouunwalker

And what about:

Autodesk.AutoCAD.DatabaseServices.Ellipse.GetAngleAtParameter(param)


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 5
BillZndl
in reply to: Moouunwalker

I posted what I did because of this:

Autodesk.AutoCAD.DatabaseServices

Ellipse el = new Ellipse(cenRes.Value, Normal, MajAx.Value.GetVectorTo(cenRes.Value), RadRat, StAng, EnAng);

There is no place for parameters at all.
You can feed the angles from the screen GetAngle picks directly to construct the ellipse.

The only way I can see that you would need the parameters is if you were constructing "Ghost lines" for the ellipse.

Bill

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost