AutoLISP functions developed by realer than real

Updated February 16, 2014

The AutoLISP functions below are provided free for your use, enjoyment, and edification, with these restrictions:

  1. Please do not post these functions online (including web sites, ftp sites, bulletin boards, and other online services) for public downloading. Instead, direct others to this page so they can get the most current versions.
  2. If you modify these routines in any way, please do not ask us for help when they don't work the way you want.
  3. Lastly, please do not submit these functions or modified versions thereof as your own work in any competitions where there might be prizes, T-shirts, or even just bragging rights. Thanks!

Disclaimer:

No warranty is either expressed or implied as to the fitness of this information for any particular purpose. By downloading and/or using these files, you assume all liability for any damages arising out of the use or operation of, or inability to use, any information available here. All materials are to be considered 'as-is', and use thereof should be considered as at your own risk.

Compatibility:

Most of these functions use the Visual LISP functions loaded by (vl-load-com), which became available with AutoCAD 2000. If you use an earlier version of AutoCAD, contact us to see if the routine(s) you need can be retrofitted to your version. Needless to say, none of these routines work in any version of AutoCAD LT, and they have not been tested with non-Autodesk applications such as Bricscad, IntelliCAD, TurboCAD, DRCauto, etc.

These functions have been tested with AutoCAD 2006, 2008, and 2010, and their architectural vertical applications (ADT and ACA). The "Compatibility" column will note compatibility issues with other versions of AutoCAD, if known. These functions have not been tested for compatibility with other vertical Autodesk applications (Civil, Electrical, Map, Mechanical, etc.).

These functions use available tools wherever possible. So, where Autodesk utilities like Express Tools and third-party utilities such as DOSLib are required, this will be noted in the "Compatibility" column. The Express Tools functions are included on the AutoCAD distribution CD/DVD, but are not automatically installed -- that's up to you. DOSLib is available for free download from Robert McNeel & Associates.

If you encounter compatibility or usability problems with these functions with any version of AutoCAD, please let me know by email and I'll see what I can do.

Donations

These routines below are free, and I hope will always remain so. However... if they save you time or make possible what was not possible before, or simply delight your soul and fire your imagination, modest contributions are very welcome. The link below will get you to the Paypal site and let you donate any amount you feel appropriate, either via your own PayPal account or credit/debit card. Harp is about $12.50 a pitcher around here, if that is any guide. Thanks!



Download Instructions: right-click on the filename and choose 'Save Link As'

Most recent additions and updates are highlighted with a yellow background.
Title Description Compatibility
3DSOLID functions
F2S.lsp
v 1.10
3/7/2010
Face-to-Solid LISP extrudes selected 3Dfaces along the current Z-axis to create a 3DSOLID with a flat bottom face. 2000+
M2S.lsp
v 1.5
3/7/2010

Mesh-to-Solid LISP extrudes an "old-style" open polygon mesh created with RULESURF, EDGESURF, AI_MESH, etc., along the current Z-axis to create a 3DSOLID with a flat bottom face. Does not work with polyface meshes; for these, explode them and use F2S.lsp. Does not work with version 2010-style meshes or surfaces; for these, use THICKEN or explode and use F2S. 2000+
Scoop.lsp
v 1.11
2/07/2010
Smart subtraction for single or multiple 3Dsolids, as if DELOBJ=0 applied to Boolean operations. Objects being subtracted remain in the model, and the objects subtracted from remain as individual solids, on their original layers, with their original materials. Includes option to separate resulting composite ('lumpy') solids. 2000+
Sep.lsp
v 1.0
2/07/2010
Separates one or more composite 3DSOLIDs and puts each of the resulting 'child' solids on the layer of its 'parent' solid, rather than on the current layer, as is the default AutoCAD action. 2000+
SHO.lsp
v 1.01
2010-02-12
Slice HOrizontal with just one pick point. SHO makes it easy to slice all selected 3D solids horizontally in the current UCS by picking just one point. 2000+
Sphere4Point.lsp
v 1.10
2010-03-14
Sphere4Point.lsp (S4P) draws the unique sphere defined by four non-coplanar points. all
Math, Graphing, and UCS functions
Add.lsp
ver 2.0
1/25/2010
Adds a series of numbers entered in any valid AutoCAD UNITS format(s), and displays the result in current units and precision. The result is returned as a real in the global symbol AddSum for use at the command line or in other functions. Numbers and distances can be entered either from the keyboard or by indicating pairs of points on the screen. Negative numbers and 0 are accepted. Can be used transparently. 2000+
F2P.lsp
v 1.2
1/25/2010
... like AutoCAD's M2P but uses any fraction instead of just midpoint. Returns a point a user-specified fraction of the distance between two other points. Accepts fractional (5/17), decimal (.33333), negative (-1.5), and improper (32/17) input. Most usefully used transparently. 2000+
GraphPolynomial.lsp
v 1.0
3/14/2010
GraphPolynomial.lsp (GPN) graphs any polynomial equation in the form of
y = axn + bxn-1 + cxn-2 ... + dx + e
using the origin of the current UCS as 0,0. The equation may be of any degree, i.e., no limit to highest exponent. The equation is both displayed as a text string and assigned to the global symbol GPNequation for use in labeling. Results may be plotted as points, line segments, a polyline, or a spline.
2000+
WCSid.lsp
v 1.0
1/25/2010
Returns WCS coordinates of a selected point, regardless of current UCS. 2000+
Object functions: query, create, copy, modify
3Darc.lsp Draws a 3-point arc in 3D regardless of current UCS or view. all
3Dcircle.lsp Draws a 3-point circle in 3D regardless of current UCS or view. all
BBalign.lsp Visually aligns selected objects in plan with left, center, right, top, middle, or bottom alignment, based upon each object's bounding box in the current UCS. 2000+
c0.lsp Copies selected object(s) in place. That's cee-zero, as in @0,0. Prompts whether to copy objects on locked layers, if any are selected. all
CC.lsp Continuous Copy keeps copying selected object(s) by the distance specified along the 2D or 3D vector specified, as long as you keep hitting the spacebar. Copies along X, Y, or Z axis; any 2D line; any 3D vector. Update Feb 2014 to fix OSNAP bug. 2000+
centroid.lsp (CTD)
v 1.0
4/14/2010
Centroid.lsp returns in current UCS coordinates the centroid of a selected object that can be in any UCS: region, 3Dsolid, circle, ellipse, closed polyline (heavy), closed LWpolyline, closed planar spline, or closed planar 3Dpolyline.
- If used transparently, returns a point to the calling command, like an OSNAP.
- If not used transparently, creates a POINT object on the current layer.
2000+
ConvexHull3D.lsp (CH3D)
v3.02
1/24/2011

