Elliptical Arc

Discussion in 'AutoCAD' started by lara, May 4, 2004.

  1. lara

    lara Guest

    I need to create Elliptical Arc/Ellipse using VBA, can anyone help please
     
    lara, May 4, 2004
    #1
  2. Nathan Taylor, May 5, 2004
    #2
  3. lara

    lara Guest

    Thanks, i need to draw an elliptical arc, given Start angle, End angle, center point and Upper Right X & Y, Lower Left X & Y points.
     
    lara, May 5, 2004
    #3
  4. The help file is a terrible thing to waste:

    Sub Example_AddEllipse()
    ' This example creates an ellipse in model space.

    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis,
    radRatio)
    ZoomAll

    End Sub

    *IF* you have other data such as start/end angles, you'll need to
    transform/translate that info using basic geometry into the object's
    requirements.
     
    Mike Tuersley, May 5, 2004
    #4
  5. lara

    lara Guest

    Thanks a lot Mike. I did use the start angle and end angle and get the elliptical arc... after loosing my sleep over it for 2 days... and the Help is a waste of time.

    revision of your program:

    Sub Example_AddEllipse()
    ' This example creates an ellipse in model space.

    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    Dim StartAng as Double
    Dim EndAng as Double

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#

    'I think we need to modify this if the major axis is not X axis
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis,
    radRatio)
    'My data required the following as the EndAng was the Included Angle, not necessarily applicable for all data
    If (StartAng + EndAng) > 360 Then
    EndAng = (StartAng + EndAng) - 360
    Else
    EndAng = (StartAng + EndAng)
    Endif

    'Convert degrees to radians
    ellObj.Startangle = StartAng * (3.14 / 180)
    ellObj.EndAngle= EndAng * (3.14 / 180)
    ellObj.Update
    ZoomAll

    End Sub
     
    lara, May 6, 2004
    #5
  6. Glad you got it! But, you missed the point - it wasn't my program, it was
    directly out of the help file :)
     
    Mike Tuersley, May 6, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.