Determines the visibility of xref-dependent layers and specifies if nested xref path changes are saved.
Supported platforms: Windows only
VBA:
object.XRefLayerVisibility
Type: DatabasePreferences
The object this property applies to.
Read-only: No
Type: Boolean
The initial value of this property is True.
When this property is set to True, layer settings are saved with the current drawing's layer table and persist from session to session. Nested xref path changes are saved with the current drawing and persist from session to session.
When this property is set to False, changes made to xref-dependent layers in the current drawing are valid in the current session only, but are not saved with the drawing. When the current drawing is reopened, the layer table is reloaded from the reference drawing and the current drawing reflects those settings. The layer settings affected are: On/Off, Freeze/Thaw, Color, and Linetype. This setting also specifies that changes made to the paths of nested xrefs are for the current session only and are not saved with the drawing.
VBA:
Sub Example_XRefLayerVisibility() ' This example reads and modifies the preference value that controls ' the visibility of xref-dependent layers and specifies if nested xref ' path changes are saved. ' ' When finished, this example resets the preference value back to ' its original value. Dim ACADPref As AcadDatabasePreferences Dim originalValue As Variant, newValue As Variant ' Get the user preferences object Set ACADPref = ThisDrawing.preferences ' Read and display the original value originalValue = ACADPref.XRefLayerVisibility MsgBox "The XRefLayerVisibility preference is set to: " & originalValue ' Modify the XRefLayerVisibility preference by toggling the value ACADPref.XRefLayerVisibility = Not (ACADPref.XRefLayerVisibility) newValue = ACADPref.XRefLayerVisibility MsgBox "The XRefLayerVisibility preference has been set to: " & newValue ' Reset the preference back to its original value ' ' * Note: Comment out this last section to leave the change to ' this preference in effect ACADPref.XRefLayerVisibility = originalValue MsgBox "The XRefLayerVisibility preference was reset back to: " & originalValue End Sub
Visual LISP:
(vl-load-com) (defun c:Example_XRefLayerVisibility() ;; This example reads and modifies the preference value that controls ;; the visibility of xref-dependent layers and specifies if nested xref ;; path changes are saved. ;; ;; When finished, this example resets the preference value back to ;; its original value. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq preferences (vla-get-Preferences doc)) ;; Read and display the original value (setq originalValue (vla-get-XRefLayerVisibility preferences)) (alert (strcat "The XRefLayerVisibility preference is set to: " (if (= originalValue :vlax-true) "True" "False"))) ;; Modify the XRefLayerVisibility preference by toggling the value (vla-put-XRefLayerVisibility preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true)) (alert (strcat "The XRefLayerVisibility preference has been set to: " (if (= (vla-get-XRefLayerVisibility preferences) :vlax-true) "True" "False"))) ;; Reset the preference back to its original value ;; ;; * Note: Comment out this last section to leave the change to ;; this preference in effect (vla-put-XRefLayerVisibility preferences originalValue) (alert (strcat "The XRefLayerVisibility preference was reset back to: " (if (= originalValue :vlax-true) "True" "False"))) )