Is there a simpler way of changing the block text Height & width without using Block manager.
Their are just to many blocks to change and so little time to do it in
Printable View
Is there a simpler way of changing the block text Height & width without using Block manager.
Their are just to many blocks to change and so little time to do it in
You can change the X and Y values of a block [group of blocks] in the Properties menu.
Look HERE for some solutions in Autolisp.
I think I left something important out. I need to change the Height and width of the text in the block without changing the postion of the text
If block's text are attributes... you can use edat.lsp or eat.lsp...
http://www.cadtutor.net/forum/showthread.php?p=268332
If those objects are Dtext or Mtext, there must be ways to do it... like this to change Polyline width inside blocks... but I haven´t find any for text inside blocks yet.
http://forums.augi.com/showthread.php?t=50924
Select the text/mtext with ' nentsel ', then just change the dxf codes for what you want. I don't know the codes off hand, but they might be in the 40's. Then just update the entities ' entmod ', and then regen the drawing, and the new height width of the text entities within the block should show correctly. You only need to change it once per entity per block, and all will update.
I returned here a little too late... but here is a version..."btsize" (attached) will change all nested text and mtext inside all blocks in the current drawing to specified height without exploding them...it will require you to make a regenall after using it.
and for attributes you can use edat.lsp or athht
Code:; Allows editing of multiple attributes
; ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
; º Program: EDAT.LSP º
; º Purpose: Allows editing of multiple attributes º
; º Syntax: ed_att º
; º By: RESOLUTIONS Computer Consulting º
; º P.O. Box 1265 º
; º Sumner, WA 98390 º
; º (206) 845-2200 º
; º º
; º Date: 6/6/92, 2/17/95, 3/9/95 º
; º º
; º Revisions: º
; º 4/20/95 Added option to list the TAG names & prompts º
; º 5/31/95 Added option to change attrib Elevation º
; º 1/12/96 Removed testing statement from "*" position º
; º 3/3 /98 Oblique angle added º
; º º
; º º
; ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
(princ "\nLoading....Please wait.\n")
(defun c:edat (
;(defun c:ed_att (/ p1 p2 newval ss tag ans nr i l e fvalue pl val
; askstring ins_pt pt rot_pt r_fill ent
)
(defun r_fill (s len / space)
(setq space "" i (- len (strlen s)))
(substr (strcat s (repeat i (setq space (strcat space " ")))) 1 len)
)
(defun val (nr e) (cdr (assoc nr e)))
(defun askstring (prmpt default / str) ; ask for string
(if (null default)
(setq default "")
)
(princ (strcat "\n" prmpt " <" default ">: ")) ; show prompt & default value
(setq str (getstring T))
(if (= str "")
default ; not typed so return default
str ; string was typed so return it
)
)
(if (setq ss (ssget '((0 . "INSERT") (66 . 1))))
(progn
(setq tag "*")
(setq tag (strcase (askstring "Attribute TAG to edit (or ?)" tag)))
(while (= tag "?")
(textpage)
(princ "\nTAG Name Prompt")
(princ "\n-------- ------")
(setq e (entget (ssname ss 0)))
(setq ent (val -2 (tblsearch "block" (val 2 e))))
(while ent
(setq e (entget ent))
(if (= (val 0 e) "ATTDEF")
(princ (strcat "\n" (r_fill (val 2 e) 16) (val 3 e)))
)
(setq ent (entnext (val -1 e)))
)
(princ "\n")
(setq tag (strcase (askstring "Attribute TAG to edit (or ?)" "*")))
)
(graphscr)
(initget 1 "Color Decimals Elevation Height Layer Oblique Position Rotation Style Value")
(setq ans (getkword "\nColor/Decimals/Elevation/Height/Layer/Oblique/Position/Rotation/Style/Value: "))
(cond
((= ans "Color") (setq nr 62 newval (getint "\nNew Color Number (0 = BYBLOCK, 256 = BYLAYER): ")))
((= ans "Decimals") (setq nr 1 newval T pl (getint "\nNumber of decimal places: ")))
((= ans "Height") (setq nr 40 newval (getdist "\nNew Height: ")))
((= ans "Oblique") (setq nr 51 newval (getangle "\nNew Oblique angle: ")))
((= ans "Elevation") (setq nr 10 elev (getreal "\nNew Elevation: ")))
((= ans "Layer") (setq nr 8 newval (getstring "\nNew Layer: "))
(while (= (tblsearch ans newval) nil)
(princ (strcat "\n" (strcase newval) " not defined:"))
(setq newval (getstring "\nNew Layer: "))
)
)
((= ans "Position")(setq nr 10 p1 (getpoint "\nBase point: "))
(if p1
(setq p2 (getpoint p1 "\nNew point: ") newval T)
)
)
((= ans "Rotation")
(setq nr 50 newval (getangle "\nNew Angle: "))
(initget 1 "Attribute Block")
(setq rot_pt (getkword "\nRotate about? (Attribute/Block): "))
)
((= ans "Style") (setq nr 7 newval (getstring "New Style: "))
(while (= (tblsearch ans newval) nil)
(princ (strcat "\n" (strcase newval) " not defined:"))
(setq newval (getstring "\nNew Style: "))
)
)
((= ans "Value") (setq nr 1 newval (getstring T "\nNew Value: ")))
)
(setq i 0 l (sslength ss))
(while (and newval (< i l))
(setq e (entget (ssname ss i)))
(if (and (= (val 0 e) "INSERT") (= (val 66 e) 1))
(progn
(setq ins_pt (val 10 e))
(princ ".")
(setq e (entget (entnext (val -1 e))))
(cond
((= tag "*")
(while (/= (val 0 e) "SEQEND")
(cond
((= ans "Color")
(if (null (val 62 e))
(setq e (append (list (cons 62 7)) e))
)
)
((= ans "Decimals")
(setq fvalue (atof (val 1 e)))
(if (zerop fvalue)
(setq newval (val 1 e))
(setq newval (rtos fvalue 2 pl))
)
)
((= ans "Position")
(setq newval (polar (val 10 e) (angle p1 p2) (distance p1 p2)))
; (princ newval)
; (getstring)
)
((= ans "Elevation")
(setq newval (list (car (val 11 e)) (cadr (val 11 e)) elev))
(setq e (subst (cons 11 newval) (assoc 11 e) e))
(setq newval (list (car (val 10 e)) (cadr (val 10 e)) elev))
)
)
(setq e (subst (cons nr newval) (assoc nr e) e))
(entmod e)
(entupd (val -1 e))
(setq e (entget (entnext (val -1 e))))
)
)
(t (while (/= (val 0 e) "SEQEND")
(if (= tag (val 2 e))
(progn
(cond
((= ans "Color")
(if (null (val 62 e))
(setq e (append (list (cons 62 7)) e))
)
)
((= ans "Decimals")
(setq fvalue (atof (val 1 e)))
(if (zerop fvalue)
(setq newval (val 1 e))
(setq newval (rtos fvalue 2 pl))
)
)
((= ans "Position")
(setq newval (polar (val 10 e) (angle p1 p2) (distance p1 p2)))
)
((= ans "Elevation")
(setq newval (list (car (val 11 e)) (cadr (val 11 e)) elev))
(setq e (subst (cons 11 newval) (assoc 11 e) e))
(setq newval (list (car (val 10 e)) (cadr (val 10 e)) elev))
)
((= ans "Rotation")
(if (= rot_pt "Block")
(progn
(setq pt (polar ins_pt newval (distance ins_pt (val 10 e))))
(setq e (subst (cons 10 pt) (assoc 10 e) e))
)
)
)
)
(setq e (subst (cons nr newval) (assoc nr e) e))
(entmod e)
(entupd (val -1 e))
)
)
(setq e (entget (entnext (val -1 e)))))
)
)
)
)
(setq i (1+ i))
)
)
(princ "\nNothing selected.")
)
(princ)
)
(princ "\nMultiple Attribute Edit. Version 1.3")
(princ)
Code:;;;Elise Moss
;;;Moss Designs
;;;routine locates all attributes in a drawing and allows the user to specify a new height for them
;;;December 2001
;;;
(defun c:atth (/)
(setq new-txtht
(getreal
"\nEnter new text height for all attributes in the drawing: "
)
)
(setq ss (ssget "x" (list (cons 0 "INSERT"))))
; create list of all inserts
(setq sslen (sslength ss)) ; get number of inserts
(setq index 0)
(while (< index sslen) ; while index is less than the length of ss
(progn
(setq en (ssname ss index))
(while (/= en nil) ; as long as there are entities
(setq ent-list (entget en))
(setq typ (cdr (assoc 0 ent-list)))
(while (= typ "INSERT")
(progn
(setq ent-list (entget en))
(setq en (entnext en))
(setq ent-list (entget en))
(setq typ (cdr (assoc 0 ent-list)))
) ;end progn
) ; end while type = insert
(while (= typ "ATTRIB")
(progn
(setq val (cdr (assoc 1 ent-list))) ; get text value
(setq flag (cdr (assoc 70 ent-list))) ; get attribute type
(setq txtht (cdr (assoc 40 ent-list)))
; get attribute text height
(setq ent-list (subst (cons 40 new-txtht)
(cons 40 txtht)
ent-list
)
)
(entmod ent-list)
(setq en (entnext en))
(setq ent-list (entget en))
(setq typ (cdr (assoc 0 ent-list)))
) ;end progn
) ; end while typ = attrib
(setq en (entnext en))
); end while en /= nil
(setq index (+ index 1))
) ; end progn
) ; end while index < sslen
(command "regen")
(princ)
) ; end defun
(prompt "\nType 'atth' to change the height of all attributes in the drawing. ")