ancrayzy Posted December 6, 2021 Share Posted December 6, 2021 Hi, I know a lisp that can count text here. http://www.lee-mac.com/tcount.html Is there any lisp similar to this that can give the result with: number of instances inclusion their layers name? Regards, Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 6, 2021 Share Posted December 6, 2021 (edited) Lots like me happy to do a custom lisp, but need beer money. Or have a go at adding layer to Lee's code. If you want to hve a go ssget the text create a list of layer name and text string remove duplicates and count This is the core bits to get what you want thanks to Gile. The lst5 is the result that is used in making a table. ; Make a count of common items ; By AlanH Aug 2021 (vl-load-com) ; By Gile (defun my-count (a L) (cond ((null L) 0) ((equal a (car L)) (+ 1 (my-count a (cdr L)))) (t (my-count a (cdr L)))) ) ; By Gile (defun remove_doubles (lst) (if lst (cons (car lst) (remove_doubles (vl-remove (car lst) lst))) ) ) (setq lst4(remove_doubles lstube)) (foreach val lst4 (setq cnt (my-count val lstube)) (setq lst5 (cons (list (/ cnt 2)(nth 0 val )(nth 1 val))lst5)) ) Yes I have something but would need to remove all the un necessary bits in the code. Edited December 6, 2021 by BIGAL 1 Quote Link to comment Share on other sites More sharing options...
ancrayzy Posted December 7, 2021 Author Share Posted December 7, 2021 (edited) Many thanks @BIGAL for your reply, but i still don't know how to use your code. The result maybe like this. And it would be great to add the option to scale the table before exporting the results Edited December 7, 2021 by ancrayzy Missing information Quote Link to comment Share on other sites More sharing options...
mhupp Posted December 7, 2021 Share Posted December 7, 2021 Two more answers. 1 Quote Link to comment Share on other sites More sharing options...
ancrayzy Posted December 7, 2021 Author Share Posted December 7, 2021 3 minutes ago, mhupp said: Two more answers. Many thanks @mhupp for your reply, I don't know how to code autolisp, do I just copy and combine all the code in that post into a single lisp and use it? Quote Link to comment Share on other sites More sharing options...
mhupp Posted December 7, 2021 Share Posted December 7, 2021 (edited) Above my coding knowledge once lambda & mapcar show up really need to sit down and learn those. I know at least @Tharwat can remember his password. maybe he will poke his head in here. (Se7en) Edited December 7, 2021 by mhupp 1 1 Quote Link to comment Share on other sites More sharing options...
ancrayzy Posted December 7, 2021 Author Share Posted December 7, 2021 1 hour ago, mhupp said: Above my coding knowledge once lambda & mapcar show up really need to sit down and learn those. I know at least @Tharwat can remember his password. maybe he will poke his head in here. (Se7en) Thank you so much Mr @mhupp 1 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.