Stevery Posted March 27, 2018 Share Posted March 27, 2018 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 Quote Link to comment Share on other sites More sharing options...
ziele_o2k Posted March 27, 2018 Share Posted March 27, 2018 If you whant to run lisp from command line without brackets () make changes in your lisp file with following schema: (defun [color="red"]c:[/color]drawline ... lisp code ) something about that here: https://stackoverflow.com/questions/39059744/the-use-of-and-in-autolisp/48774394#48774394 Quote Link to comment Share on other sites More sharing options...
Stevery Posted March 27, 2018 Author Share Posted March 27, 2018 If you whant to run lisp from command line without brackets () make changes in your lisp file with following schema: (defun [color="red"]c:[/color]drawline ... lisp code ) something about that here: https://stackoverflow.com/questions/39059744/the-use-of-and-in-autolisp/48774394#48774394 Thank you ziele Quote Link to comment Share on other sites More sharing options...
BIGAL Posted March 28, 2018 Share Posted March 28, 2018 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. Quote Link to comment Share on other sites More sharing options...
Grrr Posted March 28, 2018 Share Posted March 28, 2018 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.