TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mkweaver on December 08, 2011, 03:18:50 PM
-
I have a global variable that needs to be consistent through all drawings open in the session and may be changed by any one/or more of those drawings.
vl-propagate:
has to be set each time the value changes
makes the value easily available in all drawings in the session
will stomp on replace the value for that variable in all drawings
vl-bb-ref:
has to be set each time the value changes
retrieval is more involved than vl-propagate
does not affect value variables in other drawings until handled by the code running in those drawings.
Are there any other pros and cons with using these two approaches?
Mike
-
vl-bb-set / ret:
• faster (vl-propogate's speed a function of how many open docs)
• having said that, speed difference likely of zero consequence
• clear intention
• dealing with one variable instance
-
I see you're back from Starbucks. :-P
-
Still not enough for that other thread. (http://www.theswamp.org/screens/mp/blush.gif)
-
Still not enough for that other thread. (http://www.theswamp.org/screens/mp/blush.gif)
LoL
Well, my post was a complete shot in the dark.
-
I recall that vl-propogate doesn't have access to the blackboard until after s::startup finishes, which makes it useless for loading variables to be used in s::startup or earlier routines when a drawing opens. But that should be confirmed.
-
I recall that vl-propogate doesn't have access to the blackboard until after s::startup finishes, which makes it useless for loading variables to be used in s::startup or earlier routines when a drawing opens. But that should be confirmed.
My variables won't be set during s::startup, but that would be a show stopper.
I think I'm going to go with vl-bb-set/ref. I like minimize the use of global variables and vl-bb-set/ref seems the best way to do that.
Thanks,
Mike
-
I recall that vl-propogate doesn't have access to the blackboard until after s::startup finishes, which makes it useless for loading variables to be used in s::startup or earlier routines when a drawing opens.
Thank for the confirmation. I am setting a variable in "acad.lsp", using (vl-propagate) to make sure the variable is the same in all future drawings, but it apparently does not happen until (like you say) - too late to be used in "acaddoc.lsp".