Can someone share tips or a snippet showing the example code on how the subject item might be accomplished?
|
Can someone share tips or a snippet showing the example code on how the subject item might be accomplished?
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)
I feel enlightened. Seriously: Thanks!
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)
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.
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
Take a look: http://cadpanacea.com/node/52
R.K. McSwain | CAD Panacea |
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