But it's possible to select block and text at once?
ssget filter modified to select ONLY blocks with attributes
Yes of course. perhaps its better to show a drawing sample for us to provide a suitable code or suggestion. I didn´t read all, but maybe help this code to convert a text -> block with attribut
(defun c:t2b ( / n aws obj) (setvar "cmdecho" 0) (setq os (getvar "osmode")) (princ "\nconvert text to block\n") (if (not (tblobjname "BLOCK" "YOUR BLOCK")) (alert "YOUR BLOCK IS NOT DEFINITION")) (setq n 0) (setvar "ATTDIA" 0) (setvar "ATTREQ" 1) (setvar "osmode" 0) (if (setq aws (ssget '((0 . "TEXT")))) (progn (repeat (sslength aws) (setq obj (entget (ssname aws n))) (command "_.-INSERT" "YOUR BLOCK" (cdr(assoc 10 OBJ)) (getvar "dimscale") (getvar "dimscale") 0 (rtos(atof (cdr(assoc 1 OBJ)))2 2)) (setq n (1+ n)) ) ) ) (setvar "cmdecho" 1) (setvar "osmode" os) (princ) ) Here a sample...magenta block will come block with attribute. Not a good idea using external link. Edit you post and attached the file I have only started... do you mean like this ?
DATA +06_example.dwg What a team !!! Thanks cadplayer! Here you have a quick tool to change Text in Block Attribut
correctly better so...
(defun c:cha (/ txt blk) (if (= (cdr (assoc 0 (entget (setq txt (car (entsel "\nSelect text value ")))))) "TEXT") (progn (if (and (= (cdr (assoc 0 (entget (setq blk (car (entsel "\nSelect Chapelle block ")))))) "INSERT") (= (cdr (assoc 2 (entget blk))) (cdr (assoc 2 (tblsearch "BLOCK" "Chapelle")))) ) (progn (entmod (subst (assoc 1 (entget txt)) (assoc 1 (entget (entnext blk))) (entget (entnext blk)))) (entdel txt) ) ) ) (princ "\nSelect a Text ") ) (princ) ) Cadplayer,
I've tried this lisp....but after selection of block my text is gone and there is no attribute at the chapelle block? Do you need TextObject or only TextAttribut ?
so delete only (entdel txt)
(defun c:cha (/ txt blk) (if (= (cdr (assoc 0 (entget (setq txt (car (entsel "\nSelect text value ")))))) "TEXT") (progn (if (and (= (cdr (assoc 0 (entget (setq blk (car (entsel "\nSelect Chapelle block ")))))) "INSERT") (= (cdr (assoc 2 (entget blk))) (cdr (assoc 2 (tblsearch "BLOCK" "Chapelle")))) ) (progn (entmod (subst (assoc 1 (entget txt)) (assoc 1 (entget (entnext blk))) (entget (entnext blk))));;; (entdel txt) ) ) ) (princ "\nSelect a text ") ) (princ) )
页:
1
[2]