anwar186 Posted December 19, 2018 Posted December 19, 2018 Hi, Can anybody help me? I need a lisp for multiplying several numbers in Auto CAD by 1000 , numbers are real and with decimal as well. Thanks Quote
ketxu Posted December 19, 2018 Posted December 19, 2018 Maybe starting with quick dirty code lines : (defun c:foo() (ssget (list (cons 0 "*TEXT"))) (vlax-for obj (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-Acad-Object))) (vla-put-textstring obj (rtos (* (distof (vla-get-textstring obj)) 1000.0) 2 3) ) ) (princ) ) (vl-load-com) 1 Quote
Lee Mac Posted December 19, 2018 Posted December 19, 2018 (edited) You can use this and simply change the "+" to "*": (+ x *inc*) Becomes: (* x *inc*) Edited December 19, 2018 by Lee Mac 1 Quote
anwar186 Posted December 22, 2018 Author Posted December 22, 2018 Thanks, ketxu and Lee for your help, Both the lisp worked perfectly. Quote
B M Posted November 2, 2021 Posted November 2, 2021 On 12/20/2018 at 12:35 AM, Lee Mac said: You can use this and simply change the "+" to "*": (+ x *inc*) Becomes: (* x *inc*) Lee, thank you for this. The only problem I'm facing is that the final text result prefixes a number before it. For example if I want 1103.944 multiplied by 1.3, the end result will be .300;1435.127. Same for if I want it multiplied by 1.4. It will prefix .4 before the result. Quote
Lee Mac Posted November 2, 2021 Posted November 2, 2021 By any chance, is the object in question MText containing formatting applied through the MText editor? My guess is that my program is also applying the arithmetic operation to the MText formatting codes embedded within the MText content. Quote
B M Posted November 3, 2021 Posted November 3, 2021 2 hours ago, Lee Mac said: By any chance, is the object in question MText containing formatting applied through the MText editor? My guess is that my program is also applying the arithmetic operation to the MText formatting codes embedded within the MText content. Yes exactly, it is MText. Should I explode to Text and then run the lisp? For now my workaround was just using Find to pick all the prefixes and replacing them with an empty space. Quote
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.