« Creating a New Document in AutoCAD with AutoLISP | Main | AutoCAD ActiveX History Reference »

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83420642b53ef00d8346c552f53ef

Listed below are links to weblogs that reference Working with Environment Variables through AutoLISP:

Comments

R.K. McSwain

Lee, although you shell object is obviously more powerful, I have found that you can use (getenv) to return environment variables (at least the ones you can access through the DOS [SET] command).

For example:
(strcat (getenv "temp") "\\MYDATA")

So for simply retreiving the %temp% directory, the ComputerName, the UserDomain, etc. - (getenv) should work.


Lee Ambrosius

GETENV does work for getting the variables, but the problem is that even though there is a SETENV function; it can't be used to update OS environment variables. It instead is wired to specific locations under the AutoCAD registry keys.

So if I have a variable called ALLDOCS that is defined in as a System Variable for the OS and use SETENV to update it, SETENV writes to the Fixed Profile >> General location under HKEY_CURRENT_USER >> Software >> Autodesk >> AutoCAD >> (Release) >> (ProdID).

So it is for this reason that I like to use FSO for everything. From what I have seen, there is no slow down in performance getting a variable value this way. Now setting one is a slightly different story.

asd khalil

hello sir
my name is asd khalil i have small question about autocad blocks

i need to bind specific value(block price) with each blocks in my library
when i drag this block some code must be execute and view the total sum for all blocks

if i can do that please tell

thank you for your help


asd khalil


sdtopo

Hallo
I am trying to pass information from vba to autocad using the acad.cfg file.

I use the following syntax:

Dim zzGetVarzz as String

ThisDrawing.SendCommand "(setvar ""USERS1"" (getcfg ""AppData/SDTOPO/StringForTitle""))" & vbCr

zzGetVarzz = AutoCAD.Application.ActiveDocument.GetVariable("USERS1")

This works OK only if i use it one or two times within the Sub.
I need to call this syntax over 80 times within the same Sub and when i run it it seems command line gets confused (asynchronising issues) with so many commands and does not work rigth.

If anyone could give an example of how to use "Autocad.Application.Prefernces.property property"
which is the comparision of getcfg in vba (whithout using sendcommand).
Or could i use setenv and then getenv in vba ?


Thank you in advance.
Please help

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.