Basicaly
if one layer is in both states (frozen) and (locked), lets say layer 0 is Frozen and Locked, the list "lst" will contain layer "0" twice, one instance being frozen, and one instance being locked.
so as "lst" is being passed to the (foreach)function, Layer 0 will pass thru the (foreach) function twice, once to restore the frozen layer and once to restore the locked layer.
Is this correct??? (fingers crossed, that I am right)
Thanks Alan
Alan
(setq lst (cons (list x 'Freeze :vlax-true) lst))
How does (lst) get the property (‘Freeze) from (x) as each layer passes thru (x) without the (vlax-get-property) function? Alan
Sorry for the bother but I really do want to understand my question above.
Thanks I freeze the layer in the next line of code. The lst variable is just so I can later apply vlax-put-property to each sublist.
eg.
(foreach x lst (apply (function vlax-put-property) x)) Thanks for the reply Alan
Sorry, I don't think I am asking my question correctly.
(setq lst (cons (list x 'Lock :vlax-true) lst))
Where did 'Lock come from?or
(setq lst (cons (list x 'Freeze :vlax-true) lst))
Where did "Freeze come from?
It looks to me you are making a list using some sort of get property technique.
(setq lst (vlax-get-property Freeze 'ActiveLayer)) 'Lock and 'Freeze are symbol arguments for the vlax-put-property function (hence why they are quoted).
Alan could have alternatively used:
(setq lst (cons (list x "Lock" :vlax-true) lst))Following the vlax-for loop through the layer collection, the list 'lst' might look something like:
((# 'Lock :vlax-true) ... )# being a VLA Layer Object. Each sublist is a list of arguments for the vlax-put-property function.
Then, in the foreach loop at the end of the program, these sublists are supplied as arguments to the apply function:
(apply 'vlax-put-property '( 'Lock :vlax-true))Which is equivalent to:
(vlax-put-property'Lock :vlax-true) LoL
Well, there you go. Sorry for jumping in Alan Oh, no worries. I was just laughing at it. Step in an explain my work anytime. I think I understand.
(vlax-for x (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) ;this gets me to the layer properties
(and (eq (vla-get-lock x) :vlax-true) ;this get me the lock variable
(setq lst (cons (list x 'Lock :vlax-true) lst)) ;this creates the list of locked layers
(vla-put-freeze x :vlax-false) ;goes thru the vlax-for turning all frozen layers to thawed
So, I am going to ask a silly question, 'Freeze and 'Lock are the properties of Layer, 'Freeze and 'Lock are arguments not symbols so I could not use any arbitrary word such as 'Snow, for example.
Why are they quoted? I have been wondering how and when to know to use 'quote and what do they mean. I have seen it in (mapcar) and (lambda)
from help menu:
(mapcar'(lambda (x) (+ x 3) ) '(10 20 30))
'quoted lists and 'quoted function and 'quoted arguments (this I don't understand)
Anyway guys, thanks for the education
页:
1
[2]