Message 1 of 3

Not applicable
05-22-2019
04:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone ,
is there a way to change all Attribute Names(Tags) into " x " globally ?
Maybe already a .lsp ? i searched everywhere and couldnt find a way to change all tags without renaming them manually.
If someone is so kind to fix it into the "Change attribute Tag" Script would be super awesome!
First for mor clearification:
A script or makro should change the Tag "NO" to "X1" and "DATE" to "X2" without me typing the old tag somehere (50.000 Attribute tags to type 😕 )
Script that i am useing right now (Only for 2 or 3 blocks tho)
(defun C:RAT (/ RenAttrib ; local function data^) ;;; Rename attributes (defun RenAttrib ($blk $old $new / blocks bo eo ao) ;; Get blocks collection in current drawing (setq blocks (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object)))) ;; Step through all blocks (if (setq bo (vla-item blocks $blk)) ;; Step through all entities inside block (vlax-for eo bo (cond ;; If attdef & in target block & old tag ((and (= (vla-get-ObjectName eo) "AcDbAttributeDefinition") (= (strcase (vla-get-Name bo)) (strcase $blk)) (= (vla-get-TagString eo) $old) ) ;_ end of and (vla-put-TagString eo $new) ;Change to new name ) ;; If block reference & target block ((and (= (vla-get-ObjectName eo) "AcDbBlockReference") (= (strcase (vla-get-EffectiveName eo)) (strcase $blk)) ) ;_ end of and ;; Step through all attributes (foreach ao (vlax-safearray->list (vlax-variant-value (vla-GetAttributes eo))) ;; Check if target attrib (if (= (strcase (vla-get-TagString ao)) (strcase $old)) (vla-put-TagString ao $new) ;Change to new name ) ;_ end of if ) ;_ end of foreach ) ) ;_ end of cond ) ;_ end of vlax-for ); if );_ end of defun ; here start C:RAT (setq data^ '( ("Block1" ("oldTag1" "newTag1") ("oldTag2" "newTag2") ("oldTag3" "newTag3") ); list ("Block2" ("oldTag1" "newTag1") ("oldTag2" "newTag2") ("oldTag3" "newTag3") ); list ); list ); setq (foreach blk data^ (foreach item blk (RenAttrib blk (car item) (cadr item)) ); foreach ); foreach (princ) ); C:RAT
Best regards thanks for the work guys!
Inb4 some asks - cant post a example .dwg
Solved! Go to Solution.