@Ajilal.Vijayan wrote:
....
....
(if (and myvar1 myvar2)
....
Also if you need to save these variables for another drawings or even in a new AutoCAD session try setenv and getenv
[A small quibble, perhaps, and I know it's just a generic example, but.... In that situation, if one of those two variables has a value in it but not the other, both will be set to the built-in values, possibly changing the value already in the one variable. If that might be an issue, it's easily avoided with slightly more code, by doing the same for each variable separately instead of together.]
There are countless examples around of the use of global variables for this kind of thing within the same session in the same drawing. For just a couple, see my routine for labeling entities and breaking them around the labels, here, and another similar one that masks instead of breaks the labeled entities. Routines can be written with built-in standard initial-default values similarly to Ajilal.Vijayan's example, or to have no initial defaults, but to always ask the User for a value on first use, to become the default that will be offered on subsequent use.
For some examples of Ajilal.Vijayan's suggested use of environment variables, so that the values are available not only the next time you use the command in the current drawing but in any drawing, and are remembered even after closing and getting back into AutoCAD, I wrote some routines that use that approach to save multiple Fillet radii and multiple Chamfer distances.
[Most of the cited examples are around these Forums somewhere -- it's just easier for me to find them on the Cadalyst CAD Tips site.]
Kent Cooper, AIA