Jump to content
K Baden

Tool Palette Support Path LISP

Recommended Posts

K Baden

Good morning all,

 

I currently have the below LISP routine which successfully adds the file path i want to add, the only problem is, it deletes the default C drive path that exists. Is there an easy way to just add this path on top of the original default path? I am deploying some palettes to my team but want to ensure that if they already have their own elsewhere, it doesn't delete that path. 

 

Any ideas? i just want it to be in addition to any existing paths, rather than overwriting what someone may have there. 

 


(defun C:TPPATH ()
(setq pFiles (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) ;;get file preferences
(setq tpPath "-insert new file path here-") ;;set your path here
(vla-put-toolPalettePath pFiles tpPath) ;;set tool palette path
   
   (princ)
)

 

Share this post


Link to post
Share on other sites
dlanorh
28 minutes ago, K Baden said:

Good morning all,

 

I currently have the below LISP routine which successfully adds the file path i want to add, the only problem is, it deletes the default C drive path that exists. Is there an easy way to just add this path on top of the original default path? I am deploying some palettes to my team but want to ensure that if they already have their own elsewhere, it doesn't delete that path. 

 

Any ideas? i just want it to be in addition to any existing paths, rather than overwriting what someone may have there. 

 


(defun C:TPPATH ()
(setq pFiles (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) ;;get file preferences
(setq tpPath "-insert new file path here-") ;;set your path here
(vla-put-toolPalettePath pFiles tpPath) ;;set tool palette path
   
   (princ)
)

 

 

You are replacing the existing with the new. You needed to go a bit deeper.

 

Try this

 

(defun C:TPPATH (/ pFiles tpPaths tpPath)
	(setq pFiles (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) ;;get file preferences
  	(setq tpPaths (vlax-get-property pFiles 'toolpalettepath)); Get the current path(s)
	(setq tpPath "-insert full new file path here-") ;;set your path here eg "C:\\Users\\....."
	(vla-put-toolPalettePath pFiles (strcat tpPaths ";" tpPath)) ;;add your new path to the string dividing paths with a ";"  
   	(princ)
)

 

  • Like 1

Share this post


Link to post
Share on other sites
BIGAL

Like dlanorh there are a number of paths that can be multiples in the preferences so the strcat is the way around it. If you want a bit more bullet proof would check if that path exists 1st else will add every time you run.

Share this post


Link to post
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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