Jump to content

create your own system variable?


Recommended Posts

Posted

is it possible?

 

I have a lisp written as a variable for another lisp. The major lisp will insert a block and prompt you to annotate the part. The minor lisp asks if you want to be prompted, if you want to annotate every time or if you do not want to annotate every time. This variable has to be set every time I start a drawing. Is there a way so that I just have to set it once and it's saved for the entire time my sesion is open?

Posted

AutoCAD variables are in two categories those that are saved in the drawing and those that are save to the registry.

In lisp you can create you own registry keys and write information to that key and then retrieve the info.

(vl-registry-write reg-key [val-name val-data])

(vl-registry-read reg-key [val-name])

just another way to do it

Posted

Also may take a look to USERI1-5 (integers), USERR1-5 (reals) and USERS1-5 (strings) system variables.

 

Regards,

Posted
is it possible?

 

I have a lisp written as a variable for another lisp. The major lisp will insert a block and prompt you to annotate the part. The minor lisp asks if you want to be prompted, if you want to annotate every time or if you do not want to annotate every time. This variable has to be set every time I start a drawing. Is there a way so that I just have to set it once and it's saved for the entire time my sesion is open?

 

 

You mean something like:

 

(setenv "varname" "varvalue")

and

(getenv "varname")

 

Variabale value:

 

A string specifying the name of the variable to be read. Environment variable names must be spelled and cased exactly as they are stored in the system registry.

Posted

thanks guys. some great suggestions.

 

Lee Mac, i'll prob set that on my computer as a quick fix but I need something that any user can change back and forth.

 

AutoCAD variables are in two categories those that are saved in the drawing and those that are save to the registry.

In lisp you can create you own registry keys and write information to that key and then retrieve the info.

(vl-registry-write reg-key [val-name val-data])

(vl-registry-read reg-key [val-name])

just another way to do it

 

First off would it be dangerous to try this method seeing as i'm messing witht the registry? and where in the registery would this be stored?

 

Also may take a look to USERI1-5 (integers), USERR1-5 (reals) and USERS1-5 (strings) system variables.

 

Regards,

 

yeah I totally forgot about these. Thanks for bringing it up ;)

 

You mean something like:

 

(setenv "varname" "varvalue")

and

(getenv "varname")

 

Variabale value:

 

A string specifying the name of the variable to be read. Environment variable names must be spelled and cased exactly as they are stored in the system registry.

 

can you create your own? I thought these were all predefined.

Posted

If you are going with the registry options, make sure you choose a key that is unique, otherwise there can be dire conseqences :geek:

Posted
thanks guys. some great suggestions.

 

can you create your own? I thought these were all predefined.

 

 

You can create your own.

Posted
You can create your own.

 

the setenv/getenv seems to do exactly what I want. Were these commands made available specifically to create system variables? If not what was the original intent? I prefer this over having to mess with the registry.

 

Also I was not able to use USERS1-5 variables. They seem to only work on a sheet by sheet basis.

Posted
I prefer this over having to mess with the registry.

 

Getenv/Setenv do mess with the registry :huh:

Posted

Setenv creates a key at:

 

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\RXX.X\ACAD-XXXX:XXX\FixedProfile\General

Posted

At least the SETENV/GETENV is a safer solution to record information in registry than VL-REGISTRY-? series (even if there are some access restriction).

 

Regards,

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...