Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
HELLO EVERYONE HOW CAN I HIDE MULTIPLE ATTRIBUTES FOR ALL BLOCKS
THANKS TO EVERYONE, WHO WAS WILLING TO HELP
Solved! Go to Solution.
HELLO EVERYONE HOW CAN I HIDE MULTIPLE ATTRIBUTES FOR ALL BLOCKS
THANKS TO EVERYONE, WHO WAS WILLING TO HELP
Solved! Go to 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
Need confirmed how many blocks involved.
@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
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.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)
)
how do I use a lisp?
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
Hi,
i am using your Lisp file. but how would i change it to suit my Attributes below.
Thank you
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.
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.
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)