AddEllipse Method (ActiveX)

Creates an ellipse in the XY plane of the WCS given the center point, a point on the major axis, and the radius ratio.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddEllipse(Center, MajorAxis, RadiusRatio)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center of the ellipse.

MajorAxis

Access: Input-only

Type: Variant (double)

A positive value defining the length of the major axis of the ellipse.

RadiusRatio

Access: Input-only

Type: Double

A positive value defining the major to minor axis ratio of an ellipse. A radius ratio of 1.0 defines a circle.

Radius ratio = 0.25



Radius ratio = 0.75

Return Value (RetVal)

Type: Ellipse

The newly created Ellipse object.

Remarks

The ellipse may be closed, or open (elliptical arc), and is created on the XY plane of the current WCS.

This object represents a true ellipse, not a polyline approximation.



Examples

VBA:

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

Visual LISP:

(vl-load-com)
(defun c:Example_AddEllipse()
    ;; This example creates an ellipse in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    ;; Create the ellipse in mode space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))
    (vla-ZoomAll acadObj)
)