Jump to content

Compare similar block tag


JuniorNogueira

Recommended Posts

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

Link to comment
Share on other sites

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.

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