AddSolid Method (ActiveX)

Creates a 2D solid polygon.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddSolid(Point1, Point2, Point3, Point4)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first point.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the second point.

Point3

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the third point.

Point4

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the fourth point.

Return Value (RetVal)

Type: Solid

The newly created polygon.

Remarks

The first two points define one edge of the polygon. The third point is defined diagonally opposite from the second. If the fourth point is set equal to the third point, then a filled triangle is created.

Solids are filled only when the AutoCAD FILLMODE system variable is set to On. To set or query a system variable, use the SetVariable and GetVariable methods, respectively.

Examples

VBA:

Sub Example_AddSolid()
    ' This example creates a solid in model space.
    
    Dim solidObj As AcadSolid
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim point3(0 To 2) As Double
    Dim point4(0 To 2) As Double
    
    ' Define the solid
    point1(0) = 0#: point1(1) = 1#: point1(2) = 0#
    point2(0) = 5#: point2(1) = 1#: point2(2) = 0#
    point3(0) = 4#: point3(1) = 6#: point3(2) = 0#
    point4(0) = 8#: point4(1) = 8#: point4(2) = 0#

    ' Create the solid object in model space
    Set solidObj = ThisDrawing.ModelSpace.AddSolid(point1, point2, point3, point4)
    ZoomAll
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddSolid()
    ;; This example creates a solid in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the solid
    (setq point1 (vlax-3d-point 0 1 0)
          point2 (vlax-3d-point 5 1 0)
          point3 (vlax-3d-point 4 6 0)
          point4 (vlax-3d-point 8 8 0))

    ;; Create the solid object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq solidObj (vla-AddSolid modelSpace point1 point2 point3 point4))
    (vla-ZoomAll acadObj)
)