TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: dussla on September 11, 2010, 12:55:05 AM

Title: set or get variables in register
Post by: dussla on September 11, 2010, 12:55:05 AM
hi
firends
i excute   2 cad app  in common.
i would like to save first cad app variable .
and i would like to use  that variable in second cad app.
so i use register
how can i do that ?

good day , good luck   all friends


Title: Re: set or get variables in register
Post by: danallen on September 11, 2010, 01:11:01 AM
try this, it does save in registry:
Command: (setenv "yourvar" "test")
"test"

Command: (getenv "yourvar")
"test"
Title: Re: set or get variables in register
Post by: roy_043 on September 11, 2010, 05:12:57 AM
Setenv works fine but can only handle strings. Using vl-registry-read and vl-registry-write you can also write numbers and you have more control over the registry structure.

Of course if your apps only have to communicate within the same drawing you can just set a global variable. If you want them to communicate between drawings but in the same Acad session you can use vl-bb-ref and vl-bb-set.
Title: Re: set or get variables in register
Post by: It's Alive! on September 11, 2010, 07:42:55 AM
I use this http://www.theswamp.org/index.php?topic=28286.0 I hate the registry  :-)
Title: Re: set or get variables in register
Post by: TimSpangler on September 11, 2010, 07:56:21 PM
Setenv works fine but can only handle strings. Using vl-registry-read and vl-registry-write you can also write numbers and you have more control over the registry structure.

Of course if your apps only have to communicate within the same drawing you can just set a global variable. If you want them to communicate between drawings but in the same Acad session you can use vl-bb-ref and vl-bb-set.

There are functions to handle the conversion.  Don't think of this as a deterrent   ;-)
Title: Re: set or get variables in register
Post by: dussla on September 12, 2010, 02:30:02 AM
thank you good answer~