Mask 属性 (ActiveX) 
指定要恢复的图层属性。 支持的平台:仅限 Windows 属性值只读:不 类型:枚举AcLayerStateMask 表示要恢复的图层属性的数字。使用下表中的常量来标识图层属性: 
 言论LayerStateManager 方法使用 Mask 属性来标识要还原的图层属性。首先,在使用 LayerStateManager 方法保存图层设置时设置该属性。但是,Save 方法实际上保存了每个绘图图层的所有属性。您可以在恢复图层设置之前随时更新属性,从而更改要恢复的图层属性。RestoreMaskSaveMask 要在蒙版中指定多个图层属性,请添加表示这些属性的常量。例如,若要保存 Color 和 LineType 属性,请指定以下内容: acLsColor + acLsLineType 例子VBA: 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
 
  可视化 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)
)
 
 | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-4 23:30
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.