Lee, please tell me what benefit of use LM:acdoc funtion in #6 post. Can be simple (vla-get-activedocument (vlax-get-acad-object)) ? . I haven't understand clearly . Thank you
The use of
defun-q will help to explain the difference:
Consider the following functions:
Before function evaluation, the respective function definitions are as follows:
When evaluated, both functions will return the Active Document object:
However, observe the respective function definitions
following function evaluation:
Note that function
f2 now no longer retrieves the Application Object (
vlax-get-acad-object) before retrieving the Active Document Property (
vla-get-activedocument), but simply returns the Active Document object directly. The method is similar to setting a global variable pointing to the Active Document Object.
Of course, for this program, I could have equivalently used a local variable assigned with the Active Document Object, however, such local variable would then be re-assigned this value for every use of the program.