Message 1 of 18
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to extract attributes from all copies of a specific block to csv. I found a very promising LISP by @ronjonp in a related thread, but it has a user selection via polyline, where I just always want the same block without the user needing select them (there's hundreds of copies per drawing).
I hope I just need to know where to change the selection method. The LISP is:
(defun c:foo (/ _writefile a e p r s z) ;; RJP » 2020-07-14 (defun _writefile (fn lst / f) (cond ((and (eq 'str (type fn)) (setq f (open fn "w"))) (foreach x lst (if (= 'list (type x)) (write-line (apply 'strcat (mapcar '(lambda (z) (strcat (vl-princ-to-string z) ",")) x)) f ) (vl-princ-to-string x) ) ) (close f) fn ) ) ) (cond ((and (setq e (car (entsel "\Pick fence for selection: "))) (setq p (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget e))) (setq s (ssget "_F" (mapcar 'cdr p) '((0 . "INSERT") (66 . 1)))) ) (sssetfirst nil s) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq a (vlax-invoke (vlax-ename->vla-object e) 'getattributes)) (setq r (cons (append (cdr (assoc 10 (entget e))) (mapcar 'vla-get-textstring a)) r)) ) (princ (_writefile (strcat (getvar 'dwgprefix) "BlockStuff.csv") (append '((x y z attvals)) (reverse r)) ) ) ) ) (princ) ) (vl-load-com)
Any help would be appreciated
Thanks,
Gorra
Solved! Go to Solution.