Jump to content

Recommended Posts

Posted

hello bro,

 

please tell me about the counting in the drawing i have more 100 value in the drawing Example 100 L/s 223 L/s 525 L/s

i want total value of this

 

regard,

kamran saleem

Posted (edited)

  (defun c:addv ( / Total ss e)
(vl-load-com)  
  (if (setq total 0 ss (ssget "_X" '((0 . "TEXT")(1 . "*#*L/s"))))
     (progn
       (repeat (setq i (sslength ss))
       (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
       (setq total (+ (atoi  (vl-string-right-trim
                                         " L/s"
                                         (vla-get-textstring e)
                                         )
                                     ) total)))
                 [b][color=darkred](alert (strcat "Total=\t" (itoa total)))[/color][/b])
          (princ "\nNone Found:")
         )(princ)
 )

 

EDIT: Too many cut and paste, cut and paste, trim. trim. trim :D

Edited by pBe
Done in haste
Posted

Vanilla ...

 

(defun c:addv (/ Total ss i sn)
 (if (setq total 0
           ss    (ssget  '((0 . "*TEXT") (1 . "*#*L/s")))
     )
   (progn
     (repeat (setq i (sslength ss))
       (setq sn (ssname ss (setq i (1- i))))
       (setq total
              (+ (atoi
                   (substr (cdr (assoc 1 (entget sn)))
                           1
                           (- (strlen (cdr (assoc 1 (entget sn)))) 3)
                   )
                 )
                 total
              )
       )
     )
     (princ (strcat "\nTotal :" (itoa total)))
   )
   (princ "\nNone Found:")
 )
 (princ)
)

Posted

Where the heck have you've been hiding Tharwat? :)

Posted
Where the heck have you've been hiding Tharwat? :)

I had a very bad sunstroke that kept me sleeping for a week now .:(

 

Thanks for asking my friend .

Posted

thanks boss its working nice

but the result is not coming on screen if you can improve the code it will helpfull for us

Posted

(alert (strcat "Total=\t" (itoa total))))

 

instead

 

 
(princ (strcat "\nTotal " (itoa total)))

Posted
thanks bro,

 

Glad to help

 

Cheers kamig

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...