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


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


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

The comments to this entry are closed.

My Photo

My Other Accounts

LinkedIn Twitter

Twitter Updates

    follow me on Twitter