Jump to content

Help with modification of lisp (LENGTH BY LAYERWISE WITH COLOR)


h123ngoisao

Recommended Posts

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.

 

Link to comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

 

 

 

  • Like 2
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

  • Like 2
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...