Jump to content

Recommended Posts

Posted (edited)

Hi everyone,

 

this is my first post on this site, long time AutoCAD user, somewhat new to LISP.

 

I was wondering if there was a step by step LISP guide, because so far I have found nothing and I have googled every combination I can think of. 

 

To get specific, I have found LISP scripts shared, all serving different purposes but nowhere can I see how to bring that information into AutoCAD. 

These are the steps I can take so far:

  • copy the lines of script into a .txt file
  • save the .txt as a .lsp file
  • use "Appload" in acad to bring the script in

 

This is where I get stuck. I have no idea how to run the routines once there. There is no command listed in the scripts themselves, there are no errors after using Appload. There are no tutorials on this pinned anywhere. Too many tutorials simply end it at the point where I get stuck. 

 

To get even more specific, I am trying to use this https://www.cadtutor.net/forum/showthread.php?80180-Deleting-Hatch-from-Blocks&p=542769&viewfull=1#post542769 

 

I have found nothing that says what you need to do to actually make the LISP routine do stuff. Please help me understand, even a link to a guide. Most posts here are just shared scripts and lines and I have no idea how to apply any of them. 

Edited by JimJames
changed "google" to "googled"
Posted (edited)

All the steps you've carried out to APPLOAD are correct. AutoLISP routines are indeed saved in a file with the .lsp extension. Depending on the nature of the contents of the script, the behavior after the APPLOAD command is invoked will vary. The last thing you need to do is invoke the command into the command line.

 

In AutoLISP, whenever you define a function using DEFUN, any name given to the function that prefixes with "c:" are the types of functions that you can call through the command line. In your example script, the function has been assigned the name "c:test". This means that, once you've loaded your LISP routine, you can begin by invoking "TEST" from the command line to execute the function. Whether the command is successful or not is a different story.

 

Here's a more detailed explanation in this link.

Edited by Jonathan Handojo
  • Like 2
  • Thanks 1
Posted
14 hours ago, Jonathan Handojo said:

All the steps you've carried out to APPLOAD are correct. AutoLISP routines are indeed saved in a file with the .lsp extension. Depending on the nature of the contents of the script, the behavior after the APPLOAD command is invoked will vary. The last thing you need to do is invoke the command into the command line.

 

In AutoLISP, whenever you define a function using DEFUN, any name given to the function that prefixes with "c:" are the types of functions that you can call through the command line. In your example script, the function has been assigned the name "c:test". This means that, once you've loaded your LISP routine, you can begin by invoking "TEST" from the command line to execute the function. Whether the command is successful or not is a different story.

 

Here's a more detailed explanation in this link.

Thank you, that's a great resource! 

Posted

Another is drag and drop a lisp from explorer.

 

But I would recommend if your serious look at a custom pop menu with all your lisps in it and load when required. 

 

image.png.fca1defc5e43aabeaeb744ddb263f5f5.png

Posted
36 minutes ago, BIGAL said:

Another is drag and drop a lisp from explorer.

 

But I would recommend if your serious look at a custom pop menu with all your lisps in it and load when required. 

 

image.png.fca1defc5e43aabeaeb744ddb263f5f5.png

 

How did you do this? I think I'd like to find out and implement it to my workplace.

 

I know a thing or two about using the CUI to make custom ribbons that invokes LISP commands and overriding keyboard shortcuts to the one I want to use, but what's this one?

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