Jump to content

help to modify a routine Lee Mac


adolfo2020

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Thank you very much, works great.

 

Two favors that can also insert the table in autocad and inserted another tag "MAQUI-".

 

Thank you again.

Link to comment
Share on other sites

One more question and I can delete the values ​​that are zero, since the account me too.

 

Thank you

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...