Browse and download AutoLISP Code and functions.
 
Submit your AutoLISP Code and Tips
 

 

AutoLISP

 

 

Descriptions

 

FindReplace is a text utility to find and replace text in the current drawing or in all open drawings. FindReplace.lsp requires the functions inside of OpenDwgsCmds.lsp, OpenDwgsCmds.dvb, Dcl_Tiles.lsp, Dcl_Tiles.dcl and GetIcon.lsp.

 

Copies previous global selection set at distance and angle. Similar to the array rectangular command. With the COP program hold you finger on the [Enter] button and watch the objects copied and release when you've copied as many as you need. Other options are "N" for New selection or you can change the angle and distance.

 

PlotDwgs is a plot utility program with several unique options including plotting all open drawings, and plotting a folder of user selected drawings. Drawings may be plotted to a specified size, or by selecting the "Varies" option, the program determines the correct paper size to plot. Also included is the option of plotting all layouts in reverse order, and plotting a folder of user selected drawings in reverse order. The associated files are PlotDwgs.lsp, PlotDwgs.dcl and PlotDwgs.dvb.

 

DPL, Dimension Polylines, is similar to the Quick Dimension command but it only requires one pick. It can be further customized per your requirements in the DimPL function in the code. DPL also includes GetDimLayer which returns the layer name that's on and has the most dimensions, or the current layer name if there are no dimensions in the drawing.

 

GetExcel is a general purpose function for (Excel to AutoCAD) and (AutoCAD to Excel) applications. Special credit to Gilles Chanteau from Marseille, France for his sub-functions ColumnRow, Alpha2Number and Number2Alpha. The syntax for the functions are easy to follow and include documentation of the conditions of each argument in the function headings.

 

The Win_Sort function sorts a list of strings or filenames very similar to the way Windows sorts files in folders. It may be used to display filenames in a dialog list, and may also be used in a plot script function to plot a folder of drawings in the Windows sorted order other than just the acad_strlsort order. Also included are the dependant functions number_sort, change_nth and delete_nth.

 

Paul Silva

Here are a few grdraw example functions by Paul Silva. Function 66 draws an animated rolling ball between two splines or curved polylines, one above the other. Function 55 makes a dynamic grid with arrows rotating as the cursor moves across the screen.

 

ProgressBar contains a set of functions that can be used in loops while processing information. The main functions are ProgressBar, Progress, and EndProgressBar. There are a few example functions to demonstrate the syntax and method of using ProgressBar. PB-Demo is an example for an information message only. PB-Demo1 is an example for a foreach loop. PB-Demo2 is an example for a repeat loop. And PB-Demo3 is an example for a while loop.

 

Paul Silva has submitted his AutoLISP games Roulette and Puzzle. Check out his creations and have fun playing them. He also has a few other games that he's working on.

 

Bevel.lsp creates Bevel Dimensions. The dialog function c:BVS, for Bevel Settings, allows the user to customize various Bevel settings. The command functions c:BV and c:Bevel draw a Bevel Dimension. Included is the programming function BV to draw a Bevel. The function Bevel calculates the bevel based upon radian angle of slope. Bevel.lsp requires the functions inside of GetIcon.lsp, Dcl_Tiles.lsp and Text-Box.lsp. The associated files are Bevel.lsp and Bevel.dcl.

 

The GetButtons functions have been added to GetIcon.lsp. You can customize the names of up to 5 buttons. The message may be up to 10 lines. The message and button names may be customized as you wish including other languages.

 

GetVectors is a tool for quickly creating dialog images from AutoCAD entities. Use ViewVectors to view the images. The image and dialog files created by GetVectors may be pasted into your own programs and modified as needed.

 

Troy is an Asteroids AutoLISP game driven by the grread function. It can be run inside of an existing drawing. When it's finished, it purges all entities, styles and layers it created. You have three ships to use to shoot down as many Troys as possible. Press Q to quit the game before it ends.

 

Troy-I.lsp has been modified by Vladimir Michl to run on international versions of AutoCAD. It works fine in AutoCAD 2007 Czech. Please visit his website CadStudio for other games and utilities at http://www.cadstudio.cz/en/?lang=en.

 

LspCom and DclCom are a set of compression utilities to compress AutoLISP and Dialog files. The format of the compressed file makes it difficult for the casual user to edit or modify your AutoLISP and Dialog files.

 

