Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;|------------------------------|;
- ;| AG Simple Addition |;
- ;| www.ArthurGanem.com |;
- ;|------------------------------|;
- ;|
- 1) Command: SIMADD
- 2) Click text object (MTEXT or TEXT) you want to add.
- 3) Click text object you want to add.
- 4) Click text object in which you want to display the total.
- |;
- (prompt "\nLoaded AG Simple Addition!")
- (defun c:simadd(/ mspace loop selection xselection number1 number2 total)
- (vl-load-com)
- (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
- (setq loop 1)
- (while (= loop 1)
- (setq selection (entsel "\nSelect the number you want to add --> \n"))
- (if (/= selection nil)
- (progn
- (setq xselection (vlax-ename->vla-object (car selection)))
- (if (or (= (vla-get-ObjectName xselection) "AcDbText") (= (vla-get-ObjectName xselection) "AcDbMText"))
- (progn
- (setq number1 (atoi (vla-get-TextString xselection)))
- (setq loop 0)
- ) ;progn
- ) ;if
- ) ;progn
- ) ;if
- ) ;while
- (setq loop 1)
- (while (= loop 1)
- (setq selection (entsel "\nSelect the second number you want to add --> \n"))
- (if (/= selection nil)
- (progn
- (setq xselection (vlax-ename->vla-object (car selection)))
- (if (or (= (vla-get-ObjectName xselection) "AcDbText") (= (vla-get-ObjectName xselection) "AcDbMText"))
- (progn
- (setq number2 (atoi (vla-get-TextString xselection)))
- (setq loop 0)
- ) ;progn
- ) ;if
- ) ;progn
- ) ;if
- ) ;while
- (setq loop 1)
- (while (= loop 1)
- (setq selection (entsel "\nSelect TXT or MTEXT to which you want to input the total -->"))
- (if (/= selection nil)
- (progn
- (setq xselection (vlax-ename->vla-object (car selection)))
- (if (or (= (vla-get-ObjectName xselection) "AcDbText") (= (vla-get-ObjectName xselection) "AcDbMText"))
- (progn
- (setq total (+ number1 number2))
- (vla-put-TextString xselection (itoa total))
- (setq loop 0)
- ) ;progn
- ) ;if
- ) ;progn
- ) ;if
- ) ;while
- (princ)
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement