h123ngoisao Posted March 14, 2023 Posted March 14, 2023 Hello everyone, I want to add 1 more column counting the number of objects to the table created by the attached lisp like the picture. The table will use the Tahoma font and scale when inserted. Thanks! LENGTH BY LAYERWISE WITH COLOR.dwg POLYLENGHT_Lenght of Each polyline by layerwise in table.LSP Quote
BIGAL Posted March 14, 2023 Posted March 14, 2023 Did you try contacting one of the authors like Hak_vz. Quote
h123ngoisao Posted March 15, 2023 Author Posted March 15, 2023 2 hours ago, BIGAL said: Did you try contacting one of the authors like Hak_vz. i downloaded this lisp on internet and i don't know where is the source of this lisp. Quote
tombu Posted March 15, 2023 Posted March 15, 2023 9 hours ago, h123ngoisao said: i downloaded this lisp on internet and i don't know where is the source of this lisp. Hopefully you'll learn from this. Anytime you download a lisp file add the link you downloaded it from commented out in the lisp file. It's usually the best location to ask for help like now. Not changing the name of the lisp makes it easier to search for online. Lenght of Each polyline by layerwise in table.LSP. 1 Quote
h123ngoisao Posted March 15, 2023 Author Posted March 15, 2023 1 hour ago, tombu said: Hopefully you'll learn from this. Anytime you download a lisp file add the link you downloaded it from commented out in the lisp file. It's usually the best location to ask for help like now. Not changing the name of the lisp makes it easier to search for online. Lenght of Each polyline by layerwise in table.LSP. That's right, thanks for your reply. Quote
h123ngoisao Posted March 15, 2023 Author Posted March 15, 2023 I found the answer, thanks for reading. Quote
Steven P Posted March 15, 2023 Posted March 15, 2023 So how are your LISP abilities? If you follow the link that Tombu found it explains how to add another column then to do a count I think you should add: From Lee Mac, Add this as a separate function or a sub routine: ;;http://lee-mac.com/uniqueduplicate.html (defun LM:CountItems ( l / c x ) (if (setq x (car l)) (progn (setq c (length l) l (vl-remove x (cdr l)) ) (cons (cons x (- c (length l))) (LM:CountItems l)) ) ) ) To use that you'll need a list to add all the lines to something like this near the beginning of the LISP (setq Countlines (list)) You'll want to populate the list, with this line somewhere in the first repeat loop, after the (setq e... ) line (setq Countlines (append Countlines (list (vlax-get e 'Layer)))) and then send this to Lee Macs function to count the unique number of layers used, best if this is after the end of the first repeat of course (setq Countlines (LM:CountItems Countlines)) Then using the example and copying what is in the LISP already, populate the table column with this probably just before the line containing ;set color markers - though that is not so important so long as it is with the table creation part (vla-setCellValue Area_table crow 2 (cdr (assoc (car d) CountLines))) ;Count (vla-setcelltextheight Area_table crow 2 500.0) (vla-setCellAlignment Area_table crow 2 5) 2 Quote
h123ngoisao Posted March 15, 2023 Author Posted March 15, 2023 19 minutes ago, Steven P said: So how are your LISP abilities? If you follow the link that Tombu found it explains how to add another column then to do a count I think you should add: From Lee Mac, Add this as a separate function or a sub routine: ;;http://lee-mac.com/uniqueduplicate.html (defun LM:CountItems ( l / c x ) (if (setq x (car l)) (progn (setq c (length l) l (vl-remove x (cdr l)) ) (cons (cons x (- c (length l))) (LM:CountItems l)) ) ) ) To use that you'll need a list to add all the lines to something like this near the beginning of the LISP (setq Countlines (list)) You'll want to populate the list, with this line somewhere in the first repeat loop, after the (setq e... ) line (setq Countlines (append Countlines (list (vlax-get e 'Layer)))) and then send this to Lee Macs function to count the unique number of layers used, best if this is after the end of the first repeat of course (setq Countlines (LM:CountItems Countlines)) Then using the example and copying what is in the LISP already, populate the table column with this probably just before the line containing ;set color markers - though that is not so important so long as it is with the table creation part (vla-setCellValue Area_table crow 2 (cdr (assoc (car d) CountLines))) ;Count (vla-setcelltextheight Area_table crow 2 500.0) (vla-setCellAlignment Area_table crow 2 5) Thanks for the reply, I don't know about lisp programming, I'm just a user. Quote
Steven P Posted March 15, 2023 Posted March 15, 2023 Have a go, and see if you can get it to work - it is all there, but we can help you along the way and is a great way to learn 2 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.