AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Environmental Issues

Setting up Support Paths within AutoCAD can be a real pain in the proverbial backside especially, if you've got a whole stack of workstations to deal with. It's even worse, if like my office, each user has different menu settings and support files.
The following coding shows you how you can automate this process by making use of the AutoCAD (getenv) and (setenv) functions.

Firstly we need to set up our Support Path directories. Mine looks like this :

         |------------ LISP
         |------------ VBA
         |------------ BLOCKS
         |------------ DRAWINGS
         |------------ MENU
         |------------ TEMPLATES
NDBE51D1 is my login name. By incorporating the users login name into the support path,
we know who we are dealing  with and can set up our Support Paths to suit. 

(defun C:SETNEWPATH ( / netpath defpath)

;define the network path - replace this with your
;network path
(setq netname "C:\\")

;define the user directory path
(setq netpath (strcat netname (getvar "LOGINNAME")))

;set to AutoCAD default
(setenv "ACAD" "")

;store the default paths
(setq defpath (getenv "ACAD"))

;set up the custom paths
(setenv "ACAD" (strcat 
defpath ";"
netpath ";"
netpath "\\" "lisp;"
netpath "\\" "vba;"
netpath "\\" "blocks;"
netpath "\\" "drawings;"
netpath "\\" "menu;"

;set up the custom template path
(setenv "TemplatePath" (strcat netpath "\\" "Templates"))

;set up the custom temp directory path
(setenv "Temp" "C:\\temp")

;inform the user
(alert "Custom Support Paths Defined")






You could incorporate this into your Acad.lsp file to ensure that all your Support Paths are set correctly. Irrespective of the user, the correct Support Path will be defined.
Also, to ensure that the correct menu is loaded, have a look at the Acad.lsp Tip found on AfraLisps Tips 'n Tricks page.

Hey, come to think of it, you could also use this in conjunction with Profiles to make life even easier.

Oh, by the way, if you'd like a listing of Environment Variables, pop along here.
(Listing kindly donated by Stig Madsen.)

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website