Jump to content

Recommended Posts

Posted

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.

Posted

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 ...)) )

Posted
(vla-get-supportpath (vla-get-files (vla-get-preferences (vlax-get-acad-object))))

Posted

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)

Posted

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.

Posted

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.

Posted

Sorry, (AddSupportPath (appload-folder)) - function call

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...