Referencing Variables in Document Namespaces
 
 
 

Variables defined in a separate-namespace VLX are not known to the document namespace associated with the VLX. However, a separate-namespace VLX can access variables defined in a document namespace using the vl-doc-ref and vl-doc-set functions.

The vl-doc-ref function copies the value of a variable from a document namespace. The function requires a single argument, a symbol identifying the variable to be copied. For example, the following function call copies the value of a variable named aruhu:

(vl-doc-ref 'aruhu)

If executed within a document namespace, vl-doc-ref is equivalent to the eval function.

The vl-doc-set function sets the value of a variable in a document namespace. The function requires two arguments: a symbol identifying the variable to be set, and the value to set for the variable. For example, the following function call sets the value of a variable named ulus:

(vl-doc-set 'ulus "Go boldly to noone")

If executed within a document namespace, vl-doc-set is equivalent to the setq function.

To set the value of a variable in all open document namespaces, use the vl-propagate function. For example, the following function calls set a variable named fooyall in all open document namespaces:

(setq fooyall "Go boldly and carry a soft stick")
(vl-propagate 'fooyall)

This command not only copies the value of fooyall into all currently open document namespaces, but also causes fooyall to automatically be copied to the namespace of any new drawings opened during the current AutoCAD session.