TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mkweaver on December 08, 2011, 03:18:50 PM

Title: vl-propagate verses vl-bb-ref
Post 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
Title: Re: vl-propagate verses vl-bb-ref
Post by: MP on December 08, 2011, 03:25:45 PM
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
Title: Re: vl-propagate verses vl-bb-ref
Post by: alanjt on December 08, 2011, 03:31:08 PM
I see you're back from Starbucks. :-P
Title: Re: vl-propagate verses vl-bb-ref
Post by: MP on December 08, 2011, 03:46:40 PM
Still not enough for that other thread. (http://www.theswamp.org/screens/mp/blush.gif)
Title: Re: vl-propagate verses vl-bb-ref
Post by: alanjt on December 08, 2011, 03:48:58 PM
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.
Title: Re: vl-propagate verses vl-bb-ref
Post by: danallen on December 08, 2011, 03:56:57 PM
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.
Title: Re: vl-propagate verses vl-bb-ref
Post by: mkweaver on December 08, 2011, 04:03:31 PM
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
Title: Re: vl-propagate verses vl-bb-ref
Post by: rkmcswain on February 16, 2018, 12:46:43 PM
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".