Jump to content

Recommended Posts

Posted

A long time ago I used a lisp file that worked almost the same as the "ddatte" function / dialog. I believe it was part of an application, that I no longer work with since several years.

 

One big difference to the ommon "ddatte dialog" was that it had toggle switches (checkboxes) to set the attribute to visible / invisible.

 

Does anyone around still have that / such routine? I'd be glad to get a copy.

Posted

This will make your Atts invisible:

 

(defun c:invis (/ ent obj)
 (vl-load-com)

 (while (setq ent (car (nentsel "\nSelect Attribute: ")))
   (if (eq "ATTRIB" (cdr (assoc 0 (entget ent))))
     (vlax-put (setq obj (vlax-ename->vla-object ent)) 'invisible -1)))

 (princ))

 

Or, as a different functionality, this will make all tags with the listed name visible/invisible:

 

Upon Selection

(defun c:am1 (/ tag ss att obj)
 (vl-load-com)

 (setq tag "TAG1")

 (while (setq ss (ssget "_+.:E:S" '((0 . "INSERT") (66 . 1))))
   (foreach att (append (vlax-invoke (setq obj (vlax-ename->vla-object (ssname ss 0))) 'GetAttributes)
                        (vlax-invoke obj 'GetConstantAttributes))
     (if (eq tag (strcase (vla-get-TagString att)))
       (vlax-put att 'Invisible (~ (vlax-get att 'Invisible))))))

 (princ))

 

All Blocks:

 
(defun c:am2 (/ tag ss sel)
 (vl-load-com)

 (setq tag "TAG1") ;; <<-- Tag to be Searched

 (and (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1))))
      (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet
                                (vla-get-ActiveDocument (vlax-get-acad-object))))
         (foreach att (append (vlax-invoke Obj 'GetAttributes)
                              (vlax-invoke Obj 'GetConstantAttributes))
           (if (eq tag (strcase (vla-get-TagString att)))
             (vlax-put att 'Invisible (~ (vlax-get att 'Invisible))))))
      (vla-delete sel))

 (princ))

Posted
This will make your Atts invisible:

 

(defun c:invis (/ ent obj)
 (vl-load-com)

 (while (setq ent (car (nentsel "\nSelect Attribute: ")))
   (if (eq "ATTRIB" (cdr (assoc 0 (entget ent))))
     (vlax-put (setq obj (vlax-ename->vla-object ent)) 'invisible -1)))

 (princ))

 

Or, as a different functionality, this will make all tags with the listed name visible/invisible:

 

Upon Selection

(defun c:am1 (/ tag ss att obj)
 (vl-load-com)

 (setq tag "TAG1")

 (while (setq ss (ssget "_+.:E:S" '((0 . "INSERT") (66 . 1))))
   (foreach att (append (vlax-invoke (setq obj (vlax-ename->vla-object (ssname ss 0))) 'GetAttributes)
                        (vlax-invoke obj 'GetConstantAttributes))
     (if (eq tag (strcase (vla-get-TagString att)))
       (vlax-put att 'Invisible (~ (vlax-get att 'Invisible))))))

 (princ))

 

All Blocks:

 
(defun c:am2 (/ tag ss sel)
 (vl-load-com)

 (setq tag "TAG1") ;; <<-- Tag to be Searched

 (and (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1))))
      (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet
                                (vla-get-ActiveDocument (vlax-get-acad-object))))
         (foreach att (append (vlax-invoke Obj 'GetAttributes)
                              (vlax-invoke Obj 'GetConstantAttributes))
           (if (eq tag (strcase (vla-get-TagString att)))
             (vlax-put att 'Invisible (~ (vlax-get att 'Invisible))))))
      (vla-delete sel))

 (princ))

 

 

AM1 & AM2 are nice codes... must read into them for I dont get it at all.

Tnx for that.

 

Now: sleep on the couch!

Posted

Hi Marco,

 

Had some time this afternoon, see the attached suits you, ddatte with visibility toggles :)

 

Lee

ddatte2.lsp

  • Like 1
Posted

Hi Lee,

 

Thanks for this piece of code. It works like a charm and can be of great use.

 

See ya around,

Marco.

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...