Adding LISP, VB apps, and more to Tool Palettes

by Donnie Gladfelter on January 22, 2008

in AutoCAD,AutoCAD 2006,AutoCAD 2007,AutoCAD 2008,AutoCAD 2009

image By now Tool Palettes have probably become a staple of your workspace.  We can put all sorts of things on Tool Palettes; lines and blocks being the most common.  While lines and blocks on tool palettes add a degree of sanity for many, wouldn’t it be nice if we could say add a LISP routine, VB app, even execute a script from a Tool Palette?

Well the good news is that we can, although the process isn’t necessarily obvious for many. 

  1. Create a new Line Tool: Simply draw a line in your drawing, and add it to the desired Tool Palette.

    image

  2. Adjust the Properties of your tool: Right-click on the tool, and select "Properties"

    image

  3. Define the Command: From the resulting "Tool Properties" dialog, you will want to give your tool a name and description.  Both of these can be anything you wish, as neither effects the tools function.

    What we’re most interested in is the "Command" grouping.  First you will want to disable the flyout feature by setting "Use Flyout" to "No".  Next you will want to specify the command you wish to execute.

    image

    • LISP: (LOAD "C:/LISP/sample.lsp");lisp command;
      The above code assumes my LSP file is located on my local C-drive in a LISP folder.  Do note the path mentioned in the above code is generally represented as "C:\LISP\sample.lsp".  For things to work on a Tool Palette we must reverse the slash from a "\" to a "/".

    • SCRIPT:  You can execute just about any script you want.  The trick here is the use a semicolon (;) in place of line breaks.  The final result will be a single-line script.

    • VBA: (COMMAND "-VBARUN" VBAPath " ")

  • thon

    good day! hope u help me. how to contour the area by using autocad need for my company, pls help me coz im fresh grad.

    • http://thecadgeek.com/ Donnie Gladfelter

      @ Thon – I’m not sure your how question relates to this post, or even what you’re trying to accomplish. You can certainly draw contours manually using AutoCAD. To get something a little more automated you’ll want Civil 3D which understands triangulation (DTM). Feel free to e-mail me if you’ve got some additional questions.

  • Ramin

    Hi guys i have a question.
    so if anyone can help it would be much appreciate, im trying to create a circular view port using ACAD LT 04 but thers just no way its going to happen as the LT version doesnt have the option to convert object to viewport. so im wondering if ther would be some way of cheating.. lol .. maby using command line code to make a lil script for it.
    and adding it to the toolbars.
    thanx for taking the time to read this.
    Ramin.
    Scotland

  • Ramin

    Hi guys i have a question.
    so if anyone can help it would be much appreciate, im trying to create a circular view port using ACAD LT 04 but thers just no way its going to happen as the LT version doesnt have the option to convert object to viewport. so im wondering if ther would be some way of cheating.. lol .. maby using command line code to make a lil script for it.
    and adding it to the toolbars.
    thanx for taking the time to read this.
    Ramin.
    Scotland

  • Pingback: Revit Architecture India » Creating & Using Blocks With Multiple Insertion Points

  • Devesh

    blogger !
    I have a problem during opening a drowing file in Acad 08 containing some objects which refers to AutoCad Mechenical desktop.
    what should I do.

  • Devesh

    blogger !
    I have a problem during opening a drowing file in Acad 08 containing some objects which refers to AutoCad Mechenical desktop.
    what should I do.

  • http://www.thecadgeek.com Donnie Gladfelter

    @Ramesh – I don’t have a lot of programming posts on here (yet at least). I would refer you to the AutoCAD LISPWiki (www.LISPWiki.com), and the Through The Interface Blog (http://blogs.autodesk.com/through-the-interface) as starting points.

  • http://thecadgeek.com/ Donnie Gladfelter

    @Ramesh – I don’t have a lot of programming posts on here (yet at least). I would refer you to the AutoCAD LISPWiki (www.LISPWiki.com), and the Through The Interface Blog (http://blogs.autodesk.com/through-the-interface) as starting points.

  • Ramesh

    i want to do lisp programming for developing some tools for my companycan u help in such. tools like i required to develop is that using VB with Autocad BG so that tools can be used as customised once

    thank u
    Ramesh
    Banglore
    prk8652@gmail.com

  • Ramesh

    i want to do lisp programming for developing some tools for my companycan u help in such. tools like i required to develop is that using VB with Autocad BG so that tools can be used as customised once

    thank u
    Ramesh
    Banglore
    prk8652@gmail.com

Previous post:

Next post: