[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Sum Values in Text Strings
Tip# 3509 By Scott Botting On 10-Oct-2010
Rated By 2 users Downloaded : 470
Categories : List
Software type : AutoCAD 2011
Rename File To : as.lsp
Add the numbers contained in all-numerical or mixed text strings.

Scott Botting shares a routine for adding up numerical values in text strings. Scott frequently labels the area of polylines in AutoCAD, then uses this routine to add up the areas in each label. The routine will read whole numbers or real numbers, but not a mix of the two. The text string does not have to consist only of numbers. For example, if your labels say something like "Area = 34.52 Acres," this routine will add up the numerical values while ignoring the other text. Start by loading the LISP file, then type in the command AS at the Command line. Select the text strings to add, and the answer will be displayed at the Command line. If you want to tweak this routine, Scott's code includes plenty of comments, which can make your job easier.


Average Rating:

User comments

Log In