Adding Multiple supprt paths?? Help

Discussion in 'AutoCAD' started by Chris Chiles, Feb 11, 2005.

  1. Chris Chiles

    Chris Chiles Guest

    Sorry for the X-post - Comeone said that I might havmore luck in this
    discussion.

    I have search the newsgroups all over and found alot of very helpful info.
    What I have so far works - with one support path. I need to add about 6.

    Here's what I have from the info I found:

    **addsupportpath.lsp**
    --------------------------------------------------------------------------------------------------------------------------------
    (defun addSupportPath (dir pos / tmp c lst)
    (setq tmp ""
    c -1
    )
    (if
    (not
    (member (strcase dir)
    (setq lst (mapcar 'strcase (strParse (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)
    )
    --------------------------------------------------------------------------------------------------------------------------------



    I have this lisp in my "lisp" folder

    **StrParse.lsp**
    --------------------------------------------------------------------------------------------------------------------------------
    ;;;==================================================================<
    br>;;; (StrParse Str Delimiter)
    ;;; Parses a delimited string into a list
    ;;;------------------------------------------------------------------;;;
    Parameters:
    ;;; Str String to parse
    ;;; Delimiter Delimiter to search for
    ;;;------------------------------------------------------------------
    ;;; Returns:
    ;;; A list strings.
    ;;; ex:
    ;;; (setq a "Harp,Guiness,Black and Tan")
    ;;; (StrParse a ",")
    ;;; returns:
    ;;; ("Harp" "Guiness" "Black and Tan")
    ;;;------------------------------------------------------------------<
    br>;;; See Also: (StringToList)
    ;;;---------------------------------------------------------- --------
    (defun strParse (Str Delimiter / SearchStr StringLen return n char)
    (setq SearchStr Str)
    (setq StringLen (strlen SearchStr))
    (setq return '())

    (while (> StringLen 0)
    (setq n 1)
    (setq char (substr SearchStr 1 1))
    (while (and (/= char Delimiter) (/= char ""))
    (setq n (1+ n))
    (setq char (substr SearchStr n 1))
    ) ;_ end of while
    (setq return (cons (substr SearchStr 1 (1- n)) return))
    (setq SearchStr (substr SearchStr (1+ n) StringLen))
    (setq StringLen (strlen SearchStr))
    ) ;_ end of while
    (reverse return)
    ) ;_ end of defun
    --------------------------------------------------------------------------------------------------------------------------------




    **supportpathlist.lsp**
    --------------------------------------------------------------------------------------------------------------------------------
    (load "addsupportpath.lsp")
    (addSupportPath "c:\\myFolder" 2)
    --------------------------------------------------------------------------------------------------------------------------------

    All that works Great - But I can't figure out how to add more than one path
    to "supportpathlist.lsp". Can anyone help me?

    Thanks,
    Chris
     
    Chris Chiles, Feb 11, 2005
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.