h123ngoisao Posted March 14 Share Posted March 14 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 Link to comment Share on other sites More sharing options...
BIGAL Posted March 14 Share Posted March 14 Did you try contacting one of the authors like Hak_vz. Quote Link to comment Share on other sites More sharing options...
h123ngoisao Posted March 15 Author Share Posted March 15 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 Link to comment Share on other sites More sharing options...
tombu Posted March 15 Share Posted March 15 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 Link to comment Share on other sites More sharing options...
h123ngoisao Posted March 15 Author Share Posted March 15 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 Link to comment Share on other sites More sharing options...
h123ngoisao Posted March 15 Author Share Posted March 15 I found the answer, thanks for reading. Quote Link to comment Share on other sites More sharing options...
Steven P Posted March 15 Share Posted March 15 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 Link to comment Share on other sites More sharing options...
h123ngoisao Posted March 15 Author Share Posted March 15 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 Link to comment Share on other sites More sharing options...
Steven P Posted March 15 Share Posted March 15 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 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.