PDA

View Full Version : BLOCK NAMES


tyeelaw13
2005-10-11, 11:14 PM
Here's a lisp routine that will prompt to select a block, and then it will jump to the text command and enter the name of the block into the drawing. I've found this is very helpful when trying to set up design standard books that have the blocks but no block names.

Once you select the block, you will need to select the point where the text will begin (text not mtext fyi), and go from there! IF you get a "/" under the previous block name- you're not selecting the text placement correctly.


ENJOY
(defun c:blkname ()
(setq obj (car (entsel "\nPick Block...")))
(setq bname (cdr (assoc 2 (entget obj))))
(command "text" pause pause bname enter)
)

gilsoto13
2009-10-02, 10:30 PM
Here's a lisp routine that will prompt to select a block, and then it will jump to the text command and enter the name of the block into the drawing. I've found this is very helpful when trying to set up design standard books that have the blocks but no block names.

Once you select the block, you will need to select the point where the text will begin (text not mtext fyi), and go from there! IF you get a "/" under the previous block name- you're not selecting the text placement correctly.


ENJOY
(defun c:blkname ()
(setq obj (car (entsel "\nPick Block...")))
(setq bname (cdr (assoc 2 (entget obj))))
(command "text" pause pause bname enter)
)


Didn´t work, but it gave me an idea... and this one works... I am no programmer... but I worked... there must be many other goog codes to do it...

alanjt
2009-10-02, 11:04 PM
How about something like this?

(defun c:BlockName (/ #Ent #Point)
(and
(setq #Ent (car (entsel "\nSpecify block: ")))
(eq "INSERT" (cdr (assoc 0 (entget #Ent))))
(setq #Point (getpoint "\nSpecify placement point for MText: "))
(entmake (list
'(0 . "MTEXT")
'(100 . "AcDbEntity")
'(100 . "AcDbMText")
(cons 7 (getvar "textstyle"))
(cons 10 (trans #Point 1 0))
(cons 1 (cdr (assoc 2 (entget #Ent))))
) ;_ list
) ;_ entmake
) ;_ and
(princ)
) ;_ defun