CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

掩码属性 (ActiveX)

2023-1-3 11:22| 发布者: admin| 查看: 553| 评论: 0|来自: AutoCAD

摘要: 指定要恢复的图层属性。

指定要恢复的图层属性。

支持的平台:仅窗口

签名

工 务 局:

object.Mask
对象

类型:层状态管理器

此属性适用的对象。

属性值

只读:

类型:枚举AcLayerStateMask

表示要恢复的图层属性的数字。使用下表中的常量标识图层属性:

  • acLsAll:所有图层属性
  • acLsColor:颜色
  • acLsFrozen:冷冻或解冻
  • acLsLineType:线型
  • acLsLineWeight:线宽
  • acLsLocked:锁定或解锁
  • acLsNewViewport:冻结或解冻的新视口图层
  • acLsNone:没有
  • acLsOn:开或关
  • acLsPlot:打印打开或关闭
  • acLsPlotStyle:绘图风格

言论

方法使用 Mask 属性来标识要还原的图层属性。首先在使用 LayerStateManager 方法保存图层设置时设置该属性。但是,Save 方法实际上保存每个绘图图层的所有属性。您可以在恢复图层设置之前随时更新属性,从而更改要恢复的图层属性。RestoreMaskSaveMask

要在蒙版中指定多个图层属性,请添加表示这些属性的常量。例如,要保存“颜色”和“线型”属性,请指定以下内容:

acLsColor + acLsLineType

例子

工 务 局:

Sub Example_SetMask()
    ' The following code updates the Mask property of layer
    ' settings saved under the name "ColorLineType, so that
    ' Color, LineType, and LineWeight layer properties will
    ' be restored by a Restore operation.
    
    Dim oLSM As AcadLayerStateManager
    Dim settings As AcLayerStateMask
    
    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager." & Left(AcadApplication.Version, 2))
    oLSM.SetDatabase ThisDrawing.Database
    
    oLSM.Save "ColorLinetype", acLsColor + acLsLineType
    
    ' Retrieve the current mask setting from ColorLinetype
    settings = oLSM.Mask("ColorLinetype")
       
    ' Set mask so that Color, LineType, and LineWeight
    ' properties will be restored by a Restore operation
    settings = acLsColor + acLsLineType + acLsLineWeight
         
    ' Commit the new settings mask to ColorLinetype
    oLSM.Mask("ColorLinetype") = settings

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Mask()
    ;; The following code updates the Mask property of layer
    ;; settings saved under the name "ColorLineType, so that
    ;; Color, LineType, and LineWeight layer properties will
    ;; be restored by a Restore operation.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq oLSM (vla-GetInterfaceObject acadObj (strcat "AutoCAD.AcadLayerStateManager." (substr (getvar "ACADVER") 1 2))))

    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))

    ;; Retrieve the current mask setting from ColorLinetype
    (setq settings (vla-get-Mask oLSM "ColorLinetype"))
       
    ;; Set mask so that Color, LineType, and LineWeight
    ;; properties will be restored by a Restore operation
    (setq settings (+ acLsColor acLsLineType acLsLineWeight))
         
    ;; Commit the new settings mask to ColorLinetype
    (vla-put-Mask oLSM "ColorLinetype" settings)

    (vlax-release-object oLSM)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 08:32

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部