See the top rated post in this thread. Click here

Page 1 of 4 1234 LastLast
Results 1 to 10 of 31

Thread: Programmatically Assigning Support File Search Paths

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    I could stop if I wanted to CEHill's Avatar
    Join Date
    2006-05
    Location
    TN
    Posts
    327
    Login to Give a bone
    0

    Question Programmatically Assigning Support File Search Paths

    Can someone share tips or a snippet showing the example code on how the subject item might be accomplished?

  2. #2
    Member
    Join Date
    2005-10
    Posts
    17
    Login to Give a bone
    0

    Default Re: Programmatically Assigning Support File Search Paths

    You can do this by changing the values in the windows registry. Here is a sample of what i use in my startup routine:
    Code:
    ;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 Gets the supportpaths in one string
    (setq searchpath (vla-get-supportpath *files*))
    
    ;Searches if a path is already in the supportpaths, 
    ;if not add the path to the string, using the ";" as a separator
     (if (= (wcmatch searchpath "*F:\\Autocad\\Dynamic Blocks*") nil)
    	(setq searchpath(strcat searchpath ";F:\\Autocad\\Dynamic Blocks")))
     
    ;write the new string of paths in the windows registry
    (vla-put-supportpath *files* searchpath)

  3. #3
    I could stop if I wanted to CEHill's Avatar
    Join Date
    2006-05
    Location
    TN
    Posts
    327
    Login to Give a bone
    0

    Default Re: Programmatically Assigning Support File Search Paths

    I feel enlightened. Seriously: Thanks!

  4. #4
    Member
    Join Date
    2005-10
    Posts
    17
    Login to Give a bone
    0

    Default Re: Programmatically Assigning Support File Search Paths

    You're Welcome

  5. #5
    All AUGI, all the time
    Join Date
    2010-10
    Posts
    535
    Login to Give a bone
    0

    Default Re: Programmatically Assigning Support File Search Paths

    Quote Originally Posted by chillme1 View Post
    Can someone share tips or a snippet showing the example code on how the subject item might be accomplished?
    Code:
    (if (setq new (findfile "F:\\Autocad\\Dynamic Blocks"))
      	(setenv "ACAD" (strcat (getenv "ACAD") ";" new))
      )

  6. #6
    Member
    Join Date
    2015-11
    Location
    Highlands ranch, CO
    Posts
    29
    Login to Give a bone
    0

    Default Re: Programmatically Assigning Support File Search Paths

    At work we have an enterprise .cui and an accompanying tool palette that sometimes users will lose their support paths...
    This routine has been made to generically reflect these paths.

    The users simply drag & drop into their session of autocad to run...

    ~Greg

    Code:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;										;;;
    ;;; Load the custom Tools 							;;;
    ;;;										;;;
    ;;; For AutoCAD 2011								;;;
    ;;;										;;;
    ;;;										;;;
    ;;; Adds a Support File Search Path (In the Options Dialog)			;;;
    ;;; Adds the Enterprise File search path					;;;
    ;;; .cuix file for the tools							;;;
    ;;;										;;;
    ;;; Simply drag & drop into drawing area to run					;;;
    ;;;										;;;
    ;;;----------------------------------------------------------------------	;;;
    ;;;										;;;
    ;;; Version History:								;;;
    ;;;										;;;
    ;;;3/30/2012 Changed from partially loading the cui to adding the support path	;;;
    ;;; for the cui in the enterprise menu						;;;
    ;;;										;;;
    ;;;4/18/2012 Added the support path for the custom Tool Palette			;;;
    ;;;										;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ;;; Checks to see if the "Support File Search Path" already exists
    ;;; If not, creates it
    
    (vl-load-com)
    (setq
      *files* (vla-get-files (vla-get-preferences (vlax-get-acad-object)))
    )
    (SETQ ORIGPATH (vla-get-SupportPath *files*))
    (SETQ ONEPATH (setq w ";C:\\Folder1\\Subfolder2\\Subfolder3"))
    (if (not (vl-string-search w ORIGPATH))
      (progn
        (SETQ MYENV (STRCAT ORIGPATH ONEPATH))
        (if	(< (strlen myenv) 1000)
          (vla-put-SupportPath *files* myenv)
        )
      )
    )
    ;;; Sets the Enterprise Menu
    
    (setq files2
           (vla-get-files (vla-get-preferences (vlax-get-acad-object)))
    )
    (vla-put-EnterpriseMenuFile
      files2
      "C:\\Folder1\\Subfolder2\\Subfolder3\\custom_stuff.cuix"
    )
    (princ)
    
    ;;; Sets the tool palette support path
    
    (setq pFiles (vla-get-files (vla-get-preferences (vlax-get-acad-object))))	;; get file preferences
    (setq tpPath (vla-get-toolPalettePath pFiles))					;; get current tool palette path
    (setq tpPath "%InstallFolder%\\UserDataCache\\Support\\ToolPalette;C:\\Folder1\\Subfolder2\\Subfolder3\\ToolPalette\\Custom TP")	;; set your path here
    (vla-put-toolPalettePath pFiles tpPath)						;; set tool palette path
    )
    (princ)

  7. #7
    Member
    Join Date
    2015-11
    Location
    Highlands ranch, CO
    Posts
    29
    Login to Give a bone
    0

    Default Re: Programmatically Assigning Support File Search Paths

    these might help as well:
    Code:
    ; Items in brackets [] are meant to be replaced with your specific values.
    
    
    ; If using any vlax functions:
    (vl-load-com)
    
    
    ; A common task is to make sure a user has a certain directory in their support paths.
    ; The following snippet adds a given support directory to AutoCAD's support paths.
    (setq suppdir "[YourSupportDir]")
    (if (not (vl-string-search suppdir (getenv "ACAD")))
      (setenv "ACAD" (strcat (vl-string-right-trim ";" (getenv "ACAD")) ";" suppdir))
    )
    (setq suppdir nil)
    ; If you want to explicitly set the support paths, just use (setenv "ACAD" "[SupportPathsHere]").
    ; The paths must be separated by semicolons.
    
    
    ; If your company uses a standard profile, you can use this snippet to make sure everyone uses it.
    ; Use yesterday's post to determine the current revision and version of AutoCAD and replace
    ; the x's with the correct values.
    (vl-registry-write
      "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Rxx.x\\ACAD-xxxx:xxx\\Profiles"
      nil
      "[YourDefaultProfile]"
    )
    
    
    ; Say you want to make sure your users all have a certain tool palette.
    (setq tooldir "[YourToolPaletteDirectory]"
          toolpaths (vlax-get-property (vlax-get-property (vlax-get-property (vlax-get-acad-object) 'Preferences) 'Files) 'ToolPalettePath)
    )
    (if (not (vl-string-search tooldir toolpaths))
      (vlax-put-property
        (vlax-get-property (vlax-get-property (vlax-get-acad-object) 'Preferences) 'Files)
        'ToolPalettePath
        (strcat (vl-string-right-trim ";" toolpaths) ";" tooldir)
      )
    )
    (setq tooldir nil toolpaths nil)
    
    ; If you want to disallow your users from having their own tool palettes, use this:
    (vlax-put-property
      (vlax-get-property (vlax-get-property (vlax-get-acad-object) 'Preferences) 'Files)
      'ToolPalettePath
      [ToolPalettePaths]
    )
    ; These paths should also be separated by semicolons.
    
    
    ; Last but not least, if you want to do something for a specific user:
    (if (= "johndoe" (getvar "LOGINNAME"))
      ; do stuff for John Doe
    )
    
    ; You can modify the above snippet with an OR statement to do something for a group of users as well:
    (if (or
          (= "johndoe" (getvar "LOGINNAME"))
          (= "janedoe" (getvar "LOGINNAME"))
        )
      ; do stuff for the Does
    )
    Last edited by greg.battin; 2013-05-23 at 06:41 PM.

  8. #8
    I could stop if I wanted to CEHill's Avatar
    Join Date
    2006-05
    Location
    TN
    Posts
    327
    Login to Give a bone
    0

    Question Re: Programmatically Assigning Support File Search Paths

    I have been very busy and have just re-visited this very important thread.

    I think that my work environment is much more simplistic than the provided examples allow for as:
    • I am the sole full-version AutoCAD operator in this company.
    • All AutoCAD (Mechanical 2012) support (and custom) files are located on my workstation.


    A description of my support folder structure follows.
    One of the main support file folders is: C:\I-CAD.

    The following subfolders reside under C:\I-CAD and include:

    I-LISP\
    I-LOG\
    I-PALETTES\
    I-PLOT\
    I-TEMP\
    I-TEMPLATES\


    NOTE: Any "log" or "temp" type of file will reside in the folder containing that same ("log" or "temp") name.
    For example, external reference temp files will reside under the I-TEMP folder
    I also have a support file folder for the acad.pgp file: C:\I-CADPGP.

    Question:

    Which lines from the preceding code examples given in this thread need to be assigned to the folders/paths I described above?

    I will check this thread tomorrow. Thanks again for your kind assistance for "this coding newbie but oldie"!
    Last edited by chillme1; 2013-06-05 at 10:18 PM.
    Yours,

    Clint
    Hill

    ------------------
    CAD Systems Operation and Management
    Chemical Plant Process + Mechanical Design Focus Areas

  9. #9
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: Programmatically Assigning Support File Search Paths

    Quote Originally Posted by chillme1 View Post
    Can someone share tips or a snippet showing the example code on how the subject item might be accomplished?
    Take a look: http://cadpanacea.com/node/52
    R.K. McSwain | CAD Panacea |

  10. #10
    I could stop if I wanted to CEHill's Avatar
    Join Date
    2006-05
    Location
    TN
    Posts
    327
    Login to Give a bone
    0

    Default Re: Programmatically Assigning Support File Search Paths

    Hello R.K.,

    How do I change the code that you supplied to use support files residing on my hard drive under C:\I-CAD

    P.S.: I had the code below working at one time from network-based support based files until the network became so slow here.

    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 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*)
    Yours,

    Clint
    Hill

    ------------------
    CAD Systems Operation and Management
    Chemical Plant Process + Mechanical Design Focus Areas

Page 1 of 4 1234 LastLast

Similar Threads

  1. Trouble with Support File Search Paths
    By JGARZA0422 in forum AutoLISP
    Replies: 1
    Last Post: 2013-07-21, 03:45 PM
  2. 2012: Disappearing Support File Search Paths
    By Darren Allen in forum AutoCAD Customization
    Replies: 30
    Last Post: 2013-04-03, 04:11 PM
  3. 2011: Windows Env Vars in Support File Search Paths
    By mcnamac in forum ACA General
    Replies: 0
    Last Post: 2011-03-03, 05:54 PM
  4. Easy way to set-up Support File Search Paths
    By joeswantek in forum AutoCAD Customization
    Replies: 3
    Last Post: 2006-07-11, 08:21 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
  •