Print Page | Close Window

need lisp code to sum only number in texts/mtext

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DWF formats, Design Review, AutoCAD 360, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=9111
Printed Date: 21.Jun.2025 at 23:24


Topic: need lisp code to sum only number in texts/mtext
Posted By: SAYSINA
Subject: need lisp code to sum only number in texts/mtext
Date Posted: 04.Apr.2013 at 05:55
hi everyone
i want to sum only number in text or mtext
for example
-> EBA 12 (21) NDBR(25.56)....=0.2 IT'S MTEXT
-> FD 12 (102) IT'S MTEXT
-> NDBR 21 (2 PIPE DUCT) IT'S MTEXT
-> (X1=25.32) IT'S TEXT (X2=54.21) IT'S TEXT TOO

AND I WANT TO GET RESULT
->12+21+25.56+0.2=...
->12+102=...
->21+2=...
->SUM TEXT AND TEXT 1+25.32+2+54.21=...
->SUM MTEXT AND TEXT
->SUM MTEXT AND MTEXT
I WANT MAKE IT SELECT BY OBJECT. AND CAN APPLY TO EVERY DRAWING.

ANYONE CAN HELP ME?

SEE MY DWG FILE BELOW
uploads/360147/NEED_LISP_TO_SUM_THIS_FILE.dwg" rel="nofollow - uploads/360147/NEED_LISP_TO_SUM_THIS_FILE.dwg


-------------
12345679



Replies:
Posted By: Vladimir Michl
Date Posted: 04.Apr.2013 at 07:54
This can be programmed using regular expressions. As this is a very specific task (not a general utility - we usually offer them for free), please contact mailto:info@cadstudio.cz" rel="nofollow - info@cadstudio.cz for a quote.

-------------
Vladimir Michl (moderator)
ARKANCE - https://arkance.world" rel="nofollow - https://arkance.world - Autodesk Platinum Partner


Posted By: John Connor
Date Posted: 04.Apr.2013 at 11:45
There are free lisp routines that can sum numbers in text.  Try an Internet search or visit The Swamp and/or Cadalyst magazine on line (look in the CAD Tips area).

When you visit The Swamp look for alanjt's thread called Combinevalues.  It contains a lisp routine that will Add, Divide, Multiple or Subtract object values.  CombineValues.lsp v1.2  Copyright 04-09-10 Alan J. Thompson




-------------
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."

<<AutoCAD 2015>>




Print Page | Close Window