I was going to go further in depth but Lee has it covered.
http://www.lee-mac.com/quote.html
Many thanks for the link Ron
So it reads 'ENAME as ENAME not a (setq variable) assigned to ENAME
Yes, by quoting the symbol
ENAME, it is interpreted as a symbol, rather than evaluated to yield any value it may hold.
ENAME is a datatype retrieved by the (type function) the 'ENAME is so AutoLisp sees this as a symbol and not a variable.
Yes, the
type function returns a symbol which is then compared with the symbol
ENAME to test for equality.
I see LeeMac's explanation of the bounding box: can you help me understand 'P1 and 'P2 and how they supply the (setq P1) and (setq P2) with a list? Because the "vlax-safearray->list P1" the P1 does not follow up with 'P1, I am a little lost in how it knows to use 'P1 in P1.
The symbols supplied to the
getboundingbox method are the symbols that will hold the output data generated by this method; such symbols are quoted to ensure that the symbol itself is passed to the method, and not evaluated to yield any value that the symbol may already hold.
Following evaluation of the
getboundingbox method, the output symbols may be viewed simply as additional local variables, which could have been defined using a simple
setq expression. Therefore, when passed to the
vlax-safearray->list function, the symbols are supplied unquoted so that they are evaluated to yield the values they point to.
As an aside, you can define your own functions which will accept quoted symbols in the same manner as the
getboundingbox method, e.g.:
(defun foo ( var1 var2 var3 )
(set var1 123)
(set var2 "abc")
(set var3 '(1.0 2.0 3.0))
nil
)
_$ (foo 'a 'b 'c)
nil
_$ a
123
_$ b
"abc"
_$ c
(1.0 2.0 3.0)
I plan to add this extra information to the tutorial at some point.
I hope this explanation is clear.
Lee