See the top rated post in this thread. Click here

Results 1 to 10 of 10

Thread: Append AutoCAD search file path list

  1. #1
    I could stop if I wanted to jpcadconsulting347236's Avatar
    Join Date
    2011-09
    Posts
    268
    Login to Give a bone
    0

    Default Append AutoCAD search file path list

    Hiya gang,

    I've got this really useful lisp from Lee Mac's site that appends additional paths to your AutoCAD search path list.

    It works fine except that I can't seem to add a root drive letter (in this case R:\).

    It adds "R:\Slides", "R:\Fonts", and "R:\Patterns" just fine, but not "R:"

    I'm stumped. Hoping you can help.

    Code:
    ;;; Adds folders to support path
    
    (defun LM:sfsp+ ( lst )
        (   (lambda ( str lst )
                (if (setq lst
                        (vl-remove-if
                           '(lambda ( x )
                                (or (vl-string-search (strcase x) (strcase str))
                                    (not (findfile x))
                                )
                            )
                            lst
                        )
                    )
                    (setenv "ACAD" (strcat str ";" (apply 'strcat (mapcar '(lambda ( x ) (strcat x ";")) lst))))
                )
            )
            (vl-string-right-trim ";" (getenv "ACAD"))
            (mapcar '(lambda ( x ) (vl-string-right-trim "\\" (vl-string-translate "/" "\\" x))) lst)
        )
    )
    
    
    
    
    (LM:sfsp+ '("R:\\" "R:\\Slides" "R:\\Fonts" "R:\\Patterns"))
    Last edited by jpcadconsulting347236; 2019-05-22 at 07:49 PM.
    James Pertusi

    CAD Applications Consultant
    1 (646) 773 4834
    www.jpcadconsulting.com

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,145
    Login to Give a bone
    0

    Default Re: Append AutoCAD search file path list

    I actually use a modified version of Lee's lisp that substitutes individual user names in added folders as needed, it works well for our needs.
    Code:
    (defun AddSupportPath (dir / Cpath Uname) ;http://lee-mac.com/addremovesupportpaths.html
      (setq Cpath (getenv "ACAD") Uname (getenv "Username") dir (vl-string-subst Uname "%Username%" dir))
      (or (vl-string-search dir Cpath) (setenv "ACAD" (strcat Cpath ";" dir)))
      (princ)
    )
    Last edited by Tom Beauford; 2019-05-30 at 11:24 AM. Reason: Mine is actually just a modification of Lee Mac's.
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

  3. #3
    I could stop if I wanted to jpcadconsulting347236's Avatar
    Join Date
    2011-09
    Posts
    268
    Login to Give a bone
    0

    Default Re: Append AutoCAD search file path list

    Thaks Tom, I'll keep bashing away at it and will report if I find anything...
    James Pertusi

    CAD Applications Consultant
    1 (646) 773 4834
    www.jpcadconsulting.com

  4. #4
    I could stop if I wanted to jpcadconsulting347236's Avatar
    Join Date
    2011-09
    Posts
    268
    Login to Give a bone
    1

    Default Re: Append AutoCAD search file path list

    I just tried:

    Code:
    (AddSupportPath "G:")
    Note - no slashes.

    It worked fine!

    - - - Updated - - -

    Confirmed, the following code works as expected.

    Thanks for your help!

    Code:
    (defun AddSupportPath (dir / Cpath Uname) ;http://lee-mac.com/addremovesupportpaths.html
      (setq Cpath (getenv "ACAD") Uname (getenv "Username") dir (vl-string-subst Uname "%Username%" dir))
      (or (vl-string-search dir Cpath) (setenv "ACAD" (strcat Cpath ";" dir)))
      (princ)
    )
    
    (AddSupportPath "R:")
    (AddSupportPath "R:\Slides")
    (AddSupportPath "R:\Fonts")
    (AddSupportPath "R:\Patterns")
    James Pertusi

    CAD Applications Consultant
    1 (646) 773 4834
    www.jpcadconsulting.com

  5. #5
    Member
    Join Date
    2006-11
    Posts
    5
    Login to Give a bone
    0

    Default Re: Append AutoCAD search file path list

    I found that uppercase C: or C:\\ did not work while lowercase c: and c:\\ did work except that I'm not sure I would trust c: to work as a path entry. Another option would be to use c:\\. or C:\\. which both work and have the advantage of not ending the path entry with a \ or a :

  6. #6
    I could stop if I wanted to
    Join Date
    2003-07
    Posts
    330
    Login to Give a bone
    2

    Default Re: Append AutoCAD search file path list

    There is a un documented answer say you have c:\myprogs........... etc \lisp \blocks etc etc

    If you make the support path c:\myprogs.. note the double period it says look down the path.

  7. #7
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,145
    Login to Give a bone
    1

    Default Re: Append AutoCAD search file path list

    Quote Originally Posted by BIG-AL View Post
    There is a un documented answer say you have c:\myprogs........... etc \lisp \blocks etc etc

    If you make the support path c:\myprogs.. note the double period it says look down the path.
    Oddly Trusted Locations uses a triple period for the same thing. "When TRUSTEDPATHS includes a folder that ends with \... (backslash and three dots), all of its subfolders are also trusted." https://knowledge.autodesk.com/suppo...351AF-htm.html
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

  8. #8
    Woo! Hoo! my 1st post
    Join Date
    2014-04
    Posts
    1
    Login to Give a bone
    0

    Default Re: Append AutoCAD search file path list

    I haven't tried this yet, but was wondering if this truly "adds" to the list or does it replace the list? Thanks.

  9. #9
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,145
    Login to Give a bone
    0

    Default Re: Append AutoCAD search file path list

    Quote Originally Posted by n.moroniti627291 View Post
    I haven't tried this yet, but was wondering if this truly "adds" to the list or does it replace the list? Thanks.
    First create a new profile in Options on the Profiles tab click [Add to List…], then select it and click [Set Current], click [Apply] then [OK].
    Now if it messes up your new profile's Support File Search Path you can simply [Delete] the new profile.

    Never use code to modify anything in AutoCAD for the first time without a backup copy.
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

  10. #10
    100 Club matt.worland's Avatar
    Join Date
    2015-12
    Location
    Denver, CO USA
    Posts
    173
    Login to Give a bone
    0

    Default Re: Append AutoCAD search file path list

    Quote Originally Posted by n.moroniti627291 View Post
    I haven't tried this yet, but was wondering if this truly "adds" to the list or does it replace the list? Thanks.
    AFAIK, you must capture the original settings, then append to it and replace the original setting.
    This line here accomplishes that.
    Code:
    (setenv "ACAD" (strcat Cpath ";" dir))
    So while this does append to the end, it also replaces the entire setting with a new one.
    matt worland

Similar Threads

  1. Search path search path caching?
    By Liamnacuac in forum Networks
    Replies: 1
    Last Post: 2016-05-31, 07:15 PM
  2. Print Spooler File Location or Printer Description File Search Path?
    By archer1684 in forum CAD Management - General
    Replies: 4
    Last Post: 2011-04-14, 07:13 PM
  3. Replies: 13
    Last Post: 2010-10-05, 03:54 PM
  4. Append to sdr file?
    By jbbarrus in forum Survey - General
    Replies: 2
    Last Post: 2010-06-06, 03:25 PM
  5. Append Sheet List tables to Excel Spreadsheets
    By jgratton in forum AutoCAD Tables
    Replies: 2
    Last Post: 2006-06-29, 09:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •