Adding a support path using Autolisp in AutoCAD LT

Adding a support path using Autolisp in AutoCAD LT

brbowen
Contributor Contributor
2,123 Views
10 Replies
Message 1 of 11

Adding a support path using Autolisp in AutoCAD LT

brbowen
Contributor
Contributor

This works fine in regular AutoCAD but not in AutoCAD LT 2024 version. Any ideas?

(setq NEW_PATH "C:\\NEWPATH\\")

(setenv "ACAD" (strcat (getenv "ACAD") ";" NEW_PATH))

 

 

0 Likes
Accepted solutions (2)
2,124 Views
10 Replies
Replies (10)
Message 2 of 11

paullimapa
Mentor
Mentor

Works for me but with these modifications 

(setq NEW_PATH "C:\\NEWPATH;”)

(setenv "ACAD" (strcat (getenv "ACAD") NEW_PATH))


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 11

pendean
Community Legend
Community Legend

@brbowen 

... and in LT versions of AutoCAD, SETENV is a Windows Registry Edit type built-in command, developed before 2024 to allow for some simpler customizations in macros etc.

pendean_0-1683145185857.png


Remember, LT is still LT, whether they added LISP or not, many limitations and exclusive commands still remain.

0 Likes
Message 4 of 11

brbowen
Contributor
Contributor
This works for adding Trusted Paths in AutoCAD LT. Is something similar for adding to the support paths since the other one does not work in LT?

(setvar "trustedpaths" NEW_PATH)
0 Likes
Message 5 of 11

paullimapa
Mentor
Mentor
Accepted solution

if you're referring to the Options>Files>Support File Search Paths, then use this code:

(setq files (vla-get-files (vla-get-preferences (vlax-get-acad-object))))
(vlax-put-property files 'SupportPath (strcat (vlax-get-property files 'SupportPath) ";C:\\NEWPATH"))

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 6 of 11

brbowen
Contributor
Contributor
Accepted solution

That is exactly what I needed works great.

I'm from the old school before VLISP, so I'm not very familiar with all the vla functions.

Thanks again for your help.

0 Likes
Message 7 of 11

paullimapa
Mentor
Mentor

Just start getting your feet wet and soon you’ll be up and running doing vl functions left and right….cheers.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 8 of 11

Sea-Haven
Mentor
Mentor

You can get way more variables that you can SET, we have a "set paths" lisp so when load a new version of cad just run it and all the paths, printer, temp directories, qnew and much more are set, and yes custom menu's loaded.

 

Try this

(vlax-dump-object (vla-get-files (vla-get-preferences (vlax-get-Acad-object))) T)

 

Happy to provide more detail.

Message 9 of 11

traci_haberghamJQEJT
Enthusiast
Enthusiast

Hi there, I'm looking at trying to set up a 'standard' profile on Autocad LT for new deployments and think this would be great to set up the support files, etc...   Is this something that is easy to do if I have all the path names for the different settings?  Thank you

 

(includes support path files, trusted locations, printer support file paths, template settings and tool palette file locations)

0 Likes
Message 10 of 11

Sea-Haven
Mentor
Mentor

Something like this 

; resets the paths usefull for update versions of Autocad
; by AlanH 2011
; This sets a reference to the install path of your product
; the gets are their for info maybe other use
; use this to find other settings 
;(vlax-dump-object (vla-get-files (vla-get-preferences (vlax-get-Acad-object))) T)



(vl-load-com)
(defun setpaths ( / *files* doc) 
; make temp directory
(if (vl-file-directory-p "C:\\Acadtemp\\")
(Princ "Acadtemp exists")
(vl-mkdir "C:\\AcadTEMP\\")
)


(setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-Acad-object))))

; savepath
;(vla-get-AutoSavepath *files*)
(vla-put-AutoSavepath *files* "C:\\AcadTemp")

; custom icons
;(vla-get-CustomIconPath *files*))
(vla-put-CustomIconPath *files* "L:\\Autodesk\\ICONS")

; custom menu
;(vla-get-Menufile *files*))
;(vla-put-Menufile  *files* "C:\\Users\\2013xxx")

; printers config
;(vla-get-PrinterConfigPath *files*)
(vla-put-PrinterConfigPath *files* "L:\\AutoDESK\\Plotting\\Plot Styles 2011")

; printers style sheet
;(vla-get-PrinterStyleSheetPath *files*)
(vla-put-PrinterStyleSheetPath *files* "L:\\AutoDESK\\Plotting\\Plot Styles")

; printer drv's
;(vla-get-PrinterDescPath *files*)
(vla-put-PrinterDescPath *files* "L:\\AutoDESK\\Plotting\\Drv")

; print spooler
;(vla-get-PrintSpoolerPath *files*)
(vla-put-PrintSpoolerPath *files* "C:\\AcadTemp\\")

; template  path
;(vla-get-TemplateDwgPath *files*)
(vla-put-TemplateDwgPath *files* "L:\\Autodesk\\c3d Templates")

; template location
;(vla-get-QnewTemplateFile *files*)
(vla-put-QnewTemplateFile *files* "L:\\Autodesk\\c3d Templates\\xxxx-2019.dwt")

;make new support paths exist + new
(setq paths (vla-get-SupportPath *files*))
(setq XXXXpaths "L:\\autodesk\\supportfiles;L:\\autodesk\\lisp;L:\\autodesk\\fonts;")
(setq newpath (strcat XXXXpaths paths))
(vla-put-SupportPath *files* newpath)

; Tempdirectory 
;(vla-get-TempFilePath *files*))
(vla-put-TempFilePath *files* "C:\\AcadTemp\\")

;   PlotLogFilePath = "C:\\Documents and Settings\\YYYY.XXXX-AD\\localsettings\\application data\\autodesk\\c3d 2011\\enu\\"
(vla-put-PlotLogFilePath *files* "C:\\AcadTemp\\")

;   LogFilePath = "C:\\Documents and Settings\\YYYY.XXXX-AD\\localsettings\\application data\\autodesk\\c3d 2011\\enu\\"
(vla-put-LogFilePath *files* "C:\\AcadTemp\\")


; xref temp path
;(vla-get-TempXrefPath *files*))
(vla-put-TempXrefPath *files* "C:\\AcadTemp\\")

; end use of *files*

(setq oldtrust (getvar 'trustedpaths))
(setq newtrust (strcat oldtrust ";" "L:\\Autodesk..."))
(setvar 'trustedpaths newtrust)

(princ "All Done")
) ; defun

(setpaths)

(alert "Run user script for toolbars")

; exit quitely

And

(alert "\nSupport and trusted paths added")

(setq Menu_Path "C:\\XXX-CAD-TOOLS\\") ; Path to Menu file
(setq Menu_Name "XXX-CAD-TOOLS") ; pop menu to load
(setq Group_Name "XXXMENU") ; groupname assigned in .mnu or .mns file

(if (menugroup menu_Name)
(command "_MENUUNLOAD" menu_Name)
)
(setq cnt (vla-get-count(vla-get-menuGroups (vlax-get-acad-object))))

(command "MENULOAD" (strcat Menu_Path Menu_Name ".mnu"))
(menucmd (strcat "P" (rtos (+ cnt 1) 2 0) "=+" menu_Name ".POP1"))


(setvar "menubar" 1)
0 Likes
Message 11 of 11

traci_haberghamJQEJT
Enthusiast
Enthusiast

Thank you, thats great.  I'll give it a go  🙂

0 Likes