Code:
;Detail updater (Du.lsp)
;It will update a complete detail, updating mtext, text to current textsize value, and width=0.8,
;It will update dimensions and leaders to current dims settings (dimscale)
;It will also grab only M3 standard blocks from selection and update their scale to current dimscale
(defun c:du (/ *error* doc oldc ss sel scl)
(vl-load-com)
(defun *error* (msg)
(if doc (vla-EndUndoMark doc))
(if oldc (setvar "CMDECHO" oldc))
(if (not
(wcmatch
(strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
(princ (strcat "\n** Error: " msg " **")))
(princ))
(setq doc (vla-get-ActiveDocument
(vlax-get-acad-object)))
(setq oldc (getvar "CMDECHO") scl (getvar "DIMSCALE"))
(setvar "CMDECHO" 0)
(princ " Select text, dimension, leaders to update:")
(princ " ")
(setq s_set (ssget '( (-4 . "<OR") (0 . "TEXT") (0 . "MTEXT") (0 . "DIMENSION") (0 . "LEADER") (-4 . "OR>") )));
(prompt "\nSelect Blocks to match current dimscale... ")
(if (setq ss (ssget '((0 . "INSERT")(2 . "AFC Spanish,AFC,AFCnfc,As Built,Asbuilt Spanish,Asterisk,Bluestake stick,Break line,Break,Center line,Center line2,Column row bubble,Column row bubble2,Detail Bubble 1,Detail Bubble 12,Detail bubble,Detail bubble2,Directional arrow,DTESTAMP,Dust pick up point,Dust pick up point2,DYNAMIC WELD SYMBOL,Equipment Tag1,Equipment Tag2,Flow arrow,Full section LR,Full Section LR2,Full section UD,Full section UD2,Full section,Full section2,GST026,GWE001,GWE001old,GWE002,GWE003,GWE004,GWE005,GWE006,GWE007,GWE008,GWE009,GWE010,GWE011,GWE012,GWE013,GWE014,GWE015,GWE016,GWE017,GWE018,GWE019,GWE020,HP36NOD,Issued for construction,Issued for Design,Issued for Feasibility Study Sticker,M3BOR,m3logo,Match line sp,Match line sp2,Match line,Match line2,ML,North arrow,North arrow2,Note box,Note box2,Note encl,Note encl2,nut 0.75,nut 1,Off sheet reference,Partial section t,Partial section t2,Partial section,Partial section2,Plate,Plate2,Preliminary Spanish,Preliminary,Reference,Revision,Revision2,Sample number,Sample number2,Section Cut UD,Section Cut UD2,Section Cut,Section Cut2,Section Marker,Stamp Big,Stamp Big2,Stamp Small,Stamp Small2,Stream number,Stream number2,Stream sequence,Stream sequence2,Tag,Tag2,Title 1,Title 12,Title bubble 1,Title bubble 12,Title bubble,Title bubble2,Title,Title2,Work point,Work point2,Worker1,Worker2,Worker3,Worker4,Worker5,Worker6,Worker7,Worker8"))))
(progn
(vla-StartUndoMark doc)
(command "_.-objectscale" ss "" "_add" "1:1" "")
(setvar "CANNOSCALE" "1:1")
(vlax-for Obj (setq sel (vla-get-ActiveSelectionSet doc))
(foreach x
(if (eq :vlax-true
(vla-get-IsDynamicBlock Obj))
'(XEffectiveScaleFactor YEffectiveScaleFactor ZEffectiveScaleFactor)
'(XScaleFactor YScaleFactor ZScaleFactor))
(vlax-put-property Obj x scl))
(if (eq :vlax-true (vla-get-HasAttributes Obj))
(command "_.attsync" "_Name"
(vlax-get-property Obj
(if (eq :vlax-true
(vla-get-isDynamicBlock Obj)) 'EffectiveName 'Name)))))
(vla-delete sel)
(vla-EndUndoMark doc)))
(setvar "CMDECHO" oldc)
(princ)
(setq new_heigth (getvar 'textsize)) ;
;Entity DXF List Information & Manipulation...
(setq index_1 0)
(while
(< index_1 (sslength s_set))
(setq e1_list (entget (ssname s_set index_1)))
(setq heigth (cdr (assoc 40 e1_list)))
(setq width (cdr (assoc 41 e1_list)))
(setq e1_list (subst (cons 40 new_heigth) (assoc 40 e1_list) e1_list ))
(setq e1_list (subst (cons 41 0.8) (assoc 41 e1_list) e1_list ))
(entmod e1_list)
(setq index_1 (+ index_1 1)
)
)
(command "_.-dimstyle" "_apply" s_set "")
(command "redraw")
)
Bookmarks