All-new fast CH3D calculates the convex hull of a cloud of 3D point entities, and offers the user five output options: a 3Dsolid, facets, edges, cylindrical solid struts along the edges, and spherical solid joints at the hull points. Reports volume of solid, and the quantity of other options. Requires SWEEP and LOFT for strut and 3Dsolid options, so should work with 2007+, but has only been tested with 2011.

Version 3.02 provides greatly increased performance with large (200+) point clouds.

2011
DAP.lsp
v 2.11
3/15/2010
Dynamic Array Polar interactively spaces selected objects along an arc, ending tedious iterations of ARRAY POLAR by providing dynamic on-screen adjustment of all array parameters. We don't need no steenkin' dialog box! 2000+
FindFakeDims.lsp
v 1.10
2/14/2010
This routine identifies dimensions on editable layers whose dimension text has been overridden, and puts them on the Fake_Dims layer for further attention. If that layer does not exist, it will be created. The routine will leave alone dimension text strings that contain <>, like <>(TYP) or %%p<>, since these do report a true dimension. 2000+
OffsetMultiplePolylines.lsp (OMP)
v 1.02
4/06/2010
Offsets multiple CLOSED 2D polylines by the same amount, in the the same direction (in or out), in a single operation. Polylines can be in any UCS. 3Dpolylines are ignored. 2000+
PerpL.lsp
v 1.10
2010-02-13
Start a line or polyline perpendicular *from* any 2D curve that is parallel to the current UCS.
- Default behavior: start a LINE from the point picked on the object, using the running or override osnap setting to select the point.
- Options: start a [P]OLYLINE the same way, or select the [O]BJECT and the starting point in separate operations. The latter permits selecting the object to establish perpendicularity and then using its intersection with another object, for instance, to specify the start point.
2000+
PolyLineOverlap.lsp (PLO)
v 1.01
3/02/2010
Determines whether two polylines in the same plane overlap. If so, highlights the overlapping area in magenta and zooms in on it. Useful for mapping applications to check boundaries of adjacent properties for overlap. (Does not check for "underlap.") 2000+
RandomLayer.lsp
v 1.1
01/21/2010
RandomLayer.lsp assigns selected objects to layers randomly selected from a list of user-specified layers. Useful in rendering applications to make copies not look all alike. 2000+
requires DOSLib
RandomPoints.lsp
v 1.02
09/17/2008
RandomPoints.lsp generates a user-determined number of random 3D points within a unit cube centered on WCS origin.
Options: Random points in a sphere, rectangular volume, or ellipsoid.
Notes: Fewer points yield more irregular shapes
2000+
SphericalPointShell.lsp (SPS)
v 1.01
01/25/2011
SphericalPointShell.lsp generates a user-determined number of 3D points randomly in a spherical array.
2000+
Viewing functions
3c.lsp Enhancement to 3DORBIT that
1) prompts for 3DORBITCTR point and accepts [Enter] for AutoTarget,
2) temporarily turns off the annoying display of the grid if it is on,
3) optionally avoids unpredictability with UCS's other than the WCS,
4) displays those hard-to-remember 3Dorbit keyboard options on command line in AutoCAD 2007+.
2000+
Layer functions
0.lsp Makes layer 0 current, turning it on, thawing, and unlocking it in the process. Surprisingly useful for something so simple. all
Programmer's functions
BBoxOverlap.lsp
ver 1.0
02/07/2010
The BBoxOverlap function takes two entity names as arguments and returns T if their WCS bounding boxes overlap, nil if not. 2000+
SetFunctions.lsp
ver 1.3
03/07/2010
SetFunctions.lsp contains the following functions that operate on AutoLISP sets, ActiveX sets, or both at the same time:
SetUnion
SetSubtract
SetIntersect
SetComplement
SetVisibleOnScreen
SetCopy
SetPurge
Set->VL (VLA-OBJECT set)
Set->AL (AutoLISP set)
DumpSet

and one command-line command:
HelpSet
2000+


AutoCAD, AutoLISP, and Visual Lisp are registered trademarks of Autodesk, Inc., which is in no way responsible for the contents of this page or the routines available on it.