CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2019 开发者帮助

Freeze 属性 (ActiveX)

2024-5-18 17:52| 发布者: admin| 查看: 53| 评论: 0|原作者: admin|来自: AutoCAD

Freeze 属性 (ActiveX)

指定图层的冻结状态。

支持的平台:仅限 Windows

签名

VBA:

object.Freeze
对象

类型:图层

此属性应用于的对象。

属性值

只读:

类型:布尔

  • True:冻结图层。
  • False:解冻图层。

言论

冻结层使它们不可见,并将它们排除在再生和绘图之外。解冻图层可实现这些功能。关闭或冻结图层上的 AutoCAD 曲面和圆是不可见的,但在使用 HIDE、SHADEMODE 或 RENDER 命令时,它们仍会隐藏对象。

不能冻结活动图层,也不能使冻结图层处于活动状态。

此属性与属性不同,因为在再生期间不会生成冻结图层。LayerOn

例子

VBA:

Sub Example_Freeze()
    ' This example creates a new layer called "Freeze".
    ' It then displays the status of the Freeze property
    ' for the new layer, toggles the status of the
    ' Freeze property, and again displays its status.
    ' After running this example, you can check the layer
    ' control on the Object Properties tool bar. It will
    ' show the new layer and the latest Freeze status.
    
    Dim layerObj As AcadLayer
    
    ' Create the new layer
    Set layerObj = ThisDrawing.Layers.Add("Freeze")
    
    ' Display the Freeze status of the new layer
    GoSub DISPLAYSTATUS
    
    ' Toggle the status of the Freeze property for the layer
    layerObj.Freeze = Not (layerObj.Freeze)
    
    ' Display the Freeze status of the new layer
    GoSub DISPLAYSTATUS
    Exit Sub
    
DISPLAYSTATUS:
    If layerObj.Freeze Then
        MsgBox "Layer " & layerObj.name & " is frozen.", , "Freeze Example"
    Else
        MsgBox "Layer " & layerObj.name & " is thawed.", , "Freeze Example"
    End If
    Return
        
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_Freeze()
    ;; This example creates a new layer called "Freeze".
    ;; It then displays the status of the Freeze property
    ;; for the new layer, toggles the status of the
    ;; Freeze property, and again displays its status.
    ;; After running this example, you can check the layer
    ;; control on the Object Properties tool bar. It will
    ;; show the new layer and the latest Freeze status.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    ;; Create the new layer
    (setq layerObj (vla-Add (vla-get-Layers doc) "Freeze"))
    
    ;; Display the Freeze status of the new layer
    (if (= (vla-get-Freeze layerObj) :vlax-true)
        (alert (strcat "Layer " (vla-get-Name layerObj) " is frozen."))
        (alert (strcat "Layer " (vla-get-Name layerObj) " is thawed."))
    )
    
    ;; Toggle the status of the Freeze property for the layer
    (vla-put-Freeze layerObj (if (= (vla-get-Freeze layerObj) :vlax-true) :vlax-false :vlax-true))
    
    ;; Display the Freeze status of the new layer
    (if (= (vla-get-Freeze layerObj) :vlax-true)
        (alert (strcat "Layer " (vla-get-Name layerObj) " is frozen."))
        (alert (strcat "Layer " (vla-get-Name layerObj) " is thawed."))
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-12-15 11:32

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部