CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

封闭属性 (ActiveX)

2023-1-3 20:37| 发布者: admin| 查看: 428| 评论: 0|来自: AutoCAD

摘要: 指定 3D 折线、轻量化折线、放样曲面、折线或样条是打开还是闭合。

指定 3D 折线、轻量化折线、放样曲面、折线或样条是打开还是闭合。

支持的平台:仅窗口

签名

工 务 局:

object.Closed
对象

类型:3D椭圆线,放样曲面LW线,折线样条线

此属性适用的对象。

属性值

只读:否(对象除外)Spline

类型:布尔

  • True:对象已关闭。
  • False:对象处于打开状态(默认)。

言论

开放的 3D 折线

闭合的 3D 折线

如果确定放样曲面轮廓的剖面曲线闭合,则放样曲面闭合。例如,如果在放样轮廓中使用圆弧,则生成的曲面是开放的。如果使用闭合曲线(如圆)进行放样,则生成的曲面是闭合的。

例子

工 务 局:

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))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-12 06:31

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部