BrianTFC Posted August 27, 2012 Share Posted August 27, 2012 Hi, i was wondering if there was away to add the following with a lisp rountine, i do a lot of material list with this format. 5'-3" 6'-4 11/16" 4'-3" the answer would be 15'-10 11/16", i would like to be able to select them and it would add them together. i would appreciate any help. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 27, 2012 Share Posted August 27, 2012 Very quickly written: (defun c:addtxt ( / i n r s ) (if (setq s (ssget '((0 . "TEXT") (1 . "*#*")))) (progn (setq r 0.0) (repeat (setq i (sslength s)) (if (setq n (distof (cdr (assoc 1 (entget (ssname s (setq i (1- i)))))))) (setq r (+ n r)) ) ) (princ (strcat "\nTotal: " (rtos r))) ) ) (princ) ) Will use the settings of LUNITS & LUPREC in your drawing. Quote Link to comment Share on other sites More sharing options...
BrianTFC Posted August 28, 2012 Author Share Posted August 28, 2012 Thanks Lee your the Lisp God!!!!!...it worked great...you hit out of the park agian... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 28, 2012 Share Posted August 28, 2012 You're welcome Brian, cheers Quote Link to comment Share on other sites More sharing options...
BrianTFC Posted August 28, 2012 Author Share Posted August 28, 2012 Hi Lee, You said that it uses the lunits and the luprec, i was wondering if you could use to different types of number in the string and multiply them together? like qty / length / total 8 / 3'-8 9/16" / 29'-8 1/2" Brian Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 28, 2012 Share Posted August 28, 2012 Certainly, but I'm afraid I cannot devote any more voluntary time to this project. Quote Link to comment Share on other sites More sharing options...
neophoible Posted August 28, 2012 Share Posted August 28, 2012 Hi Lee, You said that it uses the lunits and the luprec, i was wondering if you could use to different types of number in the string and multiply them together? like qty / length / total 8 / 3'-8 9/16" / 29'-8 1/2" Brian Brian, originally you asked to add selected text. This Q sounds like a separate request. Now you want to multiply a selected text a certain number of times? Why not just COPY or ARRAY, then select them all and add them that way? It will achieve the same effect without further programming. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 29, 2012 Share Posted August 29, 2012 This conjures all sorts of dramas and it would be seperate program all together we have it so easy in metric 8-1.132 = 9.055 just need to look for the delimeter in this case the -. An answer in your task look for 1st space then remove from text then run Lees program then multiply by the number that was removed. Print answer. I am sure I downloaded a search for character.lsp from Lee's web site. Use Substr find its position then work out the left over text. A better way now is use vl-string-search Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.