o0ki1ler Posted October 12, 2021 Posted October 12, 2021 hello ,LEE MAC ,I take the liberty to write this letter to you about your LISP program for dynamic block countV1, which does not support dynamic stretching. I am a novice myself. I have not worked it out for a long time. I want to get your help. I wonder if you have time to update this program. Thank you! Quote
mhupp Posted October 12, 2021 Posted October 12, 2021 Maybe use http://www.lee-mac.com/contact.html 1 Quote
o0ki1ler Posted October 14, 2021 Author Posted October 14, 2021 I can't send letters in Http://www.lee-mac.com/contact.html. I know he often haunts this forum. I come here to try my luck. Quote
o0ki1ler Posted October 14, 2021 Author Posted October 14, 2021 DBCountV1-1.lsp http://www.lee-mac.com/lisp/html/DBCountV1-1.html Quote
o0ki1ler Posted October 15, 2021 Author Posted October 15, 2021 Stretch dynamic block test file, welcome to test test.dwg Quote
BIGAL Posted October 17, 2021 Posted October 17, 2021 If I understand correct you want the total of the number of blocks with the same length value. (defun c:blkcnt ( / lst ss blk val ) (setq lst '() lst2 '() lst3 '()) (setq ss (ssget (list (cons 0 "INSERT")(cons 2 "*U*")))) (repeat (setq x (sslength ss)) (setq blk (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq val (LM:getdynpropvalue blk "规格")) (setq lst (cons val lst)) ) (setq lst2 (remove_doubles lst)) (foreach len lst2 (setq cnt (my-count len lst)) (setq lst3 (cons (list len cnt) lst3)) ) (princ) ) (c:blkcnt) (princ lst3) ((1800.0 2) (1200.0 4) (2000.0 5)) Quote
o0ki1ler Posted October 18, 2021 Author Posted October 18, 2021 (edited) Yes, but I tested it with your code, and there was no way to select the layer. I don't know why. On 10/17/2021 at 11:55 AM, BIGAL said: If I understand correct you want the total of the number of blocks with the same length value. (defun c:blkcnt ( / lst ss blk val ) (setq lst '() lst2 '() lst3 '()) (setq ss (ssget (list (cons 0 "INSERT")(cons 2 "*U*")))) (repeat (setq x (sslength ss)) (setq blk (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq val (LM:getdynpropvalue blk "规格")) (setq lst (cons val lst)) ) (setq lst2 (remove_doubles lst)) (foreach len lst2 (setq cnt (my-count len lst)) (setq lst3 (cons (list len cnt) lst3)) ) (princ) ) (c:blkcnt) (Princ Lst 3) ((1800.0 2) (1200.0 4) (2000.0 5)) Edited October 18, 2021 by o0ki1ler Quote
o0ki1ler Posted October 18, 2021 Author Posted October 18, 2021 Here is the LEEMAC code and the number of blocks I need to count, which is sent out here, as well as the results of my test. test.dwg DBCountV1-1.lsp Quote
BIGAL Posted October 18, 2021 Posted October 18, 2021 I have updated the code above I am not sure what you want as output so if you type !lst3 after running you will see result. The sort does not like the non english characters so I removed and works on your new dwg. Quote
o0ki1ler Posted October 19, 2021 Author Posted October 19, 2021 I come from China, and I'm not very good at English, but it doesn't affect programming. Just replace the Chinese characters in the block with letters! 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.