JuniorNogueira Posted January 13, 2020 Share Posted January 13, 2020 I have 2 blocks with equal value tags How do I write these two tags on the same line as .csv? attachments from my attempts Any help for me taking the right direction will be most welcome! thanks in advance (defun c:foo (/ ss file i) (if (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1) (2 . "TESTBLOCK01,`*U*")))) ;;(2 . "test,`*U*") (progn (setq file (open (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ".csv") "w")) (repeat (setq i (sslength ss)) (setq br (ssname ss (setq i (1- i)))) (if (= (getpropertyvalue (getpropertyvalue br "BlockTableRecord") "Name") "TESTBLOCK01") (write-line (strcat (getpropertyvalue br "NUMBER") "," (getpropertyvalue br "REPORT") ;;; "," ;;; (if (eq 02_NUMBER NUMBER) ;;; (getpropertyvalue br "02_NUMBER NUMBER") ;;; ;;; ;;; ) file ) ) ) (close file) ) ) (princ) ) Example .csv 01,ITEM01;ITEM02; ITEM03;ITEM04,NAME01 02,ITEM01;ITEM02; 03,ITEM02; ITEM03;ITEM04,NAME02X 04,ITEM05;ITEM07; 05,ITEM01;ITEM05; 06,ITEM02;ITEM03; 07,ITEM01;ITEM07;ITEM08;,NAME05X EXP.dwg Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted January 14, 2020 Share Posted January 14, 2020 (edited) Studying this topic may help. Edited January 14, 2020 by Roy_043 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 14, 2020 Share Posted January 14, 2020 Your on the right track get the attribute details as the blocks appear to have the number in different attribute order then use two ifs as one is block the other is dynamic. I would make a list of the answers ((num att)(num att)…. you can then sort the list on the number making sure 1 2 3 etc then write list to file. Need to use a check is dynamic (vlax-invoke blk 'getdynamicblockproperties) this returns nil if its not a dynamic block. See www.Lee-mac.com dynamic block lisp. Quote Link to comment Share on other sites More sharing options...
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.