HIDE MULTIPLE ATTRIBUTES

HIDE MULTIPLE ATTRIBUTES

rolisonfelipe
Collaborator Collaborator
1,327 Views
9 Replies
Message 1 of 10

HIDE MULTIPLE ATTRIBUTES

rolisonfelipe
Collaborator
Collaborator

HELLO EVERYONE HOW CAN I HIDE MULTIPLE ATTRIBUTES FOR ALL BLOCKS

THANKS TO EVERYONE, WHO WAS WILLING TO HELP

0 Likes
Accepted solutions (2)
1,328 Views
9 Replies
Replies (9)
Message 2 of 10

Sea-Haven
Mentor
Mentor
Accepted solution

 If a pick pick is ok then its as simple as 

 

 

(vla-put-Invisible (vlax-ename->vla-object (car  (nentsel "Pick attribute "))) 1)

 

 

 

If you want every block of a certain name have attributes turned off then need some way of knowing block name and attribute tag name/s, again you can change a block displayed or do you want the block definition changed so they are globally off. 

 

Could do pick block then click atts to be turned off

SeaHaven_0-1647659993928.png

 

Need confirmed how many blocks involved.

 

0 Likes
Message 3 of 10

pbejse
Mentor
Mentor

@rolisonfelipe wrote:

HELLO EVERYONE HOW CAN I HIDE MULTIPLE ATTRIBUTES FOR ALL BLOCKS

THANKS TO EVERYONE, WHO WAS WILLING TO HELP


(defun c:demo (/ ss i ev)
  (if
    (setq ss (ssget "_:L"
		    '((0 . "INSERT")
		      (66 . 1)
		      (2 . "SIMB_CIRCULO,SIMB_TRIANGULO,SIMB_CRUZETA")
		     )
	     )
    )
     (repeat (setq i (sslength ss))
       (setq ev (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
       (foreach	itm (vlax-invoke ev 'GetAttributes)
	 (if
	   (member (strcase (vla-get-tagstring itm)) '("DESC" "PONTO"))
	    (vla-put-visible itm 0)
	 )
       )
     )
  )
  (princ)
)

HTH

 

0 Likes
Message 4 of 10

3wood
Advisor
Advisor
Accepted solution

You can also try the code below.

When it prompts to select attribute, if nothing selected it will turn on all hidden attributes.

When an attribute is selected, you can choose turn on all attributes of the block or only the one you picked up.

ATTHIDE.gif

;;; ATTHIDE.lsp 2022.03.19 by 3wood
;;; Hide selected attribute in selected block only or hide them in all blocks.
;;; Turn on all attributes if nothing selected.
(defun C:ATTHIDE (/ a1 b1 s1 TagName)
  (vla-StartUndoMark (vla-get-activedocument (vlax-get-acad-object)))
  (if (and (setq a1 (car (nentsel)))
	   (setq b1 (vlax-ename->vla-object a1))
	   (= (vla-get-objectname b1) "AcDbAttribute")
	   (setq TagName (vla-get-TagString b1)) ;(vla-get-promptstring b1)
	   )
    (progn
      (initget "Yes No")
      (if (= (getkword "Hide attributes in other blocks? Yes/<No>: ") "Yes")
	(progn
	  (setq s1 (ssget "x" (list (cons 0  "INSERT")(assoc 2 (entget (cdr (assoc 330 (entget a1))))))))
	  (setq n1 0)
	  (repeat (sslength s1)
	    (setq b1 (vlax-ename->vla-object (ssname s1 n1)))
	    (foreach n2 (vlax-safearray->list  (vlax-variant-value  (vla-getattributes b1)))
	      (if (= (vla-get-tagstring n2) TagName)
		(vla-put-invisible n2 :vlax-true)
		)
	      )
	    (setq n1 (1+ n1))
	    )
	  )
	(progn
	  (vla-put-invisible b1 :vlax-true)
	  )
	)
      )
    (if (setq s1 (ssget "x" '((0 . "INSERT"))))
      (progn
	(setq n1 0)
	(repeat (sslength s1)
	  (setq a2 (vlax-ename->vla-object (ssname s1 n1)))
	  (if (= (vla-get-HasAttributes a2) :vlax-true)
	    (foreach n2 (vlax-safearray->list  (vlax-variant-value  (vla-getattributes a2)))
	      (vla-put-invisible n2 :vlax-false)
	      )
	    )
	  (setq n1 (1+ n1))
	  )
	)
      )
    )
  (vla-EndUndoMark (vla-get-activedocument (vlax-get-acad-object)))
  (princ)
  )

 

0 Likes
Message 5 of 10

nicholas.santorso2
Participant
Participant

how do I use a lisp?

 

0 Likes
Message 6 of 10

sigmmadesigner
Advocate
Advocate

I HAVE A TOPOGRAPHY PROGRAM THAT EXPORTS A CERTAIN GROUP OF INFORMATION IN A BLOCK, IN GENERAL WHEN I FINISH THE PROJECT I DON'T NEED ALL THE INFORMATION TO BE IN THE DRAWING, I USE THIS LSP TO HIDE THIS BLOCK INFORMATION WITHOUT NEEDING TO GENERATE THIS INFORMATION IN PROGRAM AND EXPORT AGAIN

0 Likes
Message 7 of 10

mhl2k22
Community Visitor
Community Visitor

Hi, 

i am using your Lisp file. but how would i change it to suit my Attributes below.

 

mhl2k22_0-1694478150955.png

Thank you

0 Likes
Message 8 of 10

Sea-Haven
Mentor
Mentor

If you want all 3 and that is all attributes then Bedit blockname, select the attributes, in properties set to Invisible. Bsave, type Attsync select, pick the block all done no need for code. Its changed all the blocks with that name.

0 Likes
Message 9 of 10

mhl2k22
Community Visitor
Community Visitor

Thank you for taking the time to respond. but i wanted to hide 2 attributes out of the 3. i wanna keep ADACid on but the rest is off. i have about 5700 block in one drawing and each block has a different name. 

0 Likes
Message 10 of 10

Sea-Haven
Mentor
Mentor

No worries, if the blocks are all similar ie 3 attributes then use the attribute order no need for tag names. Get attributes, (car atts) is 1st attribute set to invisible (cadr atts)  is second or use (nth 0 atts)(nth 1 atts)

0 Likes