; resets the paths usefull for update versions of Autocad
; by A Houston 2011
; This sets a reference to the install path of your product
; the gets are their for info maybe other use
; use this to find other settings
;(vlax-dump-object (vla-get-files (vla-get-preferences (vlax-get-Acad-object))) T)
(vl-load-com)
(defun setpaths ( / *files* doc)
; make temp directory
(if (vl-file-directory-p "C:\\Acadtemp\\")
(Princ "Acadtemp exists")
(vl-mkdir "C:\\AcadTEMP\\")
)
(setq *files* (vla-get-files (vla-get-preferences (vlax-get-Acad-object))))
; savepath
;(vla-get-AutoSavepath *files*)
(vla-put-AutoSavepath *files* "C:\\AcadTemp")
; custom icons
;(vla-get-CustomIconPath *files*))
(vla-put-CustomIconPath *files* "P:\\Autodesk\\ICONS")
; printers config
;(vla-get-PrinterConfigPath *files*)
(vla-put-PrinterConfigPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles 2011")
; printers style sheet
;(vla-get-PrinterStyleSheetPath *files*)
(vla-put-PrinterStyleSheetPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles")
; printer drv's
;(vla-get-PrinterDescPath *files*)
(vla-put-PrinterDescPath *files* "P:\\AutoDESK\\Plotting\\Drv")
; print spooler
;(vla-get-PrintSpoolerPath *files*)
(vla-put-PrintSpoolerPath *files* "C:\\AcadTemp\\")
; template path
;(vla-get-TemplateDwgPath *files*)
(vla-put-TemplateDwgPath *files* "P:\\Autodesk\\c3d Templates")
; template location
;(vla-get-QnewTemplateFile *files*)
(vla-put-QnewTemplateFile *files* "P:\\Autodesk\\c3d Templates\\XXXX.dwt")
;make new support paths exist + new
(setq paths (vla-get-SupportPath *files*))
(setq XXXXpaths "P:\\autodesk\\supportfiles;P:\\autodesk\\lisp;P:\\autodesk\\fonts;P:\\autodesk\\hfs fonts;")
(setq newpath (strcat XXXXpaths paths))
(vla-put-SupportPath *files* newpath)
; Tempdirectory
;(vla-get-TempFilePath *files*))
(vla-put-TempFilePath *files* "C:\\AcadTemp\\")
; PlotLogFilePath = "C:\\Documents and Settings\\BIGAL.XXXX-AD\\localsettings\\application data\\autodesk\\c3d 2011\\enu\\"
(vla-put-PlotLogFilePath *files* "C:\\AcadTemp\\")
; LogFilePath = "C:\\Documents and Settings\\BIGAL.XXXX-AD\\localsettings\\application data\\autodesk\\c3d 2011\\enu\\"
(vla-put-LogFilePath *files* "C:\\AcadTemp\\")
; xref temp path
;(vla-get-TempXrefPath *files*))
(vla-put-TempXrefPath *files* "C:\\AcadTemp\\")
; end use of *files*
)
(setpaths)
; exit quitely
(princ "All Done")
http://lee-mac.com/addremovesupportpaths.html
http://lee-mac.com/addremovesupportpaths.html
Thanks Lee. I think I'll be using that. Appreciate your great work!
I may be missing something but isn't it as simple as:Code - Auto/Visual Lisp: [Select]
Not enough information in the OP but...I don't care if the path already exists (in this context or/and unless you have 50 duplicates). But you shouldn't be calling this type of code every time you open a drawing, for example. Besides, AutoCAD (used to--at least) stop once it found the first occurrence of what it was looking for. Now if you want to re-order the list that takes a bit more. But I'm sure you can find plenty of examples here (I'm sure I've even done that task once or a thousand times in the past so I probably even have code posted here to do that-and I'm a dummy) but that wasn't the question; the OP wanted to know how to add to the path variable (-i.e. hence the "get path, append new to it, set the path" response from me).I may be missing something but isn't it as simple as:Code - Auto/Visual Lisp: [Select]
A little more complicated when you start considering outcomes. For example, what happens if the path is already present? What if you want the search path somewhere in the middle of the existing paths?
Does anyone here know a way to add new locations to the support file search path via lisp? We use a few network locations for support files and occasionally the network connection is lost. If a user opens cad without that connection, the entry in the support file path list is lost also.
Was hoping to make a lisp to add them back easily.