Results 1 to 4 of 4

Thread: A Ellipse

  1. #1
    100 Club
    Join Date
    2004-08
    Location
    Beaverton, Or.
    Posts
    132
    Login to Give a bone
    0

    Default A Ellipse

    I am tring to get vba to draw a ellipse that is horizontal.

    I am using "Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)"
    straight from the autodesk help file.

    I am the providing the xy for the center (18,46.3333,0) and majAxis (33, 46.3333,0) and a radRatio of 0.25 (the same Y coord. for both), but it keeps drawing a ellipse that is rotated.

  2. #2
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: A Ellipse

    Keep in mind that major axis is a vector,
    therefore if you want to draw an ellipse as
    horizontal oriented then Y coordinates must
    be equal to zero:

    Code:
    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
    Sub DrawHorizontalEllipse()
    
        Dim oEllipse As AcadEllipse
        Dim mAxis(0 To 2) As Double
        Dim cenPt(0 To 2) As Double
        Dim dblRatio As Double
        
        ' add an ellipse in the Model
        cenPt(0) = 18#: cenPt(1) = 46.3333: cenPt(2) = 0#
        mAxis(0) = 16.5: mAxis(1) = 0#: mAxis(2) = 0# '<--where 16.5 is half of the major axis
        dblRatio = 0.25
        Set oEllipse = ThisDrawing.ModelSpace.AddEllipse(cenPt, mAxis, dblRatio)
    
    End Sub
    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
    Sub DrawVerticalEllipse()
    
        Dim oEllipse As AcadEllipse
        Dim mAxis(0 To 2) As Double
        Dim cenPt(0 To 2) As Double
        Dim dblRatio As Double
        
        ' add an ellipse in the Model
        cenPt(0) = 18#: cenPt(1) = 46.3333: cenPt(2) = 0#
        mAxis(0) = 0#: mAxis(1) = 16.5: mAxis(2) = 0#     '<--where 16.5 is half of the major axis
        dblRatio = 0.25
        Set oEllipse = ThisDrawing.ModelSpace.AddEllipse(cenPt, mAxis, dblRatio)
    
    End Sub

  3. #3
    100 Club
    Join Date
    2004-08
    Location
    Beaverton, Or.
    Posts
    132
    Login to Give a bone
    0

    Default Re: A Ellipse

    Thank You, I really appreciate your help.

  4. #4
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: A Ellipse

    Glad that helps
    Youre welcome

Similar Threads

  1. Ellipse 3d -> 2d
    By clovis in forum AutoLISP
    Replies: 12
    Last Post: 2011-03-18, 10:19 AM
  2. Ellipse - Offseted as Ellipse, not as a spline.
    By harilalmn in forum VBA/COM Interop
    Replies: 1
    Last Post: 2009-06-09, 03:34 PM
  3. Ellipse
    By cganiere in forum Revit Architecture - General
    Replies: 4
    Last Post: 2008-08-12, 12:12 AM
  4. Ellipse
    By fabrice in forum VBA/COM Interop
    Replies: 3
    Last Post: 2007-06-20, 03:42 PM
  5. ellipse
    By glen.85659 in forum Revit Architecture - Wish List
    Replies: 3
    Last Post: 2005-06-25, 03:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •