Display full version of the post: need lisp code to sum only number in texts/mtext

SAYSINA
04.04.2013, 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 BELOWuploads/360147/NEED_LISP_TO_SUM_THIS_FILE.dwg

Vladimir Michl
04.04.2013, 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 info@cadstudio.cz for a quote.

John Connor
04.04.2013, 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

John Connor2013-04-04 12:31:49