Functions for AutoLISP®

written by Herman Mayfarth

Terms and Conditions of Use:

By downloading files from this page, you agree to abide by all conditions of license, use and redistribution provided herein and/or in the download package. In particular, you MAY NOT redistribute these files, as is, for a fee, or otherwise charge for their use. Permission to use these files is revocable at any time, at the sole discretion of the author, in case the stipulated terms of use have been abused and/or violated.


All material available here is provided as "copyrighted freeware," without technical support.
That means that if you find any of these functions useful, you are welcome to use them free of charge for any legal purpose.
The only consequence to you is that if your program fails because one of my functions returned unexpected results to your program, I do not owe you anything, and it is up to you to fix your own program, by whatever means.
You may include them in code which you write, either for your own use or for license or sale to others, without owing me anything, provided only that you acknowledge the source.
You may not redistribute, for a fee, any code posted here.
You may not redistribute any code posted here without acknowledging the source.
You may not claim any code posted here as your own work.
If you have written a similar or identical function, please refer to further disclaimer posted below.
If you violate the terms of use, I have the right to revoke your permission to use the code for any purpose, at my discretion.

Blanket Disclaimer of Warranty:

Herman Mayfarth and Tekton Construction Services provides all programs listed here "as is" and with all faults. Herman Mayfarth and Tekton Construction Services specifically disclaim any implied warranty of merchantability or fitness for a particular use. Herman Mayfarth and Tekton Construction Services do not warrant that the operation of any program listed here will be uninterrupted or error free.
Herman Mayfarth and Tekton Construction Services shall not be liable for any consequential damages due to the use of programs downloaded from this site.
THE USE OF ANY AND ALL PROGRAMS POSTED HERE IS ENTIRELY AT YOUR OWN RISK.


Further Disclaimer:

The functions on this page were written by me, primarily for my own use.

Nothing listed here, or posted on this website, is claimed to be the optimum method of accomplishing any specific task.

Although all functions posted here were written by me, and are my original work, it is entirely possible, perhaps even likely, that someone else may have written a very similar, or even identical, function to accomplish the same task. The author in that case may have chosen a different, or even the same, name for his function as I did for mine. It is also possible that someone else has written a much better function to accomplish the same thing

If you have written a similar, or even identical function, you are welcome to let me know that. In no case is it my intention to infringe on your original work, or claim your work as my own, and I will expect the same courtesy from you.
Some functions posted here are so simple and basic that the identical or very similar code has undoubtedly been "reinvented" by many people over the years. I have posted here what I have written on my own because I needed it, not something I copied from you or someone else.

If you have written a function which performs much better at the same task, you are cordially invited to let me know that as well. In that case, and assuming you have made your function available for others to use, I will be happy to acknowledge your better solution in my file, and provide a link to the location of your function online, so that others can compare the two and learn how not to do it. I'll also hope to be able to learn from your expertise, and be glad to use your function, with proper attribution, in my own programs.

If you see something posted here which flat does not work correctly, I would appreciate your kindness in informing me, so that I may attempt to fix the problem, and not mislead others.


Acknowledgements:

Whatever I know of AutoLISP is due in large part to exchanging ideas with others who program in this language. No one learns in a vacuum, and I would like to acknowledge the helpful (even scathing) comments, suggestions and criticism of the many talented participants, past and present, in Compuserve GO:ACAD (when it existed), comp.cad.autocad, autodesk.autocad.customization, and theswamp.

Look for new additions to this page as and when I get the time to write them.

If you have comments on any of these files, please feel free to e-mail me.
All constructive comments are welcome.

Herman Mayfarth



You may access any of the functions listed below either by clicking on the function name in the list below or expanding the AutoLISP Functions node in the menu frame on the left and clicking on a document icon.

File Name Description
++ increment an index
aboveline tests if a point is above/below or right/left of a line
adldrvrt add a vertex to a LEADER entity
adlwpvrt add a vertex to a LWPOLY entity
alldigits tests an arbitrary length string to determine if all characters represent base 10 digits
bfractor converts bigfont fraction to decimal real - handles inch + fractions only (no feet!)
colinear-p tests if points defining two lines are collinear
dictfuns functions for accessing data dictionaries
dlldrvrt delete a vertex from a LEADER entity
dllwpvrt delete a vertex from a LWPOLY entity
get10codes acquires a list of points and converts to a group code 10 association list
isdigit tests if character represents a numeric digit
linterp linear interpolation
mcdrs functions for processing association lists which have multiple cdrs with the same car
nthinsert insert a list or atom at specified location in a list
padortrunc pads or truncates a character string, right or left, to a designated width
padrorl pads a character string, right or left
plinrect entmake a traditional PLINE or LWPOLY rectangle
purgegroups purge groups which contain zero or at most one entity
replachr replaces characters in a string
rtodfrm converts real to MTEXT representation of fraction w/ no bar
rtodtstl converts real to MTEXT representation of ft & inches w/ no fraction bar, no inch marks
rtofrm converts real to MTEXT representation of fraction w/bar
rtomtftin converts real to MTEXT representation of ft & inches - choice of fraction styles
ssseg segregates a selection set by entity type
str2num converts a string representing a number into a real or integer
strip_chars strip all instances of a list of characters from a string
strip_whitespace strip all non-printing characters from a string
strmemb determine if a string is a member of a list
strtok creates a list of tokens from a delimited string
table retrieves entries in symbol tables
tktn_osmode enable, disable & restore osnaps
tktn_zoom functions which zoom the view without cancelling entity highlights or grips