SDI and MDI
When an application has the ability to open more than one document in a single session, this is known as multiple document interface. When developing an application for a MDI environment, special consideration must be taken, or the application may not function properly or it may interfere with other applications. To prevent applications from affecting one another, Autodesk has developed the concept of NameSpace. A NameSpace is a LISP environment that contains an isolated set of symbols (variables and functions). Each open drawing has it own unique NameSpace. Variables and functions defined in one NameSpace are isolated from variables and functions defined in another. When an AutoLISP application is loaded, the function is only accessible to the drawing where it was loaded. If the application is needed for multiple documents, then its contents can be automatically loaded by either appending the application to the Acaddoc.LSP or by using the VL-VLOAD-ALL function. When an AutoLISP application is compiled into a Visual LISP executable, the developer is given the choice of creating a separate NameSpace for the application. When the developer chooses this option, upon loading the application creates its own NameSpace separate from the NameSpace of the document where that the application was loaded. This guarantees that the variables used in the application will not be accidentally overwritten. Each time a compiled Visual LISP application is loaded in a different document, a new NameSpace is created to maintain the variables and functions associated with that application. When an application is compiled using the separate NameSpace option, by default that application's functions are not exposed to the document where the application is launched. The functions must be exported to the document using the VL-DOC-EXPORT function. To make an application accessible to the document and any other documents where the application is loaded, the VL-DOC-EXPORT function must be used. To determine which applications have defined separate NameSpaces and which of their functions have been exposed to the current document's NameSpace, the VL-LIST-LOADED-VLS and VL-LIST-EXPOSED-FUNCTIONS functions can be used. Once an application has been exposed using the VL-DOC-EXPORT function, its functions can be made available to other applications using the VL-DOC-EXPORT function. Variables contained within applications that define their own NameSpace are not known to the document's NameSpace where the application was loaded. Variables contained within a document's NameSpace may be accessed by a VLX application by using the VL-DOC-REF, VL-DOC-SET or VL-PROPAGATE functions.
The Value of a variable can be transferred from one document's NameSpace to another document's NameSpace using the Visual LISP Blackboard. A blackboard is a NameSpace that is separate from documents and VLX applications. Its purpose is to provide documents with a means of sharing data from one NameSpace to another.
Currently AutoLISP is limited to working with one document at a time. An AutoLISP application cannot issue any entity creation or modification functions in a NameSpace different from the one where the application is currently running.