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:
- Give the tool a unique and meaningful name
- Give the new tool a meaningful description so that when you hover over the tool it will tell you what it does
- Change the “Use flyout” option to “No”
- 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.
- 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.
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.
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
Thank you very much for everything SALIHI from Turkey
I’ll follow you, always :)
You are very welcome. I am happy that you find this blog helpful
~Greg
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!
sir
Thanks for the tips .
please give a tip to write user input string in to DCL
Thanks & Regards
Atul Vishwakarma
Thanks it is very helpfull
Reblogged this on Geaux CAD.
Very helpfull, thank you!