Jump to content

How to run a lisp correctly?


Stevery

Recommended Posts

Hello,

 

 

I've never used lisps in AutoCAD before so thought I would try it out.

 

 

I googled how to run a lisp - the process I used can be seen in the attached image command history.

Could anyone please point out where I went wrong?

 

 

The command I loaded, is the one from the Sample > Visual Lisp folder.

 

 

 

 

 

 

EDIT: Turns out I was using the incorrect command.

I was looking at "defun drawline" assuming that drawline was the command, when I should have been looking at "Usage: (drawline)"

 

 

 

 

Thanks

Drawline Lisp.jpg

Link to comment
Share on other sites

If you want these lisps to be available all the time do a bit of googling about start up lisps or as a start add your lisp to the end of ACADDOC.LSP then you do not have to load it all the time. For us we use menu's and toolbars to load lisps as required plus a lot already pre-loaded.

Link to comment
Share on other sites

Hi,

First priority is to check inside the .lsp file for: "(defun C:something", where you rename "something" to whatever command name you want.

 

Second way that won't always work (because you probably can't see the overall picture) is what ziele_o2k described.

 

Wont work always because you might try to turn a subfunction that accepts arguments into a main function:

(defun Drawline ( p1 p2 ) [color="seagreen"]; subfunction that accepts two arguments[/color]
 ; ..
)

 

Turn the above subfunction into main:

(defun C:Drawline ( p1 p2 ) [color="seagreen"]; subfunction converted into main[/color]
 ; ..
)

 

Then you should get the following error (because its expecting two arguments) :

 

Error: too few arguments

 

Turn the above subfunction into main and turn its arguments into variables:

(defun C:Drawline ( / p1 p2 ) ;[color="seagreen"] subfunction converted into main and that doesn't expecting any arguments[/color]
 ; ..
)

Now the function won't expect any arguments so in theory you should be fine,

but depending on how its written, you have a big chance to get errors similar to these:

 

Error: bad argument type: stringp nil

Error: bad 3D point: nil

 

So the second priority should be to just ask here on the forum, by posting the code you are using / source link + author.

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