See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: Edit Project Files Search Path.

  1. #1
    Member jrd.chapman's Avatar
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    49
    Login to Give a bone
    0

    Default Edit Project Files Search Path.

    Hello all,

    I was wondering whether or not anyone knew if it was possible to programmatically manipulate/add/edit/remove Projects and Paths from the Project Files Search Path in AutoCAD (myself, on AutoCAD 2005).

    I'd like to streamline and simplify XREF management for a particular project I'm coordinating for which there are many different consultants accessing the same set of Base Plans from our company FTP site.

    I'd like to be able to circulate a Lisp routine that will help them quickly add a Project to the Project Files Search Path section in AutoCAD's options, within which all paths to downloaded XREFs would be specified as well. If I can avoid each user having to manually set this up in options, it would be great.

    Any kind of a nudge would be super fantastic!
    TIA

  2. #2
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Edit Project Files Search Path.

    Hi

    A quick forum search, turned up the following amongst many others...

    Project Support Search Path

    LISP Routine needed to set up Project Paths

    profile update while still in autocad

    Have a good one, Mike

  3. #3
    Member jrd.chapman's Avatar
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    49
    Login to Give a bone
    2

    Default Re: Edit Project Files Search Path.

    Thanks for the links Mike.

    I know it's been a while since your response to this thread. I haven't had a chance to further investigate my original question until now. The threads you linked me too had exactly enough information to put me in a position to write thr routine I wanted to write.

    This will help a user set up projects and search paths without going through the AutoCAD options. This code could easily be customized for specific projects and paths, so the user does not even have to browse to the directories to add to the project. I wrote a generic routine so it could be used on any project, and also to have a blast off point for writing setting up specific projects and paths.

    Anyways, here is the code I came up with:
    Code:
     ;;;____________________________________________________________________________;;;
     ;;;																		    ;;;
     ;;;ProjectFileSetup.lsp by John D. Chapman									 ;;;
     ;;;Setup Projects and Project Search Paths									 ;;;
     ;;;November 24, 2005.														  ;;;
     ;;;____________________________________________________________________________;;;
     ;;;																		    ;;;
     ;;;If creating a new project, OR, PROJECTNAME variable has been set,		   ;;;
     ;;;but the project no longer exists in the registry, then continue to ensure   ;;;
     ;;;the project specified in PROJECTNAME gets created or re-created.		    ;;;
     ;;;____________________________________________________________________________;;;
     
     (defun proj_error (msg)
       (if (/= msg "Function cancelled")
     	(princ
     	  (strcat "\nError: " msg " [" (itoa (getvar "ERRNO")) "]")
     	)
     	(princ)
       )
       (proj)
       (setvar "cmdecho" cmd)
       (setq	projName nil
     	projPath nil
     	fileprefs nil
       )
       (setq *error* olderr)
       (princ)
     )
     
     ;;;____________________________________________________________________________;;;
     ;;;																		    ;;;
     ;;;Continue on "'<project>' not found in the registry." error.				 ;;;
     ;;;____________________________________________________________________________;;;
     
     (defun proj (/ go prevPath fileSelect cont?)
       (setq	projPath nil
     	go T
       )
       (setq prevPath "\"\"")
       (while go
     	(setq fileSelect
     	   (getfiled
     		 "Select a file within the directory to add (can be any file)."
     		 prevPath
     		 ""
     		 16
     	   )
     	)
     	(if	fileSelect
     	  (progn
     	(setq prevPath (vl-filename-directory fileSelect))
     	(if projPath
     	  (setq	projPath (strcat projPath
     				 ";"
     				 (vl-filename-directory fileSelect)
     			 )
     	  )
     	  (setq projPath (vl-filename-directory fileSelect))
     	)
     	(initget "Yes No")
     	(setq cont? (getkword "\nAdd more paths? [Yes/No]<Yes>: "))
     	(if (= cont? "No")
     	  (setq go nil)
     	  (setq go T)
     	)
     	  )
     	  (progn
     	(alert "\nYou did not specify a directory to add.")
     	(setq go nil)
     	  )
     	)
       )
       (if projPath
     	(vla-setProjectFilePath fileprefs projName projPath)
     	(alert "\nNo paths were specified.")
       )
       (princ)
     )
     
     ;;;____________________________________________________________________________;;;
     ;;;																		    ;;;
     ;;;Set up projects and XREF search paths.									  ;;;
     ;;;____________________________________________________________________________;;;
     
     (defun c:Proj
     	   (/ cmd acadapp prefs try_again go prevPath fileSelect cont?)
       (vl-load-com)
       (setq cmd (getvar "cmdecho"))
       (setvar "cmdecho" 0)
       (setq	olderr	  *error*
     	*error*	  proj_error
     	projName  nil
     	acadapp	  (vlax-get-acad-object)
     	prefs	  (vla-get-preferences acadapp)
     	fileprefs (vla-get-files prefs)
       )
       (while (not projName)
     	(setq eProjName (getvar "PROJECTNAME"))
     	(setq
     	  projName
     	   (getstring T
     		  (strcat "\nNew Project Name <" eProjName ">:")
     	   )
     	)
     	(if	(= projName "")
     	  (setq projName eProjName)
     	)
     	(if	(or (= projName "")
     		(= projName " ")
     		(= projName "\"\"")
     		(= projName ".")
     	)
     	  (progn
     	(alert "No Project Name has been specified.")
     	(initget "Yes No")
     	(setq try_again (getkword "\nTry again? [Yes/No]<Yes>: "))
     	(if (= try_again "No")
     	  (setq go nil)
     	  (setq projName nil)
     	)
     	  )
     	  (progn
     	(setq go T)
     	(setvar "PROJECTNAME" projName)
     	(setq projPath (vla-getProjectFilePath fileprefs projName))
     	(if (= projPath "")
     	  (setq projPath nil)
     	)
     	  )
     	)
       )
       (setq prevPath "\"\"")
       (while go
     	(setq fileSelect
     	   (getfiled
     		 "Select a file within the directory to add (can be any file)."
     		 prevPath
     		 ""
     		 16
     	   )
     	)
     	(if	fileSelect
     	  (progn
     	(setq prevPath (vl-filename-directory fileSelect))
     	(if projPath
     	  (setq	projPath (strcat projPath
     				 ";"
     				 (vl-filename-directory fileSelect)
     			 )
     	  )
     	  (setq projPath (vl-filename-directory fileSelect))
     	)
     	(initget "Yes No")
     	(setq cont? (getkword "\nAdd more paths? [Yes/No]<Yes>: "))
     	(if (= cont? "No")
     	  (setq go nil)
     	  (setq go T)
     	)
     	  )
     	  (progn
     	(alert "\nYou did not specify a directory to add.")
     	(setq go nil)
     	  )
     	)
       )
       (if projPath
     	(vla-setProjectFilePath fileprefs projName projPath)
     	(alert "\nNo paths were specified.")
       )
       (setvar "cmdecho" cmd)
       (setq *error* olderr)
       (princ)
     )

Similar Threads

  1. Import Project Support Search Path, not via an ARG file
    By Ms. Serene in forum AutoCAD Customization
    Replies: 10
    Last Post: 2015-06-01, 06:31 PM
  2. Project File Search Path, Projectname, and Favorites
    By pauljordan in forum AutoCAD General
    Replies: 4
    Last Post: 2010-07-20, 07:54 PM
  3. Project Files Search Path
    By gilmer in forum AutoLISP
    Replies: 1
    Last Post: 2008-05-29, 04:18 PM
  4. Go directly to Project files (Search Paths)
    By kleenhippie in forum AutoCAD General
    Replies: 5
    Last Post: 2006-02-07, 07:46 PM
  5. Project Files Search Path
    By Avatart in forum AutoCAD General
    Replies: 4
    Last Post: 2004-07-01, 05:42 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
  •