adolfo2020 Posted July 2, 2014 Posted July 2, 2014 First thank you for the great work you do. I want to ask if you can help me with two changes to your routines CountAttributeValues that can only add the tags MAT-1, MAT-2 and MAT-3 and has the option to generate an external file cvs. I hope you can help me. Thanks in advance and forgive my bad English. Thank you Quote
Lee Mac Posted July 2, 2014 Posted July 2, 2014 Hi adolfo, Download & load my Write CSV function and then try the following quickly written code: (defun c:countmat ( / a e f i l s v x ) (if (and (setq s (ssget '((0 . "INSERT") (66 . 1)))) (setq f (getfiled "Output File" "" "csv" 1)) ) (progn (repeat (setq i (sslength s)) (setq e (entnext (ssname s (setq i (1- i)))) x (entget e) ) (while (= "ATTRIB" (cdr (assoc 0 x))) (if (wcmatch (cdr (assoc 2 x)) "MAT-[123]") (if (setq a (assoc (setq v (cdr (assoc 1 x))) l)) (setq l (subst (cons v (1+ (cdr a))) a l)) (setq l (cons (cons v 1) l)) ) ) (setq e (entnext e) x (entget e) ) ) ) (LM:writecsv (mapcar '(lambda ( x ) (list (car x) (itoa (cdr x)))) l) f) ) ) (princ) ) The above is untested. Quote
adolfo2020 Posted July 3, 2014 Author Posted July 3, 2014 Thank you very much, works great. Two favors that can also insert the table in autocad and inserted another tag "MAQUI-". Thank you again. Quote
adolfo2020 Posted July 3, 2014 Author Posted July 3, 2014 One more question and I can delete the values that are zero, since the account me too. Thank you 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.