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. |