Closed2 属性 (ActiveX) 
指定样条曲线是打开还是关闭。 支持的平台:仅限 Windows 属性值只读:不 类型:布尔 
 言论闭合样条时,使其两端切连续。如果样条曲线的起点和终点已经相同,则闭合样条曲线可使其在两个点处相切连续。 打开闭合样条曲线时,如果样条曲线的起点和终点在关闭之前相同,则此属性将样条曲线返回到其原始状态。起点和终点保持不变,但失去了切线连续性。 打开闭合样条时,如果样条曲线的起点和终点在闭合之前不相同,则此属性将样条返回到其原始状态并删除切线连续性。 例子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
可视化 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))
)
 | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-5 00:06
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.