Jump to content

invisible attribute


RobyG

Recommended Posts

How would I change a selected attribute from visible to invisible using visual lisp and then have another routine to make all attributes in a selected block visible?

 

thanks

 

roby

Link to comment
Share on other sites

Try the following two programs:

(defun c:hideatt ( / ent )
   (while
       (progn (setvar 'errno 0) (setq ent (car (nentsel "\nSelect attribute: ")))
           (cond
               (   (= 7 (getvar 'errno))
                   (princ "\nMissed, try again.")
               )
               (   (/= "ATTRIB" (cdr (assoc 0 (entget ent))))
                   (princ "\nSelected object is not an attribute.")
               )
               (   (vla-put-invisible (vlax-ename->vla-object ent) :vlax-true))
           )
       )
   )
   (princ)
)
(defun c:showatts ( / ent )
   (while
       (progn (setvar 'errno 0) (setq ent (car (entsel "\nSelect block: ")))
           (cond
               (   (= 7 (getvar 'errno))
                   (princ "\nMissed, try again.")
               )
               (   (/= "INSERT" (cdr (assoc 0 (entget ent))))
                   (princ "\nSelected object is not a block.")
               )
               (   (/= 1 (cdr (assoc 66 (entget ent))))
                   (princ "\nSelected block is not attributed.")
               )
               (   (foreach att (vlax-invoke (vlax-ename->vla-object ent) 'getattributes)
                       (vla-put-invisible att :vlax-false)
                   )
               )
           )
       )
   )
   (princ)
)
(vl-load-com) (princ)

Link to comment
Share on other sites

thanks Lee

 

I will figure out how to make all attributes in the dwg visible again, when all in a block are invisible the block can't be selected, because the blocks are just attributes.

 

thanks again

 

roby

Link to comment
Share on other sites

Try the following two programs:

(defun c:hideatt ( / ent )
   (while
       (progn (setvar 'errno 0) (setq ent (car (nentsel "\nSelect attribute: ")))
           (cond
               (   (= 7 (getvar 'errno))
                   (princ "\nMissed, try again.")
               )
               (   (/= "ATTRIB" (cdr (assoc 0 (entget ent))))
                   (princ "\nSelected object is not an attribute.")
               )
               (   (vla-put-invisible (vlax-ename->vla-object ent) :vlax-true))
           )
       )
   )
   (princ)
)
(defun c:showatts ( / ent )
   (while
       (progn (setvar 'errno 0) (setq ent (car (entsel "\nSelect block: ")))
           (cond
               (   (= 7 (getvar 'errno))
                   (princ "\nMissed, try again.")
               )
               (   (/= "INSERT" (cdr (assoc 0 (entget ent))))
                   (princ "\nSelected object is not a block.")
               )
               (   (/= 1 (cdr (assoc 66 (entget ent))))
                   (princ "\nSelected block is not attributed.")
               )
               (   (foreach att (vlax-invoke (vlax-ename->vla-object ent) 'getattributes)
                       (vla-put-invisible att :vlax-false)
                   )
               )
           )
       )
   )
   (princ)
)
(vl-load-com) (princ)

 

hi Lee thanks for this...

 

commonly i do turn on QTEXT for me to select the invisible attributes use and turn it off back again.

 

can this be modified a bit to continously TURN ON invisible attributes until i hit enter?

Edited by nod684
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...