Results 1 to 9 of 9

Thread: Setting the ACAD environment variable on launch

  1. #1
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Setting the ACAD environment variable on launch

    Hey gang,

    I am trying to set the search paths on launch by adding the following line to acad.doc

    Code:
    (setenv "ACAD" "\\\\ny-fs01\\cad_common$\\autocad 2014\\hatches;\\\\ny-fs01\\cad_common$\\autocad 2014\\lisp;\\\\ny-fs01\\cad_common$\\autocad 2014\\drawings;%RoamableRootFolder%\\support;\\\\ny-fs01\\cad_common$\\autocad 2014\\support\\en-us;\\\\ny-fs01\\cad_common$\\autocad 2014\\fonts;%InstallFolder%\\help;%InstallFolder%\\express;\\\\ny-fs01\\cad_common$\\autocad 2014\\support\\color;%InstallFolder%\\aca;c:\\programdata\\autodesk\\applicationplugins\\autodesk appmanager.bundle\\contents\\resources;c:\\programdata\\autodesk\\applicationplugins\\autodesk appmanager.bundle\\contents\\windows\\2014;c:\\programdata\\autodesk\\applicationplugins\\autodesk importskp.bundle\\contents\\resources;%InstallFolder%\\bin\\fdo;")
    It works fine except for the paths with either %RoamableRootFolder% or %InstallFolder%. Its not enumerating those paths in the config dialog box:

    paths.png

    Any advice?

    Thanks,

    -JP

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Setting the ACAD environment variable on launch

    FWIW - You can also modify the SupportPath Property of the PreferencesFiles Object.



    %RoamableRootPrefix% -

    Code:
    (getvar 'roamablerootprefix)


    %InstallFolder% -

    Code:
    (vl-load-com)
    
    (vl-registry-read
      (strcat "HKEY_LOCAL_MACHINE\\"
    	  (if vlax-user-product-key					; If 2013+
    	    (vlax-user-product-key)					; Use 2013+ function
    	    (vlax-product-key)						; Use legacy function
    	  )
      )
      "ACADLOCATION"
    )
    HTH
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Setting the ACAD environment variable on launch

    Thanks Blackbox,

    Issuing that code at the command line returns the correct path for my RoamableRootFolder.

    Beyond that, I'm a little out of my depth on this one. I assume its not as simple as adding the code (getvar 'roamablerootprefix) ahead of my code...
    Last edited by jpcadconsulting347236; 2014-04-02 at 06:04 PM.

  4. #4
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Setting the ACAD environment variable on launch

    I've had some success. I can get this to work:

    (setenv "ACAD"(strcat (getvar 'RoamableRootPrefix) "Support\\")

    However, I need to add other paths of course, and some of them need to be above this path... Which is not working. So, now its a syntax issue.

    Any help is appreciated.

    I'd love to modify the SupportPath Property of the PreferencesFiles Object... but that is right over my head.

  5. #5
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Setting the ACAD environment variable on launch

    Inspired by this, here's a quick excerpt from an old Civil 3D Acad.lsp file you can cull:

    Code:
    (vl-load-com)
    ;;;--------------------------------------------------------------------;
    (defun c:AcadLsp (/ *error*)
    
      (defun *error* (msg)
        (and cmdecho (setvar 'cmdecho cmdecho))
        (cond ((not msg))							; Normal exit
    	  ((member msg '("Function cancelled" "quit / exit abort")))	; <esc> or (quit)
    	  ((princ (strcat "\n** Error: " msg " ** ")))			; Fatal error, display it
        )
        (princ)
      )
    
      ((lambda
         (user cmdecho arxList arxFiles netFiles / oFiles acadLoc)
          (setvar 'cmdecho 0)
          (terpri)
    
          ;; Load arx utilities
          (foreach x arxFiles
    	(if (and (findfile x)
    		 (not (vl-position (vl-filename-base x) arxList))
    	    )
    	  (vl-catch-all-apply 'arxload (list x))
    	)
          )
    
          ;; Load net utilities
          (foreach dll netFiles
    	(if (findfile dll)
    	  (progn
    	    (terpri)
    	    (command "netload" dll)
    	  )
    	)
          )
    
          ;; Profile information
          (setq oFiles (vla-get-files
    		     (vla-get-preferences (vlax-get-acad-object))
    		   )
          )
    
          (setq acadloc
    	     (vl-registry-read
    	       (strcat "HKEY_LOCAL_MACHINE\\"
    		       (if vlax-user-product-key			; If 2013+
    			 (vlax-user-product-key)			; Use 2013+ function
    			 (vlax-product-key)				; Use legacy function
    		       )
    	       )
    	       "ACADLOCATION"
    	     )
          )
    
          (vla-put-SupportPath
    	oFiles
    	(vl-string-right-trim
    	  ";"
    	  (apply
    	    'strcat
    	    (mapcar
    	      '(lambda (x) (strcat x ";"))
    	      (list
    		;;<-- set custom enterprise path(s) here
    
    		;;<-- set custom user path(s) here
    
    		(strcat (getvar 'roamablerootprefix) "support;")
    		(strcat acadloc "\\civil")
    		(strcat acadloc "\\express")
    		(strcat acadloc "\\fdo\\bin")
    		(strcat acadloc "\\fonts")
    		(strcat acadloc "\\help")
    		(strcat acadloc "\\support")
    		(strcat acadloc "\\support\\color")
    		
    		;;<-- set additional default path(s) here
    
    	      )
    	    )
    	  )
    	)
          )
    
          (*error* nil)
       )
        (getvar 'loginname)							; User
        (getvar 'cmdecho)
        (arx)								; arxList
        '(									; arxFiles
          ;;<-- your .arx assemblies here
         )
        '(									; netFiles
          ;;<-- your .net assemblies here
         )
      )
    )
    ;;;--------------------------------------------------------------------;
    (c:AcadLsp)
    (prompt "\n... Acad.lsp for Civil 3D 20XX loaded. ")
    (princ)
    HTH
    Last edited by BlackBox; 2014-11-24 at 05:17 PM.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Setting the ACAD environment variable on launch

    Quote Originally Posted by BlackBox View Post
    Code:
    ;;; ...
    
          ;; Load arx utilities
          (foreach x arxFiles
    	(if (and (findfile x)
    		 (not (vl-position (vl-filename-base x) arxList))
    	    )
    	  (vl-catch-all-apply 'arxload (list x))
    	)
          )
    
          ;; Load net utilities
          (foreach dll netFiles
    	(if (findfile dll)
    	  (progn
    	    (terpri)
    	    (command "netload" dll)
    	  )
    	)
          )
    
    ;;; ...
    In 2012+, these two functions can be removed, and instead use the newer Autoloader Mechanism to manage such plug-ins... Autoloader can also handle LISP, CUIx, etc. but I still use Acad.lsp and AcadDoc.lsp for now.

    [spoilers removed]
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

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

    Default Re: Setting the ACAD environment variable on launch

    Quote Originally Posted by jpcadconsulting347236 View Post
    I am trying to set the search paths on launch by adding the following line to acad.doc
    I think you may mean "acad.lsp", not "acad.doc" (or "acaddoc.lsp"?, since there is no "acad.doc")

    Anyway, this may be worth a read also.
    R.K. McSwain | CAD Panacea |

  8. #8
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Setting the ACAD environment variable on launch

    I did. Good eye.

    Our IT swapped servers w/o telling me so I was kind of preoccupied...

    Thanks!!!

  9. #9
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Setting the ACAD environment variable on launch

    Boom! Working like a charm.

    Thanks very much gang!!!

Similar Threads

  1. Replies: 7
    Last Post: 2013-10-25, 08:27 PM
  2. 2011: How do I reset a user-created environment variable to be empty?
    By c.taylor in forum AutoCAD General
    Replies: 5
    Last Post: 2012-06-06, 02:12 PM
  3. environment variable for current page size
    By burchd in forum AutoLISP
    Replies: 1
    Last Post: 2008-05-27, 01:13 AM
  4. Is there an environment variable which controls hardcopy.log?
    By ralphsanchez in forum AutoCAD Plotting
    Replies: 0
    Last Post: 2008-02-11, 05:07 PM
  5. Setting up AutoCAD 2007 in a network environment
    By thomasf in forum AutoCAD Customization
    Replies: 5
    Last Post: 2006-12-08, 09:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •