Setting support paths via lisp

This sort of goes along with my customization post from a while back.

Here is an example of how to set your support file search paths using ACAD.LSP. By doing it using this method, you don't have to worry about profiles, .ARG files, etc. Your users are free to customize anything not controlled by this startup routine. If something gets messed up, just restart AutoCAD, and everything reloads.

(vl-load-com)
; This sets a reference to the install path of your product
(setq acadloc
   (vl-registry-read
      (strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key))
   "ACADLOCATION")
); This sets a reference to the files portion of the acad preferences
(setq *files* (vla-get-files
   (vla-get-preferences (vlax-get-acad-object))
))
; This builds the string of support file search paths
(setq sfsp
       (strcat
  "\\\\SERVER\\CAD\\SUPPORT;"
  "\\\\SERVER\\CAD\\LISP;"
  "\\\\SERVER\\CAD\\FONTS;"
  (getvar "ROAMABLEROOTPREFIX") "SUPPORT;"
  acadloc "\\SUPPORT;"
  acadloc "\\HELP;"
  acadloc "\\EXPRESS;"
  acadloc "\\SUPPORT\\COLOR;"
  acadloc "\\LAND;"
  (getvar "LOCALROOTPREFIX") "SUPPORT;"
  "C:\\Program Files\\Common Files\\Autodesk Shared\\GIS\\FDO\\2.0;"
  "C:\\Program Files\\Common Files\\Autodesk Shared\\GIS\\FDO\\2.0\\Oracle;"
  "C:\\Program Files\\Common Files\\Autodesk Shared\\GIS\\FDO\\2.0\\ArcSDE;"
  "C:\\Program Files\\Autodesk Land Desktop 2006\\Land;"
  "C:\\Program Files\\Dotsoft\\Toolpac\\;"
  "C:\\Program Files\\Dotsoft\\XL2CAD"  
       )
)
; This actually applies the above string to the current session of AutoCAD.
(vla-put-SupportPath *files* sfsp)
; Here are some examples of setting other things
; Set the template directory
(vla-put-TemplateDwgPath *files* "\\\\SERVER\\CAD\\TEMPLATE")
; Set the default template (QNEW) name
(vla-put-QNewTemplateFile *files* "\\\\SERVER\\CAD\\TEMPLATE\\my-custom.dwt") 
; Set the printer (PC3) support file path
(vla-put-PrinterConfigPath *files* "\\\\SERVER\\CAD\\PLOTTERS")
; Release the object
(vlax-release-object *files*)

You should place this in your ACAD.LSP file, not ACAD200x.LSP.

Where do you put ACAD.LSP? In the directory that is at the TOP of your support file search path. In the above example, this one would go in

\\SERVER\CAD\SUPPORT

Comments

rkmcswain, first of all I want to thank you VERY VERY much for this, it is and will be a HUGE help with my workload tasks, i have been looking for a way to do this in AutoCAD for a year or so before I finally ran into a post that brought me here from a forum.

One issue I have ran into with this is the MVSETUP command in AutoCAD. I have a user who utilizes this command, but the problem is when running the command, it creates a mvsetup.dfs file in the first listed support path location, which I had a read-only server location that housed my acad.lsp file to drive everything...

Now with that top path being a locked server location, the MVSETUP command will not work.

I have moved the path that stores the acad.lsp to the second line, but I fear it will only be a matter of time before a user creates their own acad.lsp file for their use and throws it in the top line.

Any suggested would be helpful.

Thanks

Dave

 


All content is copyright © CAD PANACEA 2005-2013 unless otherwise noted and may not be reproduced. All comments posted to this blog are the sole responsibility of the person making the comment.

Google, as a third party vendor, uses cookies to serve ads on this site. Google's use of their cookies enables it to serve ads to users based on their visit to your sites and other sites on the Internet. You may opt out of the use of these cookies by visiting the Google ad and content network privacy policy.

Powered by Drupal