dilan Posted April 1, 2018 Posted April 1, 2018 Hello everybody. Is it possible to implement this? I load the program into the autocad, the program determines from which folder I load it, and this folder is added to the support file search paths. Quote
marko_ribar Posted April 1, 2018 Posted April 1, 2018 There is some sort of implementation for Bricscad AFAIK. If you are using APPLOAD for loading or NETLOAD for dlls I doubt it is possible... If you copy+paste lsp file into CAD interface, then my thinking is that you could use LOGFILEON command prior, search for *.log file - look into (getvar 'LOGFILENAME), then do LOGFILEOFF and after you look into *.log, perhaps you could find path by using (setq fn (open "....log" "r")) and (while (setq li (read-line fn)) ... (setq path (substr li ...)) ) Quote
marko_ribar Posted April 1, 2018 Posted April 1, 2018 Another option, but you should have installed DosLib... Not sure if there is version for Civil3D... https://www.theswamp.org/index.php?topic=15913.msg192972#msg192972 (vl-filename-directory (last (dos_lisplist t))) Quote
marko_ribar Posted April 1, 2018 Posted April 1, 2018 (vla-get-supportpath (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) Quote
BIGAL Posted April 1, 2018 Posted April 1, 2018 You also need to add trusted location as you have 2017 (setq *files* (vla-get-files (vla-get-preferences (vlax-get-Acad-object)))) (setq paths (vla-get-SupportPath *files*)) (setq pathsnew "newsupportpath;") (setq newpath (strcat pathsnew paths)) (vla-put-SupportPath *files* newpath) ; trusted path is a setenv (setq paths (strcat pathsnew (getenv "trustedpaths"))) (setenv "trustedpaths" paths) Quote
Grrr Posted April 2, 2018 Posted April 2, 2018 I was having the same question, but the closest thing I found was to determine the last appload folder. Quote
Roy_043 Posted April 2, 2018 Posted April 2, 2018 AutoCAD does have the vl-list-loaded-vlx function. Quote
BIGAL Posted April 3, 2018 Posted April 3, 2018 The other way is to have a lisploader as a alternative to appload. Just find the file you want to load change the preferences then use a (load myprogram) (setq fname "P:\autodesk\mylisps\Add-to-levels-multi.lsp") ; check if path exists if not add (setq fname "Add-to-levels-multi.lsp") ; lisp file name to be loaded no path required (load fname) ; loads lisp file and now runs new lisp file. Quote
dilan Posted April 3, 2018 Author Posted April 3, 2018 I got something like this: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (SL_AddSupportPath (appload-folder)) - function call ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun AddSupportPath (dir / tmp Cpath Path) (vl-load-com) (setq Path (appload-folder)) (setq Cpath (getenv "ACAD") tmp (strcat ";" dir ";") ) (if (not (vl-string-search dir cpath)) (setenv "ACAD" (strcat Cpath ";" dir)) ) (princ) ) ;----------------------------- (defun appload-folder () (vl-registry-read (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar 'cprofile) "\\Dialogs\\Appload" ) "MainDialog" ) ) ;----------------------------- It seems everything works, the folder from which I load the program is added SupportPath. Please look, maybe there needs to be something to fix? I mean, this code could not be done correctly. Quote
dilan Posted April 4, 2018 Author Posted April 4, 2018 Sorry, (AddSupportPath (appload-folder)) - function call Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.