Closed2 Property (ActiveX)

Specifies whether the spline is open or closed.

Supported platforms: Windows only

Signature

VBA:

object.Closed2
object

Type: Spline

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

Remarks

When you close a spline, you make it tangent-continuous at both ends. If the spline's start point and endpoint are already the same, closing the spline makes it tangent-continuous at both points.

When you open a closed spline, if the spline's start point and endpoint were the same before the close, this property returns the spline to its original state. The start point and endpoint remain the same, but lose their tangent continuity.

When you open a closed spline, if the spline's start point and endpoint were not the same before the close, this property returns the spline to its original state and removes tangent continuity.

Examples

VBA:

Sub Example_Closed()
    ' This example creates a polyline and then toggles the
    ' setting to Closed.
    Dim plineObj As AcadPolyline
    Dim closedState As String

    ' Create the polyline
    Dim points(8) As Double
    points(0) = 3: points(1) = 7: points(2) = 0
    points(3) = 9: points(4) = 2: points(5) = 0
    points(6) = 3: points(7) = 5: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)

    ' Set the closed property to True
    plineObj.Closed = True      ' Close Polyline
    ThisDrawing.Regen (True)
    GoSub DISPLAY

    ' Open the PolyLine by setting the closed property to False
    plineObj.Closed = False      ' Open Polyline
    ThisDrawing.Regen (True)
    GoSub DISPLAY

    Exit Sub

DISPLAY:
    ' Retrieve and display the Closed property
    closedState = IIf(plineObj.Closed, "Closed", "Open")
    MsgBox "The new Polyline is: " & closedState, vbInformation, "Closed Example"
    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Closed()
    ;; This example creates a polyline and then toggles the
    ;; setting to Closed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(3 7 0
				  9 2 0
				  3 5 0
				 )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddPolyline modelSpace points))

    ;; Set the closed property to True
    (vla-put-Closed plineObj :vlax-true)      ;; Close Polyline
    (vla-Regen doc :vlax-true)

    ;; Retrieve and display the Closed property
    (setq closedState (if (= (vla-get-Closed plineObj) :vlax-true) "Closed" "Open"))
    (alert (strcat "The new Polyline is: " closedState))

    ;; Open the PolyLine by setting the closed property to False
    (vla-put-Closed plineObj :vlax-false)      ;; Open Polyline
    (vla-Regen doc :vlax-true)

    ;; Retrieve and display the Closed property
    (setq closedState (if (= (vla-get-Closed plineObj) :vlax-true) "Closed" "Open"))
    (alert (strcat "The new Polyline is: " closedState))
)