My first LISP not working

My first LISP not working

Anonymous
Not applicable
2,355 Views
3 Replies
Message 1 of 4

My first LISP not working

Anonymous
Not applicable

Hi to everybody,

 

I just created my first lisp which works fine on previous versions of Autocad but not on 2017

(when I try to load it autocad say " unable to load lsp file.)

 

this is the code

 

(defun c:ZP ()
(command "ZOOM" "P")
)
(defun c:EL ()
(command "ERASE" "L" "")
)

 

 

 

any ideas?

 

Thanks in Advance.

0 Likes
Accepted solutions (1)
2,356 Views
3 Replies
Replies (3)
Message 2 of 4

john.uhden
Mentor
Mentor

Your code is fine.  You said there is trouble loading the file.  How are you trying to load it?

One way is to use the APPLOAD command where you browse for the file to load and can keep it in your history.

Another way is to use the load function, as in (load "<path>\\myfile.lsp").

The path is up to you, but notice the double backslashes.  You can use a single forward slash instead.

Or if the file is located anywhere in AutoCAD's search path, then you can just (load "myfile.lsp").

Actually you can leave out the file extension.  The load function can be used to load .LSP, .FAS, and .VLX files.

I typically include the file extension if my .LSP file is newer than its .FAS version that I may have created.

John F. Uhden

0 Likes
Message 3 of 4

Anonymous
Not applicable
Accepted solution

@john.uhden wrote:

Your code is fine.  You said there is trouble loading the file.  How are you trying to load it?

One way is to use the APPLOAD command where you browse for the file to load and can keep it in your history.

Another way is to use the load function, as in (load "<path>\\myfile.lsp").

The path is up to you, but notice the double backslashes.  You can use a single forward slash instead.

Or if the file is located anywhere in AutoCAD's search path, then you can just (load "myfile.lsp").

Actually you can leave out the file extension.  The load function can be used to load .LSP, .FAS, and .VLX files.

I typically include the file extension if my .LSP file is newer than its .FAS version that I may have created.


John thanks alot for your reply,

 

tha solution was to include the path of my lisp folder at the trusted locations in the Options menu.

 

I will use your tips about loading my my new lisp file.

 

Thanks

 

Message 4 of 4

dc0001
Contributor
Contributor

Thanks to both of you for the valuable info. I had the same problem and never would have figured it out on my own.

David Clendenen
Clendenen CADD
0 Likes