Area Property (ActiveX)

Specifies the enclosed area of an arc, circle, ellipse, hatch, lightweight polyline, polyline, region, or planar-closed spline.

Supported platforms: Windows only

Signature

VBA:

object.Area
object

Type: Arc, Circle, Ellipse, Hatch, LWPolyline, Polyline, Region, Spline

The objects this property applies to.

Property Value

Read-only: No, for Circle objects; Yes, for all other objects

Type: Double

The area of the object specified in square drawing units.

Remarks

Hatch objects:

The total area of the combined areas for the fill.

Wide polylines:

The area is defined by the center of the width.

Regions:

The area equals the combined area for all the objects in the region.

Open objects such as arcs, spline curves, and open polylines:

The area is computed as though a straight line connects the start point and endpoint.





Examples

VBA:

Sub Example_Area()
    ' This example creates a polyline object and
    ' then uses the area property to find the
    ' area of that polyline.
    
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    Dim plineArea As Double

    ' Establish the points for the Polyline
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    
    ' Create the polyline in model space
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    
    ' Close the polyline and update display of it
    plineObj.Closed = True
    plineObj.Update
    ZoomAll
    
    ' Get the area of the polyline
    plineArea = plineObj.Area
    
    MsgBox "The area of the new Polyline is: " & plineArea, vbInformation, "Area Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Area()
    ;; This example creates a polyline object and
    ;; then uses the area property to find the
    ;; area of that polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))  

    ;; Establish the points for the Polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
				  9 2
				  3 5
				 )
    )
    
    ;; Create the polyline in model space
    (setq modelSpace (vla-get-ModelSpace doc))  
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    
    ;; Close the polyline and update display of it
    (vla-put-Closed plineObj :vlax-true)
    (vla-Update plineObj)
    (vla-ZoomAll acadObj)
    
    ;; Get the area of the polyline
    (setq plineArea (vla-get-Area plineObj))
    
    (alert (strcat "The area of the new Polyline is: " (rtos plineArea 2)))
)