Jump to content

load lisp from tool palettes


jim78b

Recommended Posts

hello i want load a lisp from a custom path but with my code don't work why?

i create a newcommand and paste in to the tool palette

 

^C^C^( load "C:\Users\Utente\Dropbox\Lavoro\backup\AUTOCAD\Lisp\PURGE shape purge.lsp")

 

nothing happen

Link to comment
Share on other sites

I think you need double \\

 

^C^C^( load "C:\\Users\\Utente\\Dropbox\\Lavoro\\backup\\AUTOCAD\\Lisp\\PURGE shape purge.lsp")

 

Also might want to change it to.

^C^C^(load (strcat (getenv "userprofile") "\\Dropbox\\Lavoro\\backup\\AUTOCAD\\Lisp\\PURGE shape purge.lsp"))

This will allow other users to load this if Dropbox is installed in the same location. without having to edit the code for each user name.

Link to comment
Share on other sites

What does AutoCAD tell you when you try to run the command? For example if I paste it into the command line it tells me ";error: load failed:" which I would expect since the file path is not on my computer. Might give us a clue where it is all going wrong.

 

 

Link to comment
Share on other sites

1 minute ago, Steven P said:

What does AutoCAD tell you when you try to run the command? For example if I paste it into the command line it tells me ";error: load failed:" which I would expect since the file path is not on my computer. Might give us a clue where it is all going wrong.

 

 

keep typing command:

. nothing is happening

Link to comment
Share on other sites

2 minutes ago, Steven P said:

What does AutoCAD tell you when you try to run the command? For example if I paste it into the command line it tells me ";error: load failed:" which I would expect since the file path is not on my computer. Might give us a clue where it is all going wrong.

 

 

 

Immagine.png

Link to comment
Share on other sites

^C^C^(load (strcat (getenv "userprofile") "\\Dropbox\\Lavoro\\backup\\AUTOCAD\\Lisp\\PURGE shape purge.lsp"))

This only loads the lisp into AutoCAD. It doesn't run the lisp.

 

you need to look at the start of the lisp for something like

(defun C:RSHX () or what ever the command is.

from there you can do two things. either type the command into the command prompt to run it.

Or have this at the end of your lisp so when it loads it will automatically run itself.

(C:RSHX)

 

Example

 

(defun C:test ()
  (prompt "\nThis is a test")
  (princ)
)
(C:test)

 

Edited by mhupp
Link to comment
Share on other sites

2 minutes ago, mhupp said:

^C^C^(load (strcat (getenv "userprofile") "\\Dropbox\\Lavoro\\backup\\AUTOCAD\\Lisp\\PURGE shape purge.lsp"))

This only loads the lisp into AutoCAD. It doesn't run the lisp.

 

you need to look at the start of the lisp for something like

(defun C:RSHX () or what ever the command is.

from there you can do two things. either type the command into the command prompt to run it.

Or have this at the end of your lisp so when it loads it will automatically run itself.

(C:RSHX)

ok thanks , however only your code without launching command don't give me any message is right?

Link to comment
Share on other sites

^C^C^(load (strcat (getenv "userprofile") "\\Dropbox\\Lavoro\\backup\\AUTOCAD\\Lisp\\PURGE shape purge.lsp"))(C:RSHX)

 

autocad don't give me any message

Link to comment
Share on other sites

I think mhupp might have confused you, but that's OK.

 

Your original command ^C^C^(load (strcat (getenv "userprofile") "\\Dropbox\\Lavoro\\backup\\AUTOCAD\\Lisp\\PURGE shape purge.lsp")) loads into memory all the LISP routines saved within the file "PURGE shape purge.lsp".

 

There might be one, there might be a few.

 

Next step would be to open your file 'PURGE shape purge.lsp' and look through it (or do a 'find') for the start of each function, which will typically start with "(defun c:" until you find the function you want to run. Replace mhupps example (C:RSHX with the name of your function and not his example and try that.

 

Th part after the 'c' is the name of the LISP function and you will need to use (c:  +[LISP name] )

  • Agree 1
Link to comment
Share on other sites

23 minutes ago, jim78b said:

Ok sorry me for don't understand.  But only your edit code in command line prompt don't give me any message of load lisp file

 

Yes @Steven P probably didn't explain it properly. 

 

1. ^C^C^(load (strcat (getenv "userprofile") "\\Dropbox\\Lavoro\\backup\\AUTOCAD\\Lisp\\PURGE shape purge.lsp"))

   only loads the lisp.

2. Loading a lisp by default doesn't produce a message by default

3. if you already have the lisp loaded you only need to run the lisp then and should either be typed in the command prompt or

   ^C^C _lispcommand

 

if you want just upload your lisp file and Steven or I will fix it.

  • Like 2
Link to comment
Share on other sites

yes i understand but every time i click on my tool palette command give me:

 

Command:
Command:
Command:
Command:
Command:
Command:
Command:
Command:
Command:
Command:
Command:

Edited by jim78b
Link to comment
Share on other sites

OK, are you able to share your LISP routine, drag and drop "C:\Users\Utente\Dropbox\Lavoro\backup\AUTOCAD\Lisp\PURGE shape purge.lsp" using the 'drag files' option (bottom left of the message box here), then we can see what it contains and should be able to suggest what you need to do?

 

To me it sounds like AutoCAD is doing what you are asking it to do, but need to ask it a slightly different question,  we should be able to help you with that after seeing your LISP file 

 

  • Like 1
Link to comment
Share on other sites

MY LISP FILE WORK WELL IF I USE IT WITH AUTOLISP WINDOW, but i want use it when i want throught a command tool bar button, i think wrong type folder.thanks for patience

 

^C^C^(load (strcat (getenv "userprofile") "C:\\Users\\Utente\\Dropbox\\Lavoro\\backup\\AUTOCAD\\Lisp\\PURGE\\RSHX shape purge"))

s.png

Edited by jim78b
Link to comment
Share on other sites

hello i managed to make it work, thank you all from my heart!

 

(LOAD "C:/Users/Utente/Dropbox/Lavoro/backup/AUTOCAD/Lisp/PURGE/RSHX.lsp");RSHX;

 

many thanks

  • Like 1
  • Funny 1
Link to comment
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
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...