Mask Property (ActiveX)

Specifies the layer properties to be restored.

Supported platforms: Windows only

Signature

VBA:

object.Mask
object

Type: LayerStateManager

The object this property applies to.

Property Value

Read-only: No

Type: AcLayerStateMask enum

A number representing the layer properties to be restored. Use the constants in the following table to identify layer properties:

Remarks

The LayerStateManager Restore method uses the Mask property to identify which layer properties are to be restored. You first set the Mask property when saving layer settings with the LayerStateManager Save method. However, the Save method actually saves all properties of each drawing layer. You can update the Mask property any time prior to restoring layer settings, thereby changing which layer properties are restored.

To specify multiple layer properties in the Mask, add the constants representing those properties. For example, to save the Color and LineType properties, specify the following:

acLsColor + acLsLineType

Examples

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

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