Thanks for your quick reply,
This code is intended use in autocad, the file generated by plant 3d, in this all the blocks are unique (Only one item with same block name ). This is for pipe support which has unique number. This is a not a block name its a tag name. I have attached a property of the block for ready reference.
Sorry for confusing with block name. I need to show tag name of the support of piping.
We are not intending any export the data, we are looking at write the tag name near to the support possibly with leaderline and textframe as shown in the attachment.
The problem looks like half sloved with this code
(defun c:BNBLBC (/ en ss ctr bl the_list n)
(setq ss (ssget "X" (list (cons 0 "INSERT")))
ctr (sslength ss)
)
(repeat ctr
(setq ctr (1- ctr)
en (entget (ssname ss ctr))
bl (strcat (cdr (assoc 2 en)))
)
(if (setq count (cdr (assoc bl the_list)))
(setq the_list (subst (cons bl (1+ count))(cons bl count) the_list))
(setq the_list (cons (cons bl 1) the_list))
)
)
(setq the_list (vl-sort the_list '(lambda (e1 e2)(< (car e1) (car e2)))))
(foreach n the_list
tt (strcat "'" (car n) )
;(sssetfirst nil (ssget "_X" '((0 . "INSERT")(2 . tt))))
(sssetfirst nil (ssget "_X" '((0 . "INSERT")(2 . "`*U27"))))
(command "lnsert" p1 p2 "")
(setq TXTHT 3.5) ;;set plotted text height
(setq TXTHT (* TXTHT (getvar "dimscale"))) ;;adjust height per dimscale
(command ".STYLE" "romans" "" "0" ".75" "0" "N" "N" "N"
".TEXT" "J" "C" PT TXTHT ".125" NN)
)
)
above code gives error at"Insert "
@ВeekeeCZ wrote:
@Anonymous wrote:
Hi,
Good Day Sir,
Looking for help in Lisp Coding to select Each Block (Automatic), one by one from entire Drawing .
Before i use this code , select block By Block Name and Block Layer Name as Follows.
(sssetfirst nil (ssget "_X" '((0 . "INSERT")(2 . "`*U27"))))-SELECT BLOCK by Block Name
(sssetfirst nil (ssget "_X" '((0 . "INSERT")(8 . "Left View-SUPPORTS"))))-SELECT BLOCK by Block Layer Name
but write now i wanted to select Each Block (Automatic), one by one from entire Drawing, but for this operation how i perform ? or which code i follow please guide me .
Your help in this highly appreciated.
Regards
Well, trying to understand you...
I guess your fixed to some idea how to preform the job, but the thing does not work like that.
You need to select some group (selection set) of entities (blocks in your case) by some criteria (name?, same attribute?). Once you have it, you need use some systematic way to deal with one block after another (going thrue the selection set). So in my example I've used the REPEAT loop, and saved the ename of each block (one by one) into the ent variable.
So what you have and what you need? Your screen shot is confusing. You marked some TAG and its value. Is that what you need to export? Or it is a block name, as you describe...: "We are looking for a code to give a block names for piping support. "
Please would you describe the whole process simple points? Like
- selecting all block by name *U27
- go thrue selection set, get and export the value of "Tag"
- export where, to the command line?
Thanks