Ellipse End Point As Dxf File
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can anybody help?
I am trying to get the start and end point of an elliptical arc to be the same as an AutoCAD dxf file.
I am using the following code.....
Case kSketchEllipseObject, kSketchEllipticalArcObject
CentreX = sketchEnt.CenterSketchPoint.Geometry.x * 10
CentreY = sketchEnt.CenterSketchPoint.Geometry.y * 10
X1 = sketchEnt.MajorAxisVector.x * 10
Y1 = sketchEnt.MajorAxisVector.y * 10
MajorRadius = sketchEnt.MajorRadius * 10
MinorRadius = sketchEnt.MinorRadius * 10
AxisRatio = MinorRadius / MajorRadius
EllipseAngle = Atn(Y1 / X1) * Rad
X1 = 0 - (MajorRadius * Cos(EllipseAngle * Pi / 180))
Y1 = 0 - (MajorRadius * Sin(EllipseAngle * Pi / 180))
Select Case sketchEnt.Type
Case kSketchEllipseObject
aStart = 0
aEnd = 2 * Pi
Case kSketchEllipticalArcObject
Angle = sketchEnt.StartAngle
aStart = Atn(Sin(Angle) / (AxisRatio * Cos(Angle)))
If aStart > (Angle + Pi) Then aStart = aStart - (2 * Pi)
If aStart < (Angle - Pi) Then aStart = aStart + (2 * Pi)
Angle = Angle + sketchEnt.SweepAngle
aEnd = Atn(Sin(Angle) / (AxisRatio * Cos(Angle)))
If aEnd > (Angle + Pi) Then aEnd = aEnd - (2 * Pi)
If aEnd < (Angle - Pi) Then aEnd = aEnd + (2 * Pi)
End Select
I can get the start point OK but I am having problems with the end point.
Does anybody know what I am doing wrong?