DrawExcel is designed to draw basic spreadsheets without merged cells. Adjust the range for the Starting and Ending cells to not include merged cells. Headings and Titles can later be added in AutoCAD. Save the Excel spreadsheet in the view that you want to draw. Then close Excel. DrawExcel requires functions inside of GetIcon.lsp. The associated files are DrawExcel.lsp and DrawExcel.dcl.

 

Dcl_Tiles R12 is a set of utilities and functions for AutoLISP and DCL dialog control based upon the Dcl_Tiles dialog control method. Several of the edit and list functions allow the user to add or edit in both architectural and decimal formats. It includes the function tabs_tile, which displays displays tabs in an image tile, and the function vector_text that displays text in an image tile. Also included is the Progress_Bar function along with other useful dialog control functions. Dcl_Tiles requires functions inside of GetIcon.lsp. This revision the TitleBar$ variable was added to customize lists with Other. Revised ListArch to return a real number string and revised List functions to ignore blanks if included in a list.

 

AutoCAD Messenger uses the Windows Messenger Service to send and receive messages between AutoCAD users on a network or server. Messenger requires a few installation steps, such as customizing the global variables *Shared_Folder$, *Login_Exceptions@, and *Login_Displayname@. The associated files are Messenger.lsp, and Messenger.dcl.

 

kitoX Toolset is 100% free. For a description of the kitoX Toolset application visit http://www.kitox.com/kitoxtools_en.php. A direct download is available at http://www.kitox.com/downloads/kitox-toolset.zip.

 

Paul Silva

This routine selects lines and breaks them into 3 equal lengths. The middle length is erased and replaced by two other lines with a 60 degree inclination forming a triangle. Once finished, repeat routine to continue with the same procedure, doing a fractal. It is best if you have a polygon or some symmetrical shapes. All polylines must be exploded into line segments.

 

Groups has several functions to create, explode, and purge unused groups quickly. It also includes the function UniqueName, which creates a unique name based upon the date and time it was created.

 

TAM matches Text, Mtext and Attribute Text with the selected Text, Mtext or Attribute Text. Great for updating old text Bill of Materials into a new block attribute text format. You can copy any Text, Mtext or Attribute Text string into another Text, Mtext or Attribute Text string without having to re-type the text. Also included is TM.lsp, Text Match, which allows you to copy Text and Mtext to and from Text and Mtext, and you may select many objects to replace the match string with.

 

Text-Box draws a polyline Text Box outlining Text, Mtext and Dimensions. The polyline can be offset a certain distance to use to trim other objects. A label can be created by rounding the corners of the rectangle. It can also be used to calculate the widths for columns for a Bill of Material or a Table of information.

 

DimStyles has been revised for Architectural ticks. The dialog displays the Dim Scale, Architectural Scale, Text Height, and the Mview Zoom Scale. The user only needs to select one of the common Scales from a dropdown list or enter another scale as needed. It creates and sets Dimension Styles for Linear, Angular, Diameter, Ordinate and Radial styles. DimStyles.lsp may be easily customized by editing the SetDimVars function, and in the "Exceptions to SetDimVars" areas. DimStyles requires functions inside of GetIcon.lsp and Dcl_Tiles.lsp.

 

The Dimension Leader function includes the option of horizontal or vertical Mtext, and is justified as upper right or upper left based upon the users choice of text direction. The user picks the leader from and to points, the direction of text, and then fills in the Mtext information. The function adjusts the leader to align with the top line of the Mtext, using the user's selected points. The user may easily add or delete Mtext lines without affecting the location of the leader.

 

Dimension Match and Update utility that should have been included with the AutoCAD's Match Properties command. DM makes the current dimension style based on the dimension selected. You may then update other dimensions, text or mtext to that style, or continue dimensioning using the style of the selected dimension.

 

Search is a utility that searches for a word or phrase in files in a folder and shows the filename and the lines where the word or phrase was found. Unlike the Windows Explorer Search, you do not have to open every file and do a find again to see where the word or phrase occurred. From a programming standpoint, it is useful for finding the occurrences and syntax of certain functions. Search requires functions inside of GetIcon.lsp.

 

