Jump to content

Calculator for Adding and Multiple


Guest balajibth84

Recommended Posts

Guest balajibth84
If I understand you correctly you would like to simplify the Multiply and Divide lisp so it acts more like the Add and Subtract lisp. Is that right?

 

What is it that you do not like about the Multiply and Divide lisp exactly?

 

I have not tested the lisp routine myself so I do not know what questions it is asking.

 

HAi remark i want the output(Multiply and Divide)just single select....What ever text i am selecting using tracking method immediately that output should execute in our cad command pallate....PLz chk amv attached add and subtraction lisp.......Just i am giving add and i am selecting the Text means its executing the output..Same model i want(Single click).........

Link to comment
Share on other sites

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

  • ReMark

    19

  • Cad64

    5

  • alanjt

    4

  • CADTutor

    2

Top Posters In This Topic

Guest balajibth84
To get a better idea of what you are seeing I will have to try the lisp routine first.

 

Sure Thanks Remark..PLz try....Plz see the this thread 2nd page...There is add and subtract lisp availble....I want same like that..so plz take that for a reference...thanks in advance..........

Link to comment
Share on other sites

In my opinion the lisp routine Combinevalues as generously contributed by alanjt is your best solution. It is simple to follow, requires very few clicks to use, and provides immediate results on the command line and allows the user to also place the result within the drawing using the same text style (layer, color, height, and rotation) as that which is selected. The user simply tells AutoCAD what arithmetic function is to be used and then they make but two picks. It could not be an easier. To prove it look at this:

 

Command: av (the command to get things started)

 

Choose function [Add/Divide/Multiply/Subtract] : m (for Multiply)

 

Select text object to Multiply or [Type]:

7.0 *

 

Select text object to Multiply or [Add/Divide/Multiply/Subtract/Type]:

7.0 * 5.0 = 35.0

 

Select text object to Multiply or [Add/Divide/Multiply/Subtract/Type]: *Cancel*

 

I did not elect to have the output included in the drawing but the option is available.

 

I think we're done now don't you?

Link to comment
Share on other sites

Guest balajibth84
In my opinion the lisp routine Combinevalues as generously contributed by alanjt is your best solution. It is simple to follow, requires very few clicks to use, and provides immediate results on the command line and allows the user to also place the result within the drawing using the same text style (layer, color, height, and rotation) as that which is selected. The user simply tells AutoCAD what arithmetic function is to be used and then they make but two picks. It could not be an easier. To prove it look at this:

 

Command: av (the command to get things started)

 

Choose function [Add/Divide/Multiply/Subtract] : m (for Multiply)

 

Select text object to Multiply or [Type]:

7.0 *

 

Select text object to Multiply or [Add/Divide/Multiply/Subtract/Type]:

7.0 * 5.0 = 35.0

 

Select text object to Multiply or [Add/Divide/Multiply/Subtract/Type]: *Cancel*

 

I did not elect to have the output included in the drawing but the option is available.

 

I think we're done now don't you?

 

 

 

Remark i have tried..But its not working properly....See this is My final reply...Try to understand me....PLz...

Just try my Add and Subtraction lisp first(Below mentioned)...Suppose i am adding means Like (Some text is available in Dwg like 123+12+34+45+67="281")...In my below lisp it will generate that output(281) after just selection(Tracking Selection)....So same like i want for multiple and Divide.....here what is the problem???u r understand now???

 

#(defun C:ADD (/ S1 LG INDEX A B C D)
 (setq S1    (ssget)
       LG    (sslength S1)
       INDEX 0
       C     0
 ) ;_ end of setq
 (while (/= INDEX LG)
   (setq A (entget (ssname S1 INDEX))
         D (cdr (assoc 0 A))
   ) ;_ end of setq
   (if (= D "TEXT")
     (progn
       (setq B (atof (cdr (assoc 1 A)))
             C (+ C B)
       ) ;_ end of setq
     ) ;_ end of progn
   ) ;_ end of if
   (setq INDEX (1+ INDEX))
 ) ;_ end of while
 (princ "\nTotal Value: ")
 (princ C)
 (princ)
)   ;end defun


(defun C:SUB (/ MS ML INDEXM CM MA MD MB CM S LG INDEX
             A B C C1 D
            )
 (prompt "SELECT the MAIN Number(s): ")
 (setq MS     (ssget)
       ML     (sslength MS)
       INDEXM 0
       CM     0
 ) ;_ end of setq
 (while (/= INDEXM ML)
   (setq MA (entget (ssname MS INDEXM))
         MD (cdr (assoc 0 MA))
   ) ;_ end of setq
   (if (= MD "TEXT")
     (progn
       (setq MB (atof (cdr (assoc 1 MA)))
             CM (+ CM MB)
       ) ;_ end of setq
     ) ;_ end of progn
   ) ;_ end of if
   (setq INDEXM (1+ INDEXM))
 ) ;_ end of while
 (prompt "\nSelect the NUMBERS to be DUDUCTED: ")
 (setq S     (ssget)
       LG    (sslength S)
       INDEX 0
       C     0
 ) ;_ end of setq
 (while (/= INDEX LG)
   (setq A (entget (ssname S INDEX))
         D (cdr (assoc 0 A))
   ) ;_ end of setq
   (if (= D "TEXT")
     (progn
       (setq B (atof (cdr (assoc 1 A)))
             C (+ C B)
       ) ;_ end of setq
     ) ;_ end of progn
   ) ;_ end of if
   (setq INDEX (1+ INDEX))
 ) ;_ end of while
 (setq C1 (- CM C))
 (princ "\nNett value: ")
 (princ C1)
 (princ)
   ; --------------------------------------------------------------------
)   ;---end defun#

Edited by Tiger
added codetags
Link to comment
Share on other sites

balajibth84:

 

I've done my best. I apologize but I cannot provide an answer to your problem.

 

I hope you are able to come up with a solution that works for you.

 

Regards,

 

ReMark

 

 

Albert Einstein: Definition of insanity: "Doing the same thing over and over again and expecting different results."

Link to comment
Share on other sites

  • 2 weeks later...
Guest balajibth84

Hai You have Any Lisp For Multiple the Text?Like in Dwg Some Text is Availble.

 

2

3

4

5

I am Selecting this Text and Give Multiple means its shouldbe execute the Result "120".So can you give any code for this ????

Link to comment
Share on other sites

balajibth84:

 

I think we have provided all the answers we can possibly give you on the subject. No offense but as far as this thread is concerned I really do not want to participate any more. We just keep going around in the same old circle again, and again, and again, and a........

 

And just one last time. It's multiply the text not multiple.

Link to comment
Share on other sites

I still say the linked function I provided is your best option. However, just swap the "+" in the addition function for a "*" and it will multiply. Granted, you cannot do this for divide, since order matters.

 

eg.

(/ 3. 5. 6.) -> 0.1

(/ 5. 6. 3.) -> 0.2777777

Link to comment
Share on other sites

  • 2 weeks later...
Guest
This topic is now closed to further replies.

×
×
  • Create New...