Auto Menu Loading and Support Paths

Discussion in 'AutoCAD' started by johnhatfield, Jul 27, 2004.

  1. johnhatfield

    johnhatfield Guest

    Hello,

    I have seen some code from Afralisp.com on auto menu loading with support file search path additions included in the routine. Link below.

    http://www.afralisp.com/lispa/menuload.htm

    I have modified the code to my current configuration. It will add the menu items but will not add the support file search paths. Can anyone tell me why?

    Acad 2002

    Example support path

    "W:\\SUPPORT"

    As coded in the routine from Afralisp

    (addSupportPath "W:\\SUPPORT" 6)

    Any help would be cool.

    What I am trying to do is get set up for a mass company change of standards and completely new menu's, lisp routines, blocks, details, etc. and trying to make it as painless as possible. Also going to implement automatic menu loading of the company menu's and standards and such. Dawnting task.

    Thanks in advance,
    John Hatfield
     
    johnhatfield, Jul 27, 2004
    #1
  2. johnhatfield

    BillZ Guest

    I would think that you need to add the support path to the acad files object.

    This is a snip from the way I did my setup:

    (vl-load-com)
    (setq Path "G:\\Autolisp\\AutoCAD_2005_Support;G:\\Autolisp\\AutoCAD_2005_Support\\User_Menu;G:\\Autolisp\\AutoCAD_2005_Support\\Button_icons;C:\\Program Files\\AutoCAD 2005\\UserDataCache\\Support;C:\\Program Files\\AutoCAD 2005\\support;C:\\Program Files\\AutoCAD 2005\\Express;C:\\Program Files\\AutoCAD 2005\\fonts;C:\\Program Files\\AutoCAD 2005\\help;C:\\Program Files\\AutoCAD 2005\\support\\color;G:\\;G:\\Autolisp;G:\\Autolisp\\dcl file;G:\\Autolisp\\lisp blocks;G:\\Autolisp\\lisp slides;G:\\Autolisp\\lisp_text;G:\\Autolisp\\subr")
    (vla-put-SupportPath
    (vla-get-Files
    (vla-get-Preferences
    (vlax-get-acad-object)
    )
    )
    Path
    )

    Bill
     
    BillZ, Jul 27, 2004
    #2
  3. johnhatfield

    ECCAD Guest

    This is what I use:

    (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)
    ); end function
    ;;
    ;;;==================================================================
    ;;; (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")
    ;;;------------------------------------------------------------------
    ;;; 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
    ;;
    ;; Add to Support Path..IF not there..
    ;;
    (addSupportPath "W:\\SUPPORT" nil)
    ;;

    Bob
     
    ECCAD, Jul 27, 2004
    #3
  4. johnhatfield

    johnhatfield Guest

    BillZ,

    Thank you sir. That works excellent. I have a question regarding your routine. Can you tell me how to find the other path types so that I can use them for the other pathing options? i.e. Plot Style Table Search Path....

    I think your routine works excellent and I want to incorporate the other pathing that I will have to do into your routine.

    Thanks in advance.

    John Hatfield
     
    johnhatfield, Jul 27, 2004
    #4
  5. johnhatfield

    johnhatfield Guest

    BillZ,

    Never mind. I found it. I saw the Vlisp bible download link and grabbed a copy.


    Thanks.

    John Hatfield
     
    johnhatfield, Jul 27, 2004
    #5
  6. johnhatfield

    johnhatfield Guest

    Bob,

    After reviewing the two methods posted, I have to say I like the way yours works better. However, I have noticed this.

    AC2002

    If I remove all AC support file search path(SFSP) directories and then close AC, the main AC directories are automatically recreated. (support, fonts, help & express) and the routine you have below works fine. However, if I remove all AC SFSP except my custom menu folder and my custom support folder AC does not even load the ACADDOC.lsp file. I know that the AC support directory has to be in the SFSP for it to find the ACADDOC.lsp file, but I guess I would have figured that AC would automatically re-add those directories if it found them missing. Any idea as to why this is and a possible fix/work-around?

    Thanks in advance.

    John Hatfield
     
    johnhatfield, Jul 28, 2004
    #6
  7. johnhatfield

    BillZ Guest

    You're welcome.
    Glad you got it going.


    Bill
     
    BillZ, Jul 29, 2004
    #7
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.