Jump to content

Recommended Posts

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • crisraj99

    9

  • pBe

    5

  • ReMark

    4

  • SLW210

    3

Top Posters In This Topic

Posted
Didn't you get a lisp routine in post #8?

 

Well, i wasn't aware the OP is not targeting a specific layer from a list. hence the reply "its not working [crisraj99]" :)

 

FWIW

 

(defun c:WLTT (/ data fl opt run ef) ; write layer count  to text
(setq data nil)      
(vlax-for layout (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object)))
   (vlax-for i (vla-get-block layout)
       (Setq fl (vla-get-layer i))
(setq data
                  (if (setq ex (assoc fl data))
                      (subst (list fl (1+ (cadr ex))) ex data)
                      (cons  (list fl 1) data)))))
(initget "Yes No")
(setq opt (cond ((Getkword "\nWrite to file [Yes/No]: "))("Yes")))
(setq run       
(if (and (setq opt (Eq opt "Yes"))
        (setq ef (getfiled "Save data file" (getvar 'Dwgprefix) "txt" 1 ))
        (setq f (open ef "w")))
   	(lambda (o) (write-line (Strcat  (car o) "-----> "  (itoa (Cadr o))) f))
       (lambda (o) (print (Strcat  (car o) "-----> "  (itoa (Cadr o))))))
     )
       	
      (foreach itm data
        (if (not (zerop (Cadr itm)))
          	(run itm))
        )
     (if opt (progn
                   (close f)
                   (startapp "notepad" ef)) (textscr))
 (princ)  
)

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