Results 1 to 4 of 4

Thread: Code Review: Local Support Paths Set via LISP

  1. #1
    I could stop if I wanted to chillme1's Avatar
    Join Date
    2006-05
    Location
    TN
    Posts
    242

    Default Code Review: Local Support Paths Set via LISP

    I am modifying the following example code shown below to set AutoCAD 'vanilla' support files to reference a local path/folder (C:\ACAD) instead of the network paths supplied in the sample below.

    Hopefully, this will be simpler to do than I expect. See the attached mage for my subfolder list. All subfolders will be used except for CAD_DOCS and CAD_UTILS.

    HELP: I am inexperienced at LISP and need direction on the use of the code snippet to reference a local path/folder (C:\ACAD)]

    What do I need to change in the following example code?
    Do I need the "ROAMABLEROOTPREFIX" portion?

    ; 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;

    EXAMPLE CODE FOLLOWS from R.K. McSwain at CAD PANACEA http://rkmcswain.blogspot.com/2006/0...setup-and.html
    ----------------------------------------------------------------------
    PHP Code:
     Here is an example of how to set your support file search paths using ACAD.LSPBy doing it using this methodyou 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
    (vla-put-TemplateDwgPath *files* "\\\\SERVER\\CAD\\TEMPLATE")
    (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.
    ---------------------------------

    Thanks for your help!!!
    Attached Images Attached Images
    Last edited by Clinton.Hill; 2008-08-07 at 04:46 PM. Reason: Clarification
    Clint Hill
    Sr. Mechanical Designer/ CAD Operatior
    ------------------
    Chemical Process Plant Design / Machine + Tool & Die Design
    3D Intelligent Modeling & AUGI Fan

  2. #2
    Certified AUGI Addict rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Houston
    Posts
    7,519

    Default Re: Code Review: Local Support Paths Set via LISP

    If I understand your question right...., just replace:

    "\\\\SERVER\\CAD\\SUPPORT;"
    "\\\\SERVER\\CAD\\LISP;"
    "\\\\SERVER\\CAD\\FONTS;"

    with

    "C:\\CAD\\SUPPORT;"
    "C:\\CAD\\LISP;"
    "C:\\CAD\\FONTS;"

    ROAMABLEROOTPREFIX is just a variable for a long path like this:
    "C:\\Documents and Settings\\username\\Application Data\\Autodesk\\AutoCAD
    2009\\R17.2\\enu\\"

  3. #3
    Administrator RobertB's Avatar
    Join Date
    2001-08
    Location
    Dallas TX USA
    Posts
    5,825

    Default Re: Code Review: Local Support Paths Set via LISP

    Normally I don't write the full code, but here you go:
    Code:
    (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 the root folder for your own customizations
    (setq myCAD "C:\\Acad\\")
    ;;; 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
     myCAD "CAD_Blocks"
     myCAD "CAD_Borders"
     myCAD "CAD_Hatch"
     myCAD "CAD_Linetypes"
     myCAD "CAD_Lisp"
     myCAD "CAD_Process"
     myCAD "CAD_VBA"
     (getvar "RoamableRootPrefix") "Support;"
     (getvar "RoamableRootPrefix") "Support\\Pats;"
     acadloc "\\Support;"
     acadloc "\\Fonts;"
     acadloc "\\Help;"
     acadloc "\\Express;"
     acadloc "\\Support\\Color;"))
    ;;; This actually applies the above string to the current session of AutoCAD.
    (vla-put-SupportPath *files* sfsp)
    (vla-put-TemplateDwgPath *files* (strcat myCAD "CAD_Templates"))
    (vla-put-PrinterConfigPath *files* (strcat myCAD "CAD_Plotters"))
    (vla-put-PrinterDescPath *files* (strcat myCAD "CAD_Plotters\\PMP Files"))
    (vla-put-PrinterStyleSheetPath *files* (strcat myCAD "CAD_Plot_Styles"))
    (vla-put-ToolPalettePath *files* (strcat myCAD "CAD_Palette;" (getvar "RoamableRootPrefix") "Support\\ToolPalette"))
    (vla-put-MenuFile *files* (strcat myCAD "CAD_CUI"))
    (vla-put-CustomIconPath *files* (strcat myCAD "CAD_Icons"))
    (vla-put-LogFilePath *files* (strcat myCAD "CAD_Log"))
    (vla-put-TempFilePath *files* (strcat myCAD "CAD_Temp_Files"))
    (vla-put-PlotLogFilePath *files* (strcat myCAD "CAD_Plot2File"))
    ;;; Clean up variables
    (vlax-release-object *files*)
    (setq acadloc nil myCad nil sfsp nil *files* nil)
    Note that I did not add the CAD_Plot2File folder to the support paths, as I see no reason for that. However, I did use that folder for the print log.
    I also did not see a PMP folder so I assume it is located under CAD_Plotters.
    R. Robert Bell
    Design Technology Manager
    S P A R L I N G
    Opinions expressed are mine alone and do not reflect the views of Sparling.

  4. #4
    I could stop if I wanted to chillme1's Avatar
    Join Date
    2006-05
    Location
    TN
    Posts
    242

    Default Re: Code Review: Local Support Paths Set via LISP

    My sincere thanks to you, Mr. Bell (for making an exception to your rule) & Mr. McSwain ( for your initiative in posting the original code on your blog).

    Both of you should be commended on your desire to teach others and the amazing generosity as shown in this thread.
    Clint Hill
    Sr. Mechanical Designer/ CAD Operatior
    ------------------
    Chemical Process Plant Design / Machine + Tool & Die Design
    3D Intelligent Modeling & AUGI Fan

Similar Threads

  1. Add Support Paths via LISP
    By DoubleD in forum AutoLISP
    Replies: 11
    Last Post: 2012-04-06, 02:26 PM
  2. ACAD Support Paths
    By mikelf in forum AutoLISP
    Replies: 8
    Last Post: 2008-05-22, 08:58 PM
  3. Support Paths/Profile Set via LISP
    By chillme1 in forum AutoLISP
    Replies: 6
    Last Post: 2007-06-05, 12:34 PM
  4. Get the current support paths and add new paths
    By framedNlv in forum AutoLISP
    Replies: 16
    Last Post: 2006-09-27, 04:13 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
  •