Adding Lisp Files to a Tool Palette

If you have some lisp routines that you would like to have available when you are working in various drawings here is a way to have them available in all your drawings. This method of adding the .lsp files to a tool palette makes them available and will load them only when they are needed. Other methods like using an acad.lsp or acaddoc.lsp will load all the lisp files upon each drawing that you open and depending on how many lisp files you have may be a little slow.

First place your  lisp files and button images into a folder that will be a stable environment where it will not accidentally get moved or erased. Button images can be of various file types and sizes. In this example I have used 32×32 pixel bitmaps (.bmp).

Right click in the Tool Palette and select “New Palette” to place the new tools on. This will create a new tab on the tool palette… Give the new palette a unique name.

We now need to populate the new palette with content. The easiest way to do this is to simply drag something from the drawing area onto the palette and then modify its properties. Below, I have created a line and then dragged it onto the palette.

To change the tool’s properties from being just another line tool, right click and select “Properties”

The 5 areas below need to be changed in order for this tool to be the new custom tool:

  1. Give the tool a unique and meaningful name
  2. Give the new tool a meaningful description so that when you hover over the tool it will tell you what it does
  3. Change the “Use flyout” option to “No”
  4. Fill out the command string to specify the path to where the .lsp file resides and what the command call is in order to start the lisp routine.
  5. Give the new tool a cool new image/button

To define an image to use as the button, simply right click in the square area in the upper left and select “Specify image” and then browse to the image, select it and click ok.

 

Advertisement

About AutoCAD Tips

This blog serves as a knowledge base for myself (and anyone else) so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting/design experience better.
This entry was posted in AutoLISP, Customization, Manage, TIPS. Bookmark the permalink.

10 Responses to Adding Lisp Files to a Tool Palette

  1. Henrik says:

    Hi
    This is an exciting and interesting blog! I really like looking around in here;)
    Could you please help me out with a small autolisp code?
    I`d like to make a little program for inserting company logo to title blocks.
    When using the attach image command, there is so many steps to go through before the image gets placed.
    What I dream of is a small program that lets me click a button that sends me to a specified directory where I can select my image file, then the program just lets me place this image in the right place in title block in layout, prompting for nothing but insertion point.

    • AutoCAD Tips says:

      Hello,
      What you are basically describing is the same process for inserting a block. I don’t think that there is a way to bind a picture to a drawing but if you can bind one to a drawing, that would be the easiest way to go and then a simple lisp or macro that defines where the block is located on your computer or on the network can easily be made.
      the first thing to consider is whether the logo can be converted to autocad objects (lines, arcs, hatches…) At my previous employer, I would convert logos to blocks because they plot better and look better on PDFs. If you want, you can send me a pic of the logo and i will see if I can convert it for you. then we can make a lisp that inserts that block

  2. salih says:

    Thank you very much for everything SALIHI from Turkey

  3. Emilio says:

    Hello Greg,

    Just found your blog. Great info! I’m working on customizing tool palettes and was loading a lisp file. Tried using a relative path instead of a hard path. Couldn’t get it to work. Do you know if relative path should work in this situation?

    Thanks!

  4. Atul Vishwakarma says:

    sir
    Thanks for the tips .
    please give a tip to write user input string in to DCL
    Thanks & Regards
    Atul Vishwakarma

  5. Emad says:

    Thanks it is very helpfull

  6. Paula says:

    Very helpfull, thank you!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s