newchurchr Posted February 10, 2016 Share Posted February 10, 2016 Does anyone know the fastest way to add commas to numbers in autocad? I have alot of numbers in a drawing and i need to add commas to them all. Is there a lisp i could use to add them all at once? Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted February 10, 2016 Share Posted February 10, 2016 This lisp function will do it. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/1-000-comma-separator/m-p/5015844#M322340 Quote Link to comment Share on other sites More sharing options...
newchurchr Posted February 10, 2016 Author Share Posted February 10, 2016 i cant get that command to work Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted February 10, 2016 Share Posted February 10, 2016 It worked for me before I posted it. I'm doing it again now... After loading the function, it works fine. Command: (rtoc 123456789.09876 2) "123,456,789.10" Quote Link to comment Share on other sites More sharing options...
newchurchr Posted February 10, 2016 Author Share Posted February 10, 2016 (edited) i saved the text as an .lsp and loaded thru appload just like i always have and then i type rtoc to active the command nothing happens is there something i'm doing wrong. (defun rtoc ( n p / d i l x ) (setq d (getvar 'dimzin)) (setvar 'dimzin 0) (setq l (vl-string->list (rtos n 2 p)) x (cond ((cdr (member 46 (reverse l)))) ((reverse l))) i 0 ) (setvar 'dimzin d) (vl-list->string (append (reverse (apply 'append (mapcar '(lambda ( a b ) (if (and (zerop (rem (setq i (1+ i)) 3)) b) (list a 44) (list a) ) ) x (append (cdr x) '(nil)) ) ) ) (member 46 l) ) ) ) Edited February 11, 2016 by rkmcswain Added CODE tags Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 11, 2016 Share Posted February 11, 2016 You have to call it and pass two variables the number and precison (rtoc 123456789.09876 2) (defun rtoc ( n p / d i l x ) defun rtoc, n & P are two variables to be supplied, d i l x are local variables used in the code, the / seperates local and global variables. (setq num 1234567.23) (rtoc num 2) Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted February 11, 2016 Share Posted February 11, 2016 i saved the text as an .lsp and loaded thru appload just like i always have and then i type rtoc to active the command nothing happens is there something i'm doing wrong. I'm not sure what else I can show you. Pass this function a real number (the one you want to add commas to), and an integer (the level of precision you want). It's not a full working command that will allow you to select entities, etc. Command: (rtoc 123456789.09876 2) "123,456,789.10" 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.