I'm looking for a way to add a support path to
autocad using autolisp. Can you please help?
Try this out :
;<-Coding Starts Here
(defun addSP (dir pos / tmp c lst)
(setq tmp ""
c -1
)
(if
(not
(member (strcase dir)
(setq lst (mapcar 'strcase (parse (getenv "ACAD") ";")))
)
)
(progn
(if (not pos)
(setq tmp (strcat (getenv "ACAD") ";" dir))
(mapcar '(lambda (x)
(setq tmp (if (= (setq c (1+ c)) pos)
(strcat tmp ";" dir ";" x)
(strcat tmp ";" x)
)
)
)
lst
)
)
(setenv "ACAD" tmp)
)
)
(princ)
)
(defun parse (str delim / lst pos)
(setq pos (vl-string-search delim str))
(while pos
(setq lst (cons (substr str 1 pos) lst)
str (substr str (+ pos 2))
pos (vl-string-search delim str)
)
)
(if (> (strlen str) 0)
(setq lst (cons str lst))
)
(reverse lst)
)
;Coding Ends Here ->
Arguments : A folder path and the position at
which to insert it. (0 based.)
Example : (addSP "c:\\afralisp"
3)
I "borrowed" this from http://www.acadx.com
Please don't tell on me!!!
|