Changing attribute layer in block, all at once

Changing attribute layer in block, all at once

Anonymous
Not applicable
2,830 Views
6 Replies
Message 1 of 7

Changing attribute layer in block, all at once

Anonymous
Not applicable

Hi,
Is it possible to change attribute layers in several bolocks all at once without using BATTMAN command?

0 Likes
2,831 Views
6 Replies
Replies (6)
Message 2 of 7

dlanorh
Advisor
Advisor

I'm assuming here you mean blocks since "bolocks" is also pretty close to a british slang word for testicles.😂

 

Yes is the answer, but you'll need to go into further details about types of attributes as constant attributes wil update all blocks/anonymous blocks automatically, while non constants will require the block references, anonymous definitions and base blocks updating if you wish to eradicate certain layers from blocks.

I am not one of the robots you're looking for

0 Likes
Message 3 of 7

3wood
Advisor
Advisor

You can try CHZ20 to change attribute layer in selected block definitions, settings as below:

Then use ATTSYNCALL to synchronize all block instances in the drawing to updated definition. 

Capture.PNG

 

 

0 Likes
Message 4 of 7

pbejse
Mentor
Mentor

@Anonymous wrote:

Hi,
Is it possible to change attribute layers in several bolocks all at once without using BATTMAN command?


What about the sidekick?

(defun c:Robbin (/ _CodeDingInitget atttblock ThisColor
		      ss  attTag func choices )
;;;	pBe July 2020	;;
  (defun _CodeDingInitget (lst)
;;; 	CodeDing|pBe 2020	;;;
    ((lambda (iStr gStr cnt)
       (repeat (length lst)
	 (setq cnt (1+ cnt))
	 (setq iStr (strcat iStr " " (itoa cnt)))
	 (setq gStr
		(strcat gStr "/" (itoa cnt) " ..." (nth (1- cnt) lst))
	 )
       )
       (setvar 'DYNMODE 3)
       (initget 1 iStr)
       (getkword (strcat "\nSelect text: [" gStr "]"))
     )
      "A"
      "All"
      0
    )
  )

  (prompt "\nSelect Attribute Block")
  (if
    (and
      (setq atttblock (ssget "_+.:S:E"
			     (setq fltr '((0 . "INSERT") (66 . 1)))
		      )
      )
      (setq ThisColor (acad_colordlg 7 t))
      (setq ss
	     (ssget
	       "_X"
	       (append
		 fltr
		 (list
		   (cons 2
			 (strcat "`*U*,"
				 (setq atname (getpropertyvalue
						(setq atb (ssname atttblock 0))
						"BlockTableRecord/Name"
					      )
				 )
			 )
		   )
		 )
	       )
	     )
      )
      (setq attTag (mapcar 'Vla-get-tagstring
			   (vlax-invoke
			     (vlax-ename->vla-object atb)
			     'GetAttributes
			   )
		   )
      )
    )
     (progn
       (setq choices (_CodeDingInitget attTag))
       (setq func
	      (if (eq "A" choices)
		mapcar
		(progn
		  (setq attTag (list (nth (1- (atoi choices)) attTag)))
		  vl-some
		)
	      )
       )

       (repeat (setq i (sslength ss))
	 (setq e (ssname ss (setq i (1- i))))
	 (If (eq atname (getpropertyvalue e "BlockTableRecord/Name"))
	   (func '(lambda (at)
		    (if	(member (vla-get-tagstring at) attTag)
		      (not (vla-put-color at ThisColor))
		    )
		  )
		 (vlax-invoke (vlax-ename->vla-object e) 'GetAttributes)
	   )
	 )
       )
     )
  )
  (princ)
)

HTH

Note:  ATTSYNC will revert it back to original

Message 5 of 7

Anonymous
Not applicable

With this can be changed only colour, or I am wrong?

0 Likes
Message 6 of 7

pbejse
Mentor
Mentor

@Anonymous wrote:

With this can be changed only colour, or I am wrong?


Yes, while awaiting for your reply to @dlanorh 's queries,

I posted that program as an example. We can change the prompt to ask for layer namer as soon as you confirm the questions from others.

 

Does it apply only for existing layers?

 

Its a quick mod 🙂

 

 

 

0 Likes
Message 7 of 7

timothy_crouse
Collaborator
Collaborator

Can someone modify this code to provide the following functionality:

 

Select 1 or multiple blocks

 

Command-line asks which attribute property to change

-Text Height (H)

-Color (C)  >> ACI (pick List for basic colors) or entry for ACI index or True Color value

-Layer (L)

-Text Style (S)

 

Each choice brings up a pickbox with a list of valid, properties to choose from, The lay list would be generated

from the available layers in the current drawing

 

Thanks in advacne

-Tim C.