Block Library has been revised to be compatible with AutoCAD 2008. The dialogs with slide images have been redesigned and enlarged to accommodate space for longer block names. Block Library is an AutoLISP utility for managing blocks by storing blocks and block slides images in Block Libraries. The block slide images can be quickly viewed in the Block Libraries before inserting them into a drawing. Blk_Lib requires functions inside of GetIcon.lsp.

 

Icons of the Crazy Cartoon Guys to be used by the GetIcon.lsp Get? functions. These icons were created by GetVectors.lsp. Use any of the icon names displayed by the c:Cartoons function as an icon for the GetIcon.lsp Get? functions.

Slides of the Crazy Cartoon Guys that may be used by the Match Slides game in Block Library. After loading Blk_Lib.lsp type "Match" or "Mat" to run the game.

Juan Lavric

LITIO.lsp is a program for designing and unfolding of sheet metal parts such as ducts, rectangle to round transitions, cylinders, cones, pipe intersections, connections, bifurcations, elbows, etc. It is intended for applications for HVAC, hoppers, cyclones, dust extractions, ducts, conveying systems, silos, piping, etc. Make your developments directly in AutoCAD 2000 or later with no need of DXF conversions.

 

Aaron Strom

Watson4 is a productive AutoCAD tool! With the addition of LOOKDB to look at drawings in a batch, and some sorting revisions, Watson4 can be used as a detail referencing agent. Visit website for more information, and to download a trial version.

 

ViewDcl is a very useful utility for viewing dialogs within dcl files, as you are designing them or just need to view or compare other dialogs. If this type of utility is not part or your preferred AutoLISP and Dialog editor, it is a great utility to have. It can be run on the command line without loading any editor, by just typing "ViewDcl" or the shortcut "Dcl".

 

OpenDwgsCmds is a set of functions designed to execute a list of commands and functions on all open drawings. The CDC function, Current Drawing Commands, allows you to test these commands and functions on the current drawing. The ODC function, Open Drawings Commands, executes these commands and functions on all open drawings. There are several programming utilities included.

 

SayIt is a utility that allows AutoCAD to speak using the Windows speech program. The applications are up to your imagination, and can also include dialog messages. Included is an example to add to your AcadDoc.lsp file that will be executed when AutoCAD starts up.

 

Scrs is a Script Creator utility that allows you to create scripts on the fly. You can test your script in the current drawing before running it on a folder of drawings or dxf files. The script is saved as C:\Temp\Temp.scr. The associated files are Scrs.lsp and Scrs.dcl.

 

MatInv.lsp includes a few associate list functions by Tihomir Bojanic from Novi Sad, Serbia.

 

DelDupLine.lsp by Tihomir Bojanic deletes duplicate and small lines within a defined length passed to the function. Use the c:TestDL function to test out DelDupLine.lsp.

 

Tips

 

 

Descriptions

 

In the tutorial for "Getting Started with Dcl Dialogs", there are examples of all of the basic dcl tiles with an accompanying AutoLISP program to load and control the dialogs. The approach is learning by examples. The tutorial is intended for all AutoLISP programmers, from the novice to the advanced. AutoLISP programmers will find DclCalcs very beneficial while designing dialogs. Additional utilities are included to enhance the programming and control of Dcl Dialogs.

 

The Ultimate AutoLisp Tutorial by Jeffery P. Sanders is a very comprehensive tutorial that covers all aspects of AutoLISP. From opening notepad, writing your first program, saving your first program, to executing your first program and checking the variables inside AutoCAD. This tutorial covers it all step by step.

 

The AutoLISP Tutorial - Dcl by Jeffery P. Sanders covers all of the basic tiles including the row, column, image, button, edit_box, list_box, popup_list, radio_button, text, and the toggle tiles.

 

Phillip Norman

DclDemo06 is a dcl dialog demo program written by Phillip Norman. Among some of its main features are examples of how to use some common dcl dialog tiles and the AutoLISP code to drive them, how to make two clusters of radio_buttons behave as one cluster, how to align list items in columns in a list_box, and how to use the system registry to store the dialog box screen location. For additional information open the Readme.txt file.

 

Jos Van Doorn is an AutoCAD specialist and AutoLISP programmer. He is the publisher of the ACAD Newsletter. For a free subscription submit your information to the ACAD Newsletter.